SA-MP Forums Archive
Seconds to minutes on -- - 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: Seconds to minutes on -- (/showthread.php?tid=355316)



Seconds to minutes on -- - PaulDinam - 29.06.2012

how to make this down no so fast

if(PlayerInfo[i][pJailed] > 0)
{
if(PlayerInfo[i][pJailTime] > 0)
{
PlayerInfo[i][pJailTime]--;
}

because the time of the jail goes down fast.
i want it will be like minutes


Re: Seconds to minutes on -- - PaulDinam - 29.06.2012

help!


Re: Seconds to minutes on -- - nickdodd25 - 29.06.2012

Well to make it count down in minutes you need a timer,

pawn Код:
//put this under public OnGameModeInit()
SetTimer("JailTimer",60000,true);
//this would be your timer to call the jailtimer function every minute
//then put this anywhere under a_samp outside of a callback
forward JailTimer();
public JailTimer()
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pJailed] > 0)
        {
            if(PlayerInfo[i][pJailTime] > 0)
            {
                PlayerInfo[i][pJailTime]--;
            }
        }
    }
    return 1;
}
//that would loop through every player and decrease thier jail time by 1.
You would have to do something like that. Then you could add in the code so once the players time is 0 and the pJailed is greater than 0 (wich means they are jailed but time is up) it would release the player.