SHOW:
|
|
- or go back to the newest paste.
1 | #include <a_samp> | |
2 | #include <zcmd> | |
3 | #include <sscanf2> | |
4 | #define FILTERSCRIPT | |
5 | ||
6 | new rTimer, | |
7 | bool:IsRestarted = false, | |
8 | timed = -1, | |
9 | timeLeft = -1; | |
10 | ||
11 | public OnFilterScriptInit() | |
12 | { | |
13 | print("\n--------------------------------------"); | |
14 | print(" Restart your server without time."); | |
15 | print("--------------------------------------\n"); | |
16 | ||
17 | rTimer = SetTimer("ServerRestart", 1000, true); | |
18 | return 1; | |
19 | } | |
20 | ||
21 | public OnFilterScriptExit() | |
22 | { | |
23 | KillTimer(rTimer); | |
24 | return 1; | |
25 | } | |
26 | ||
27 | main() | |
28 | { | |
29 | print("\n----------------------------------"); | |
30 | print(" Blank Gamemode by your name here"); | |
31 | print("----------------------------------\n"); | |
32 | } | |
33 | ||
34 | stock ConvertMintoSec(min) { | |
35 | new sec = min * 60; | |
36 | return sec; | |
37 | } | |
38 | ||
39 | - | new left = timeLeft * (60 * 1000); |
39 | + | |
40 | public ServerRestart() { | |
41 | if(IsRestarted == true && timeLeft > 0) { | |
42 | new RestartMesaage[128]; | |
43 | timed++; | |
44 | ||
45 | - | if(timed == (left - 20)) {for(new i = 0; i < MAX_PLAYERS; i++) Kick(i);} |
45 | + | |
46 | - | if(timed == left) { |
46 | + | |
47 | if(timed == 60) SendClientMessageToAll(-1, RestartMesaage); | |
48 | if(timed == 120) SendClientMessageToAll(-1, RestartMesaage); | |
49 | if(timed == 240) SendClientMessageToAll(-1, RestartMesaage); | |
50 | if(timed == ConvertMintoSec(timeLeft) - 20) {for(new i = 0; i < MAX_PLAYERS; i++) Kick(i);} | |
51 | if(timed == ConvertMintoSec(timeLeft)) { | |
52 | - | printf("%d min (%d secounds)", timeLeft, timed); |
52 | + | |
53 | timed = -1; | |
54 | IsRestarted = false; | |
55 | timeLeft = -1; | |
56 | } | |
57 | printf("%d min (%d secounds)", timeLeft, ConvertMintoSec(timeLeft)); | |
58 | return 1; | |
59 | } | |
60 | return 0; | |
61 | } | |
62 | ||
63 | CMD:restarted(playerid, params[]) { | |
64 | if(IsPlayerAdmin(playerid)) { | |
65 | IsRestarted = true; | |
66 | if(sscanf(params, "d", timeLeft)) return SendClientMessage(playerid, -1, "Usage: /restarted <TIME (minutes)>"); | |
67 | new src[128], name[32]; | |
68 | GetPlayerName(playerid, name, 32); | |
69 | format(src, sizeof(src), "SERVER: Adminul %s a programat un restart in %d minute", name, timeLeft); | |
70 | SendClientMessageToAll(-1, src); | |
71 | } | |
72 | return 1; | |
73 | } |