HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2.  
  3. new task_cmds[32][108]
  4. new task_times[32][16]
  5. new numtasks = 0
  6.  
  7. public load_task()
  8. {
  9. if (read_argc() < 4) {
  10. server_print("[AMX] Hasznalat: amx_task < ido > ^"parancs^" < jelzo >")
  11. return PLUGIN_HANDLED
  12. }
  13.  
  14. new args[128]
  15. read_args(args,128)
  16. new clock[6], cmd[108], flags[5]
  17.  
  18. parse(args,clock,6,cmd,108,flags,5)
  19. new Float:time_f = floatstr(clock)
  20.  
  21. new flag[2] = ""
  22. if (contain(flags,"r") != -1)
  23. flag="b"
  24. if (contain(flags,"m") != -1)
  25. time_f = time_f * 60
  26.  
  27. if (contain(flags,"t") != -1)
  28. {
  29. copy(task_cmds[numtasks],108,cmd)
  30. copy(task_times[numtasks],6,clock)
  31. numtasks++
  32. return PLUGIN_HANDLED
  33. }
  34.  
  35. set_task(time_f,"run_task",0,cmd,108,flag)
  36.  
  37. return PLUGIN_CONTINUE
  38. }
  39.  
  40. public run_task(cmd[])
  41. {
  42. server_cmd(cmd)
  43. return PLUGIN_HANDLED
  44. }
  45.  
  46. public check_time()
  47. {
  48. new curtime[16]
  49. get_time("%H:%M",curtime,16)
  50.  
  51. for(new i=0; i<numtasks; i++)
  52. if(equal(curtime,task_times[i]))
  53. server_cmd(task_cmds[i])
  54.  
  55. return PLUGIN_CONTINUE
  56. }
  57.  
  58. public plugin_init()
  59. {
  60. register_plugin("Task Scheduler","0.2","JustinHoMi")
  61. register_srvcmd("amx_task","load_task")
  62. set_task(60.0,"check_time",1,"",0,"b")
  63. return PLUGIN_CONTINUE
  64. }
  65.