Originally Posted by biltong
Do you want it in minutes or seconds, because timers use milliseconds. If you want seconds, multiply the input by 1000, if you want minutes, multiply by 60000. Remember to use strval for params.
|
Originally Posted by Joe Torran C
I dont use strval cause i cant the way im doing it but it sitll works the same,
Anyway thats not working - btw i using sscanf |
Originally Posted by biltong
Quote:
new time; if(sscanf(params, "i", time)) return SendClientMessage(playerid, 0xFFFFFFFF, "You didn't specify a time!"); else SetTimerEx("bla", time, 0, "i", playerid); If that doesn't work, I don't know what will. |
CMD:jail(playerid, params[])
{
new id, time, reason[128];
new string[128];
if(!(BaseInfo[playerid][AdminLevel] > 1)) return SendClientMessage(playerid, COLOR_RED, "You are not an administrator with the required level");
if(sscanf(params, "uiz", id, time, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /jail [PlayerID/PartOfName] [Time] [Reason]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player not Found");
if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "Cannot jail Yourself");
if(BaseInfo[id][AdminLevel] > 4) return SendClientMessage(playerid, COLOR_RED, "Cannot jail the Highest Level Admin");
if(!reason[0]) {
format(string, sizeof string, "Administrator %s has jailed %s for %i miliseconds", GetPlayersName(playerid), GetPlayersName(id), time);
SendClientMessageToAll(COLOR_BLUE, string);
SetTimerEx("Unjail", time, 0, "i", playerid);
JailPlayer(id);
return BaseInfo[id][Jailed] = 1;
}
format(string, sizeof string, "Administrator %s has jailed %s for %i miliseconds with reason: %s", GetPlayersName(playerid), GetPlayersName(id), time, reason);
SendClientMessageToAll(COLOR_BLUE, string);
SetTimerEx("Unjail", time, 0, "i", playerid);
BaseInfo[id][Jailed] = 1;
JailPlayer(id);
return 1;
}