AnonScRIPteR

Easy Server Restart by Slo_Runner

Nov 9th, 2014
979
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.08 KB | None | 0 0
  1. /* -------------Easy Server Restart by Slo_Runner------------------------------
  2.  
  3. Code by: slorunner
  4. @ Skype : pekarna.cerkno
  5.  
  6. ---------------------------Donations-------------------------------------------
  7.  
  8.  Bitcoin: 1LoaMPdxnUECaXusPTMLPJ9pJCxbcKHU27
  9.  Dogecoin: DCPbvRmU4TeNApvVbCHN9QAn1HDz8ghjik
  10.  Syscoin: SPhevhnp2MegNvQBM7ZcUz4fw4uBhaictB
  11.  Blackcoin: B9iHDPU16vv3BQW5vnh45Kjnyjzoj28ZCx
  12.  
  13. -------------------------------------------------------------------------------
  14.  
  15. Don't remove credits!!!
  16.  
  17. -------------------------------------------------------------------------------
  18. */
  19.  
  20. #define RESTART_TIME 5 // set restart delay in minutes
  21. #define FILTERSCRIPT
  22. #define PASS "your long pass or something xD" //change to total random pass :D
  23.  
  24. #include <a_samp>
  25.  
  26. #if defined FILTERSCRIPT
  27. new Text:restart_text;
  28. public OnFilterScriptInit()
  29. {
  30.     print("\n--------------------------------------");
  31.     print(" Easy Server Restart by Slo_Runner");
  32.     print("--------------------------------------\n");
  33.     SendRconCommand("exec server");
  34.     return 1;
  35. }
  36. #endif
  37. forward gmx_timer();
  38. forward destroy_draw();
  39. public OnPlayerCommandText(playerid, cmdtext[])
  40. {
  41.     if (strcmp("/gmx", cmdtext, true) == 0)
  42.     {
  43.         new string[128];
  44.         if (IsPlayerAdmin(playerid)) {
  45.        
  46.         new Float: rtime = RESTART_TIME;
  47.         restart_text = TextDrawCreate(200.0, 200.0, "SERVER RESTART");
  48.         TextDrawShowForAll(restart_text);
  49.         SetTimer("destroy_draw", 10000, false);
  50.         new hostname[64];
  51.         GetServerVarAsString("hostname", hostname, sizeof(hostname));
  52.         format(string,sizeof(string),"hostname %s [RESTARTING]", hostname);
  53.         SendRconCommand(string);
  54.         format(string,sizeof(string),"[RESTART] Server is gonna restart in %.0f minutes!!", rtime);
  55.         SendClientMessageToAll(0x55000000, string);
  56.         format(string,sizeof(string),"password %s", PASS);
  57.         SendRconCommand(string);
  58.         SetTimer("gmx_timer", 1000*60*RESTART_TIME, false);
  59.         return 1;
  60.         }
  61.     }
  62.     return 0;
  63. }
  64.  
  65. public destroy_draw(){
  66. TextDrawDestroy(restart_text);
  67. }
  68.  
  69. public gmx_timer(){
  70. SendRconCommand("gmx");
  71. }
Advertisement
Add Comment
Please, Sign In to add comment