02.12.2018, 20:31
(
Последний раз редактировалось Mo123; 02.12.2018 в 21:49.
)
Quote:
Try with this:
Код:
new AccTimer; // Defines the timer forward SaveAccounts(); public SaveAccounts() { for(new i = 0; i < MAX_PLAYERS; i++) { new INI:File = INI_Open(UserPath(i)); INI_SetTag(File,"data"); INI_WriteInt(File,"Admin Level", PlayerInfo[i][pAdmin]); INI_WriteInt(File,"Faction Director", PlayerInfo[i][pFacDirector]); INI_WriteInt(File,"Faction", PlayerInfo[i][pFaction]); INI_WriteInt(File,"Faction Rank", PlayerInfo[i][pFacRanks]); INI_Close(File); } return 1; } Put under OnGameModeInit: AccTimer = SetTimer("SaveAccounts", 60000 *5, true); // Saves all accounts every 5 minutes Put under OnGameModeExit: KillTimer(AccTimer); Under OnPlayerDisconnect: SaveAccounts(); For safe /gmx command: new RestartTime = 10; CMD:gmx(playerid) { if(PlayerInfo[playerid][pAdmin] < 3) { SendClientMessage(playerid, -1, "You are not authorized to use that command!"); } else if(PlayerInfo[playerid][pAdmin] >= 3) { SaveAccounts(); SetTimer("ServerRestartTime",10000 ,false); } return 1; } forward ServerRestartTime(playerid); public ServerRestartTime(playerid) { RestartTime--; if(RestartTime == 0) { RestartTime = 10; SendRconCommand("gmx"); return 1; } return 1; } |
Edit: I already made a gmx with a timer.