16.08.2011, 08:24
Heey guys,
I made a capture system just 2 captures for test but sometimes you still show the progres bar and the timer then repeats.
Here is code:
timer:
How can i fix this?
I made a capture system just 2 captures for test but sometimes you still show the progres bar and the timer then repeats.
Here is code:
Код:
public OnCheckpointEnter(playerid, checkpointid) { if(checkpoint1 && gTeam[playerid]==TEAM_EUROPE && europecapture == 0) { europetaken=1; capture1=1; ShowProgressBarForPlayer(playerid,capture); areatimer=SetTimer("count1",1000,1); } if(checkpoint1 && gTeam[playerid]==TEAM_EUROPE && europecapture ==1) { SendClientMessage(playerid,red,"Your team already has Area51!"); } if(checkpoint1 && gTeam[playerid]==TEAM_USA && usacapture ==0) { usataken=1; capture1=1; ShowProgressBarForPlayer(playerid,capture); areatimer=SetTimer("count1",1000,1); } if(checkpoint1 && gTeam[playerid]==TEAM_USA && usacapture ==1) { SendClientMessage(playerid,red,"Your team already has Area51!"); } return 1; }
Код:
forward count1(playerid); public count1(playerid) { //new string[56]; counter++; SetProgressBarValue(capture, counter); SetProgressBarMaxValue(capture, 20); UpdateProgressBar(capture, playerid); //format(string, sizeof(string),"~r~Wait %d seconds to capture Area51!!",counter); //GameTextForAll(string,1000,5); if(counter==20) { if(europetaken==1 && capture1==1) { GangZoneShowForAll( area, GZ_YELLOW); SetPlayerScore(playerid,GetPlayerScore(playerid)+4); GiveTeamScore(gTeam[playerid]=TEAM_EUROPE, 1); europecapture=1; capturedzones[playerid]++; KillTimer(areatimer); } if(usataken==1 && capture1==1) { GangZoneShowForAll( area, GZ_LIGHTBLUE); SetPlayerScore(playerid,GetPlayerScore(playerid)+4); GiveTeamScore(gTeam[playerid]=TEAM_EUROPE, 1); usacapture=1; capturedzones[playerid]++; KillTimer(areatimer); } counter=20; HideProgressBarForPlayer(playerid, capture); }