Saving Timer? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Saving Timer? (
/showthread.php?tid=474757)
Saving Timer? -
Chrillzen - 09.11.2013
Hey guys. I need a saving timer for my arrest command. So far I have fixed that whenever the player disconnects while in jail he will be sent there when logging in. But I need to set the timer to how much it was when he disconnected.
This is what I got now:
OnArrest,
pawn Код:
SetPlayerPos(playerid, 1492.2151,-1768.2281,3285.2859);
SetTimerEx("UnJail", 60000*time, false, "i", criminal);
PlayerInfo[criminal][pInJail] = 1;
UnJail
pawn Код:
public UnJail(playerid)
{
SetPlayerPos(playerid, 1555.5061,-1675.7239,16.1953);
SCM(playerid, COLOR_LSPD, "* You have been released from prison. Try to be a better citizen in the future.");
}
OnPlayerSpawn
pawn Код:
if(PlayerInfo[playerid][pInJail] == 1)
{
SetPlayerPos(playerid, 1492.2151,-1768.2281,3285.2859);
format(string, sizeof(string), "* Your character is currently is jail for another %d seconds.", jailtimer??);
SCM(playerid, COLOR_LIGHTRED, string);
}
Re: Saving Timer? -
David (Sabljak) - 09.11.2013
you can do this
add this to arrest
PlayerInfo[criminal][pInJailTime] = time*60000;
on unjail PlayerInfo[playerid][pInJailTime] = 0;
on timer who is reducing just put PlayerInfo[playerid][pInJailTime] = --;
and on checking
format(string, sizeof(string), "* Your character is currently is jail for another %d seconds.", PlayerInfo[playerid][pInJailTime]);
got it?
Re: Saving Timer? -
Chrillzen - 09.11.2013
How do I make pInJailTime reduce every second?