Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Restart server via RCON exit, without forcing the players to reconnect
- #include <a_samp>
- #include <zcmd>
- forward Exec();
- new PIP[MAX_PLAYERS][16];
- new RestartTimer;
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public Exec()
- {
- new cmd[64];
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- if (strlen(PIP[i]))
- {
- format(cmd,sizeof(cmd),"unbanip %s", PIP[i]);
- SendRconCommand(cmd);
- }
- }
- SendRconCommand("exit");
- }
- CMD:restart(playerid)
- {
- RestartServer();
- return 1;
- }
- stock RestartServer()
- {
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- if (IsPlayerConnected(i))
- {
- new PlayerIP[16], cmd[64];
- GetPlayerIp(i, PlayerIP, sizeof(PlayerIP));
- format(cmd,sizeof(cmd),"banip %s", PlayerIP);
- SendRconCommand(cmd);
- PIP[i] = PlayerIP;
- RestartTimer = SetTimer("Exec", 3000,0); // Server will unban the IPs in 3 seconds and then kill the server
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement