Raised This Month: $51 Target: $400
 12% 

Error compiling Task Scheduler


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 04-20-2004 , 20:50   Error compiling Task Scheduler
Reply With Quote #1

I was trying to port over JustinHoMi's Task Scheduler and I got the following compile error:

Quote:
task_scheduler.sma(30) : warning 219: local variable "time" shadows a variable at a preceding level
PLEASE HELP - thank you in advance...

here is the code:
Code:
/* AMX Mod script. (Nov 10th, 2002) * * Task Scheduler 0.2 *  by JustinHoMi * * amx_task time "task" flags * flags: *  m - time is in minutes *  s - time is in seconds *  r - repeat task *  t - specific time * */ #include <amxmod> new task_cmds[32][108] new task_times[32][16] new numtasks = 0 public load_task() {     if (read_argc() < 4) {         server_print("[AMX] Usage:  amx_task < time > ^"command^" < flags >")         return PLUGIN_HANDLED     }     new args[128]     read_args(args,128)     new time[6], cmd[108], flags[5]     parse(args,time,6,cmd,108,flags,5)     new Float:time_f = floatstr(time)     new flag[2] = ""     if (contain(flags,"r") != -1)         flag="b"     if (contain(flags,"m") != -1)         time_f = time_f * 60     if (contain(flags,"t") != -1)     {         copy(task_cmds[numtasks],108,cmd)         copy(task_times[numtasks],6,time)         numtasks++         return PLUGIN_HANDLED     }     set_task(time_f,"run_task",0,cmd,108,flag)     return PLUGIN_CONTINUE } public run_task(cmd[]) {     server_cmd(cmd)     return PLUGIN_HANDLED } public check_time() {     new curtime[16]     get_time("%H:%M",curtime,16)     for(new i=0; i<numtasks; i++)         if(equal(curtime,task_times[i]))             server_cmd(task_cmds[i])     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("Task Scheduler","0.2","JustinHoMi")     register_srvcmd("amx_task","load_task")     set_task(60.0,"check_time",1,"",0,"b")     return PLUGIN_CONTINUE }
__________________
pendragon is offline
Send a message via ICQ to pendragon
BAILOPAN
Join Date: Jan 2004
Old 04-20-2004 , 21:27  
Reply With Quote #2

don't use the "time" variable, make a different name
__________________
egg
BAILOPAN is offline
pendragon
Senior Member
Join Date: Mar 2004
Location: In a bubble
Old 04-20-2004 , 22:29  
Reply With Quote #3

WOOT it worked.. thank you - ill add it to the plugins:

Code:
/* AMX Mod script. (Nov 10th, 2002) * * Task Scheduler 0.2 *  by JustinHoMi * * amx_task time "task" flags * flags: *  m - time is in minutes *  s - time is in seconds *  r - repeat task *  t - specific time * */ #include <amxmod> new task_cmds[32][108] new task_times[32][16] new numtasks = 0 public load_task() {     if (read_argc() < 4) {         server_print("[AMX] Usage:  amx_task < time > ^"command^" < flags >")         return PLUGIN_HANDLED     }     new args[128]     read_args(args,128)     new clock[6], cmd[108], flags[5]     parse(args,clock,6,cmd,108,flags,5)     new Float:time_f = floatstr(clock)     new flag[2] = ""     if (contain(flags,"r") != -1)         flag="b"     if (contain(flags,"m") != -1)         time_f = time_f * 60     if (contain(flags,"t") != -1)     {         copy(task_cmds[numtasks],108,cmd)         copy(task_times[numtasks],6,clock)         numtasks++         return PLUGIN_HANDLED     }     set_task(time_f,"run_task",0,cmd,108,flag)     return PLUGIN_CONTINUE } public run_task(cmd[]) {     server_cmd(cmd)     return PLUGIN_HANDLED } public check_time() {     new curtime[16]     get_time("%H:%M",curtime,16)     for(new i=0; i<numtasks; i++)         if(equal(curtime,task_times[i]))             server_cmd(task_cmds[i])     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("Task Scheduler","0.2","JustinHoMi")     register_srvcmd("amx_task","load_task")     set_task(60.0,"check_time",1,"",0,"b")     return PLUGIN_CONTINUE }
__________________
pendragon is offline
Send a message via ICQ to pendragon
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode