Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <izcmd>
- #include <sscanf2>
- new Timer_Restart;
- new Counter_Restart;
- new bool:IsRestartStarted;
- new Text:TD_Title;
- new Text:TD_Reason;
- new Text:TD_Countdown;
- public OnFilterScriptInit()
- {
- TD_Title = TextDrawCreate(264.000000, 367.000000, "Server restart");
- TextDrawAlignment(TD_Title, 0);
- TextDrawBackgroundColor(TD_Title, 0x000000ff);
- TextDrawFont(TD_Title, 1);
- TextDrawLetterSize(TD_Title, 0.399999, 1.300000);
- TextDrawColor(TD_Title, 0xFF0000FF);
- TextDrawSetOutline(TD_Title, 1);
- TextDrawSetProportional(TD_Title, 1);
- TextDrawSetShadow(TD_Title, 1);
- TD_Reason = TextDrawCreate(264.000000, 377.000000, "Reason:");
- TextDrawAlignment(TD_Reason, 0);
- TextDrawBackgroundColor(TD_Reason, 0x000000ff);
- TextDrawFont(TD_Reason, 1);
- TextDrawLetterSize(TD_Reason, 0.399999, 1.300000);
- TextDrawColor(TD_Reason, 0xffffffff);
- TextDrawSetOutline(TD_Reason, 1);
- TextDrawSetProportional(TD_Reason, 1);
- TextDrawSetShadow(TD_Reason, 1);
- TD_Countdown = TextDrawCreate(264.000000, 387.000000, "Countdown:");
- TextDrawAlignment(TD_Countdown, 0);
- TextDrawBackgroundColor(TD_Countdown, 0x000000ff);
- TextDrawFont(TD_Countdown, 1);
- TextDrawLetterSize(TD_Countdown, 0.399999, 1.300000);
- TextDrawColor(TD_Countdown, 0xffffffff);
- TextDrawSetOutline(TD_Countdown, 1);
- TextDrawSetProportional(TD_Countdown, 1);
- TextDrawSetShadow(TD_Countdown, 1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(TD_Title);
- TextDrawDestroy(TD_Countdown);
- TextDrawDestroy(TD_Reason);
- return 1;
- }
- public OnPlayerCommandReceived(playerid,cmdtext[])
- {
- return 1;
- }
- public OnPlayerCommandPerformed(playerid,cmdtext[], success)
- {
- if(!success) return SendClientMessage(playerid, -1, "That command doesn't exist. Type /commands for the list of all commands.");
- return success;
- }
- COMMAND:rr(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))
- return 0;
- new timer, reason;
- if(sscanf(params, "is[128]", timer, reason)) return SendClientMessage(playerid, -1, "[USAGE] /rr [Time] [Reason]");
- if(IsRestartStarted) return SendClientMessage(playerid, -1, "Countdown has been started already.");
- new string[256];
- format(string, sizeof(string), "Reason: %s", reason);
- TextDrawSetString(TD_Reason, string);
- format(string, sizeof(string), "Countdown: %d", timer);
- TextDrawSetString(TD_Countdown, string);
- TextDrawShowForAll(TD_Title);
- TextDrawShowForAll(TD_Reason);
- TextDrawShowForAll(TD_Countdown);
- Counter_Restart = timer;
- Timer_Restart = SetTimer("OnTimerUpdate", 1000, true);
- IsRestartStarted = true;
- return 1;
- }
- forward OnTimerUpdate();
- public OnTimerUpdate()
- {
- new string[64];
- format(string, sizeof(string), "Countdown: %d", Counter_Restart);
- TextDrawSetString(TD_Countdown, string);
- switch(Counter_Restart)
- {
- case 10:
- {
- SendClientMessageToAll(-1, "Kicking players");
- }
- case 0:
- {
- KillTimer(Timer_Restart);
- IsRestartStarted = false;
- }
- }
- Counter_Restart--;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement