06.02.2011, 01:50
hi,
as soon as a player enters a checkpoint there appears a textdraw counting from 20 down to 0.
The action (that i want to be executed ) takes place 20 after the player has enteres the cp.
But the problem is that if there is more than 1 player online the countdown is bugged!
It counts like 20, 16, 7, 3. Totaly wrong, i dont know whats wrong with this code.
Maybe you can help me.
as soon as a player enters a checkpoint there appears a textdraw counting from 20 down to 0.
The action (that i want to be executed ) takes place 20 after the player has enteres the cp.
But the problem is that if there is more than 1 player online the countdown is bugged!
It counts like 20, 16, 7, 3. Totaly wrong, i dont know whats wrong with this code.
Maybe you can help me.
pawn Код:
new HasEntered[MAX_PLAYERS];
//OnPlayerEnterCheckpoint
SetTimerEx("Bombspawnpolice",20000,false,"i",playerid);
CDONZone = SetTimerEx("counterzone",990,false,"i",playerid);
HasEntered[playerid] = 1;
//this is my countdown function
public counterzone(playerid)
{
for(new i; i < MAX_PLAYERS; i ++)
{
if(HasEntered[i] == 1 && countdownzone > 0)
{
CDONZone = SetTimer("counterzone",990,false);
new textformat[85];
format(textformat,sizeof textformat,"~g~%d",countdownzone);
TextDrawSetString(MiniCountdown,textformat);
TextDrawShowForPlayer(i,MiniCountdown);
countdownzone --;
}
}
return 1;
}
//BombSpawnPoliceTimer
countdownzone = 20;
KillTimer(CDONZone);
TextDrawHideForPlayer(playerid,MiniCountdown);
HasEntered[playerid] = 0;