#include <amxmodx>
new ptime,pcmd
public plugin_init()
{
register_plugin("Cron", "0.1", "mazdan");
register_cvar("cron_time" , "")
register_cvar("cron_cmd" , "")
}
public plugin_cfg()
{
ptime=get_cvar_pointer("cron_time")
pcmd=get_cvar_pointer("cron_cmd")
check_time()
}
public check_time()
{
new ctime[21]
new now_time[21]
get_pcvar_string(ptime,ctime,20)
if(ctime[0]) //защита от поломок и дураков :D
{
format_time(now_time,20,"%H:%M:%S",get_systime())
new Float:timer=float(parse_time(ctime,"%H:%M:%S")-parse_time(now_time,"%H:%M:%S"))+0.0001
if(timer>0.0)
set_task(timer,"server_task")
else
set_task(3599.0,"check_time")
}
}
public server_task()
{
new ccmd[256]
get_pcvar_string(pcmd,ccmd,255)
server_cmd(ccmd)
set_task(1.1,"check_time")
}