Oh, there are several ID's. Then it is like this:
At Top:
pawn Код:
new CaptureTimer[MAX_ZONES][MAX_PLAYERS];
Where you start the timer:
pawn Код:
CaptureTimer[id][playerid] = SetTimerEx("CaptureZoneAgain",300000,false,"dd",playerid,id);
At OnPlayerConnect:
pawn Код:
for(new id=0; id<MAX_ZONES; id++) CaptureTimer[id][playerid] = -1;
And at OnPlayerDisconnect:
pawn Код:
for(new id=0; id<MAX_ZONES; id++) if(CaptureTimer[id][playerid] != -1) KillTimer(CaptureTimer[id][playerid]);
And this is 'CaptureZoneAgain':
pawn Код:
forward CaptureZoneAgain(playerid,id);
public CaptureZoneAgain(playerid,id)
{
if(LastCapturedZone[id][playerid] == 1)
{
LastCapturedZone[id][playerid] = 0;
CaptureTimer[id][playerid] = -1;
}
}
Now it should work for playerids and Zone ID's.
(Change MAX_ZONES to the number of zones you have, or define it like:
#define MAX_ZONES 10 if you have 10 Zones.)
I hope it works. If you have questions, feel free to ask.
Quote:
Originally Posted by Mike_Peterson
Jeffry what does the OnPlayerConnect -1 does? xD -1 on some things is all worlds :P
|
Here it will just set the variable to -1, as no timer ID has -1. So if the variable is NOT -1, we kill the timer.