Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3.  
  4. #define FILTERSCRIPT
  5.  
  6. #if defined FILTERSCRIPT
  7.  
  8. #include <a_samp>
  9. #include <YSI\y_timers>
  10. #include <YSI\y_commands>
  11.  
  12. new bool:player_duty[MAX_PLAYERS];
  13. new time_duty[MAX_PLAYERS];
  14.  
  15.  
  16. public OnFilterScriptInit()
  17. {
  18. for(new i = 0; i < MAX_PLAYERS; i++)
  19. {
  20. player_duty[i] = false;
  21. time_duty[i] = 0;
  22. }
  23. return true;
  24. }
  25.  
  26. CMD:duty(playerid, params[])
  27. {
  28. if(IsPlayerAdmin(playerid))
  29. {
  30. new string[144];
  31. if(player_duty[playerid] != true)
  32. {
  33. strdel(string, 0, 144);
  34. format(string, sizeof(string), "** %s has been duty.", Name(playerid));
  35. SendClientMessageToAll(-1, string);
  36. player_duty[playerid] = true;
  37. }
  38. else if(player_duty[playerid] != false)
  39. {
  40. strdel(string, 0, 144);
  41. if(time_duty[playerid] < 60)
  42. {
  43. format(string, sizeof(string), "** %s ah mode out of duty, total time on duty: %d seconds.", Name(playerid), time_duty[playerid]*1);
  44. SendClientMessageToAll(-1, string);
  45. }
  46. else if(time_duty[playerid] >= 60)
  47. {
  48. format(string, sizeof(string), "** %s ah mode out of duty, total time on duty: %d minutes.", Name(playerid), time_duty[playerid]/60*1);
  49. SendClientMessageToAll(-1, string);
  50. }
  51. time_duty[playerid] = 0;
  52. player_duty[playerid] = false;
  53. }
  54. }
  55. else
  56. {
  57. SendClientMessage(playerid, -1, "You are not administrator.");
  58. }
  59. return true;
  60. }
  61.  
  62. stock Name(playerid)
  63. {
  64. new name[24];
  65. GetPlayerName(playerid, name, 24);
  66. return name;
  67. }
  68.  
  69. task count_time_duty[1000]()
  70. {
  71. for(new i = 0; i < MAX_PLAYERS; i++)
  72. {
  73. if(IsPlayerConnected(i))
  74. {
  75. if(player_duty[i] != false)
  76. {
  77. time_duty[i]++;
  78. }
  79. }
  80. }
  81. return true;
  82. }
  83.  
  84. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement