11.07.2012, 01:40
I made this gmx command so it loops through everyone and gets their skin. When I type /gmx, it sets off a timer for 10 seconds, between the 10 seconds I only made it so it will save the skin:
Then when 10 seconds is up, this separate timer callback restarts the server:
pawn Код:
dcmd_gmx(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
new string[128];
restartgm = SetTimer("RestartGM",10000,0);
SendClientMessageToAll(COLOR_PINK,"***SERVER RESTART: (ADMIN RESTART) Server Restarting In 10 Seconds.");
format(string,128,"Admin Server Restart (/gmx Refresh)"); print(string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][LoggedIn] == 1)
{
new skinid = GetPlayerSkin(i);
dUserSetINT(PlayerName2(i)).("savedskin",skinid);
PlayerInfo[i][SavedSkin] = skinid;
}
}
return 1;
} else return SendClientMessage(playerid,red,"Invalid Command. Type /cmds For A List Of All Available Server Commands.");
}
pawn Код:
forward RestartGM();
public RestartGM()
{
SendRconCommand("gmx");
return 1;
}