View Full Version : A question about changing Miliseconds to minutes.

02/01/2012, 08:13 PM

I have scripted my " Admin's system " jail command, and I want to use Minutes instead of Miliseconds like

instead of doing

/jail playerid 15000 hi.


/jail playerid 15 hi.

Oh and change the timers to Minutes not Miliseconds.

My script is:

YCMD:jail(playerid, params[])
if(PlayerInfo[playerid][Admin] == 1)
new JailedPlayer, string[128], thetime, reason[126];
if(sscanf(params, "uis[126]", JailedPlayer, thetime, reason)) return SCM(playerid, COLOR_GREY, "YCMD: /jail [Part of Name/Player ID] [Time] [Reason]");
PlayerInfo[JailedPlayer][Jail] = 1;
PlayerInfo[JailedPlayer][JailedTime] = thetime;
SetPlayerPos(JailedPlayer, 250.56483459473, 1868.0897216797, -30.752481460571);
SetTimerEx("JailedTimer", thetime, false,"i",JailedPlayer);
format(string, sizeof(string), "%s has jailed you for about %i, Reason: %s.", PlayerName(playerid), thetime, reason);
SCM(JailedPlayer, COLOR_YELLOW, string);
format(string, sizeof(string), "Admin: %s has jailed %s for %i.", PlayerName(playerid), PlayerName(playerid), PlayerInfo[JailedPlayer][JailedTime]);
AMessage(COLOR_LIGHTRED, string);

} else return SCM(playerid, COLOR_GREY, "You're not authorized to use this command.");
return 1;

02/01/2012, 08:21 PM
SetTimerEx("JailedTimer", thetime*60000, false,"i",JailedPlayer);

To prevent issues u should also check the time variable and return a msg invalid time value if its negative or too big etc.

02/01/2012, 08:27 PM
Thank you, I'll try to do like you posted. And, sorry but what do you mean by " check the time variable and return a message "? Where do I do that?

02/01/2012, 08:35 PM
mhh, im not sure but i think he meant to check if the time the player entered is in a range you want it to be.
As there could occur bugs if a player enters a negative time value, strings, floats or whatever.

To prevent this just do smth. like this: (this is just an example you have to adjust it to ur needs ofc.)

if(thetime<1)return SendClientMessage(playerid,0xFF0000FF,"The JailTime must be at least 1 minute!");

Hope this helps ;)

02/01/2012, 09:02 PM
O thank you BlackWolf ^^.