19.01.2014, 14:08
That is only the saving part
The loading part shouldn't be to compilcated
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;