Timer is not smooth and dont stop. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer is not smooth and dont stop. (
/showthread.php?tid=278213)
Timer is not smooth and dont stop. -
Admigo - 21.08.2011
Heey guys,
I made 20 seconds timer for capture zones. But the timer is not smooth and dont stop. Here is code:
onplayerpickup
Code:
if(pickupid==areap)
{
if(gTeam[playerid]==TEAM_EUROPE)
{
if(Team_Europe_Area==0)
{
capturezone=SetTimer("capturezones",1000,1);
Team_Europe_Takes=1;
}
if(Team_Europe_Area==1)
{
SendClientMessage(playerid,COLOR_WHITE,"This Zone Is Already From Your Team!");
}
}
if(gTeam[playerid]==TEAM_USA)
{
if(Team_Usa_Area==0)
{
capturezone=SetTimer("capturezones",1000,1);
Team_Usa_Takes=1;
}
if(Team_Usa_Area==1)
{
SendClientMessage(playerid,COLOR_WHITE,"This Zone Is Already From Your Team!");
}
}
return 1;
}
The timer:
Code:
forward capturezones();
public capturezones()
{
counter--;
new string[80];
for(new i=0; i<MAX_PLAYERS; i++)
{
format(string,sizeof(string),"Stay %d Seconds In Checkpoint For Capture!",counter);
GameTextForPlayer(i, string, 1000, 5);
}
if(counter== 0)
{
if(Team_Europe_Area == 0 && Team_Europe_Takes==1)
{
GangZoneShowForAll(area,GZ_YELLOW);
Team_Europe_Area = 1;
Team_Europe_Takes=0;
counter=20;
KillTimer(capturezone);
}
if(Team_Usa_Area == 0 && Team_Usa_Takes==1)
{
GangZoneShowForAll(area,GZ_BLUE);
Team_Usa_Area = 1;
Team_Usa_Takes=0;
counter=20;
KillTimer(capturezone);
}
KillTimer(capturezone);
}
}
Can anyone fix this pls?
Thanks Admigo