Lean1337

Payday system using one timer / automatic world time change

Feb 13th, 2015
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public OnFilterScriptInit()
  2. {
  3. TCHECK();
  4. return 1;
  5. }
  6.  
  7. forward TCHECK();
  8. public TCHECK()
  9. {
  10. new hour,minute,second,ctime,ftime,ztime,zstring[128];
  11. gettime(hour,minute,second);
  12. FixHour(hour);
  13. hour = shifthour;
  14. if(minute == 00) return PAYCHECK(); // if minute is 00 we call payday, else not
  15. SetWorldTime(hour);
  16. ctime = (minute - 59); // current time - 59 - by this we get time remaining till minute 59.
  17. ftime = (ctime * 60); // Calculating how many seconds ctime is in minutes //
  18. format(zstring, sizeof(zstring),"%d000",ftime); // formating the remaining time.
  19. strdel(zstring, 0,1); // deleting the minus from the number.
  20. ztime = strval(zstring); // Formating the string into an integer.
  21. SetTimer("PAYCHECK",ztime+60000,0); // we now set a timer with the seconds raiming till HOUR:00 and adding one minute!
  22. return 1;
  23. }
  24.  
  25.  
  26.  
  27.  
  28.  
  29. forward PAYCHECK();
  30. public PAYCHECK()
  31. {
  32. new hour,minute,second;
  33. gettime(hour,minute,second);
  34. FixHour(hour);
  35. hour = shifthour;
  36. SetWorldTime(hour);
  37. SendClientMessageToAll(COLOR_YELLOW, "PayDay!");
  38. SendClientMessageToAll(COLOR_YELLOW, "Thanks for playing on Leans Training Server.");
  39. SetTimer("PAYCHECK",3600000,0); // We call this script in exactly 3600 seconds (ONE HOUR).
  40. return 1;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment