Saving Timer?
#1

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);
    }
Reply
#2

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?
Reply
#3

How do I make pInJailTime reduce every second?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)