[Help] Saving a timer
#4

That is only the saving part
pawn Код:
// global
new
    gJailTimer[MAX_PLAYERS],
    gJailFinishTime[MAX_PLAYERS]
;
pawn Код:
// When you jail someone - pseudo code
    new
        jailedid, // the id of the person who should get jailed
        time // the time he should be jailed in seconds
    ;
    gJailTimer[jailedid] = SetTimerEx("JailTimer", time * 1000, false, "i", jailedid);
    gJailFinishTime[joiledid] = gettime() + time;
pawn Код:
// OnPlayerDisconnect
    if(gJailFinishTime[playerid]) {
        KillTimer(gJailTimer[playerid]);

        new
            remainingtime = gJailFinishTime[playerid] - gettime()
        ;
        // save the time
        gJailFinishTime[playerid] = 0;
    }
pawn Код:
// In JailTimer - the public which gets called by the timer
    gJailFinishTime[playerid] = 0;
The loading part shouldn't be to compilcated
Reply


Messages In This Thread
[Help] Saving a timer - by BornHuman - 19.01.2014, 13:17
AW: [Help] Saving a timer - by Nero_3D - 19.01.2014, 13:27
Re: AW: [Help] Saving a timer - by BornHuman - 19.01.2014, 13:36
AW: [Help] Saving a timer - by Nero_3D - 19.01.2014, 14:08

Forum Jump:


Users browsing this thread: 1 Guest(s)