26.08.2011, 17:34
You can use SSCANF then try this:
Код:
COMMAND:restart(playerid, params[]) { new time,string[128]; if(!sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "Usage: /restart [time]"); // Send the command to all admins so they can see it SendAdminText(playerid, "/restart", params); // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Check if the player's admin-level is at least 5 if (APlayerData[playerid][PlayerLevel] >= 5) { // Let everyone know that the server will be restarted in 2 minutes format(string,sizeof(string),"Server restart in %i minutes!",time); GameTextForAll(string, 5000, 3); SendClientMessageToAll(0xA0A0A0, "Server restart in 2 minutes!"); // Start the next timer which warns the players again that server will be restarted in 1 minute SetTimer("Timer_Restart_WarnPlayers", time, false); } else return 0; } else return 0; // Let the server know that this was a valid command return 1; }