Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define FILTERSCRIPT
- new rTimer,
- bool:IsRestarted = false,
- timed = -1,
- timeLeft = -1;
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Restart your server without time.");
- print("--------------------------------------\n");
- rTimer = SetTimer("ServerRestart", 1000, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(rTimer);
- return 1;
- }
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- stock ConvertMintoSec(min) {
- new sec = min * 60;
- return sec;
- }
- forward ServerRestart();
- public ServerRestart() {
- if(IsRestarted == true && timeLeft > 0) {
- new RestartMesaage[128];
- timed++;
- format(RestartMesaage, 128, "[SERVER] {9cb9ce}Serverul se va restarta in %d minute. Scopul acestui restart este de a fixa cateva probleme.", timeLeft);
- if(timed == 10) SendClientMessageToAll(-1, RestartMesaage);
- if(timed == 60) SendClientMessageToAll(-1, RestartMesaage);
- if(timed == 120) SendClientMessageToAll(-1, RestartMesaage);
- if(timed == 240) SendClientMessageToAll(-1, RestartMesaage);
- if(timed == ConvertMintoSec(timeLeft) - 20) {for(new i = 0; i < MAX_PLAYERS; i++) Kick(i);}
- if(timed == ConvertMintoSec(timeLeft)) {
- SendRconCommand("gmx"); // Restart
- timed = -1;
- IsRestarted = false;
- timeLeft = -1;
- }
- printf("%d min (%d secounds)", timeLeft, ConvertMintoSec(timeLeft));
- return 1;
- }
- return 0;
- }
- CMD:restarted(playerid, params[]) {
- if(IsPlayerAdmin(playerid)) {
- IsRestarted = true;
- if(sscanf(params, "d", timeLeft)) return SendClientMessage(playerid, -1, "Usage: /restarted <TIME (minutes)>");
- new src[128], name[32];
- GetPlayerName(playerid, name, 32);
- format(src, sizeof(src), "SERVER: Adminul %s a programat un restart in %d minute", name, timeLeft);
- SendClientMessageToAll(-1, src);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement