09.10.2016, 11:26
So the problem is that this text isn't showing, you just get kicked without seeing the text.
The whole CMD code
Код:
// Let everyone know that the server is kicking all players before restarting GameTextForAll("~b~Restartan!", 5000, 3);
PHP код:
COMMAND:restart(playerid, params[])
{
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 7
if (APlayerData[playerid][PlayerLevel] >= 7)
{
// Let everyone know that the server will be restarted in 2 minutes
GameTextForAll("~b~Restart za ~w~2 minute!", 5000, 3);
SendClientMessageToAll(0xFF0000AA, "[SERVER] Restart za 2 minute!");
// Change the hostname of the server and it's password
SendRconCommand("hostname [NG] Restart u toku!");
SendRconCommand("password Apple");
// Start the next timer which warns the players again that server will be restarted in 1 minute
SetTimer("Timer_Restart_WarnPlayers", 1000 * 60, false);
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
forward Timer_Restart_WarnPlayers();
public Timer_Restart_WarnPlayers()
{
// Let everyone know that the server will be restarted in 1 minutes
GameTextForAll("~b~Restart za ~w~1 minutu!", 5000, 3);
SendClientMessageToAll(0xFF0000AA, "[SERVER] Restart za 1 minutu!");
// Start the next timer
SetTimer("Timer_Restart_Kick", 1000 * 60, false);
return 1;
}
forward Timer_Restart_Kick();
public Timer_Restart_Kick()
{
// Let everyone know that the server is kicking all players before restarting
GameTextForAll("~b~Restartan!", 5000, 3);
// Kick all players
for(new i; i < MAX_PLAYERS; i++)
Kick(i);
// Start the next timer that will restart the server
SetTimer("Timer_Restart_Reboot", 1000 * 5, false);
return 1;
}
forward Timer_Restart_Reboot();
public Timer_Restart_Reboot()
{
new HostCommand[128];
// Restart the server
SendRconCommand("gmx");
// Change the hostname and password again
format(HostCommand, 128, "hostname %s", GameModeName);
SendRconCommand(HostCommand);
SendRconCommand("password 0");
return 1;
}