#1

How to make Jail ID Time? And after the time unjail?
Reply
#2

This has stumped me before as well.
The way the God Father (or every single RP script out there) does it is they set a repeating timer of 1 second and loop through all the players. Every time the timer is called, their jail time variable is lowered, and once it equals 0, they become free.
Reply
#3

Example please? +REP!
Reply
#4

pawn Код:
new InJail[MAX_PLAYERS],
    JailTime[MAX_PLAYERS];

public OnGameModeInit()
{
    SetTimer("JailTimer", 1000, true);
    return 1;
}

forward JailTimer();
public JailTimer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(InJail[i] == 1)
            {
                if(JailTime[i] > 0)
                    JailTime[i]--;
                if(JailTime[i] == 0)
                {
                    JailTime[i] = 0;
                    InJail[i] = 0;
                    SpawnPlayer(i);
                }
            }
        }
    }
    return 0;
}
Also, add this to your jail command...
pawn Код:
JailTime[playerid] = 300 // Change to amount of time you want to jail a player for, in seconds.
InJail[playerid] = 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)