Countdown Textdraw issues :(
#1

hi samp'ers,

i just got a problem i cant get rid of for a long time
There is a checkpoint on the map visible for all players.

As soon as someone enters the cp there appears a textdraws counting from 20 secods down to 0.
When this player exits the cp again, the textdraw shall disapear and start from 20 seconds again if he enters again.
But righ now its kinda fucked up
If there are more than 1 player on the server it starts to count faster if 2 player enter the cp at the same time.
Also it starts to count after a player leaves the cp.
I cant explain this problem very well but i give u the code and i hope that some scripters are able to see the error.

pawn Код:
//At the top of the script

forward counterzone(playerid);
new countdownzone = 20;
new CDONZone[MAX_PLAYERS];


//as soon as a player enters the cp

CDONZone[playerid] = SetTimerEx("counterzone",990,false,"i",playerid);


//the timer

public counterzone(playerid)
{
for(new i; i < MAX_PLAYERS; i ++)
{
if(HasEntered[playerid] == 1 && countdownzone > 0)
{
TextDrawShowForPlayer(playerid,MiniCountdown);//this is the countdown textdraw
}
}
new textformat[85];
format(textformat,sizeof textformat,"~g~%d",countdownzone);
TextDrawSetString(MiniCountdown,textformat);
CDONZone[playerid] = SetTimer("counterzone",990,false);
countdownzone --;

return 1;
}


//OnPlayerLeaveCheckpoint

KillTimer(CDONZone[playerid]);
countdownzone = 20;
TextDrawHideForPlayer(playerid,MiniCountdown);


//when the countdown reaches zero

KillTimer(CDONZone[playerid]);
countdownzone = 20;
TextDrawHideForPlayer(playerid,MiniCountdown);
It works good as soon as there is only one player on the server but as soon as this circumstance changes its everything kinda buged

regards...
Reply


Messages In This Thread
Countdown Textdraw issues :( - by BlackWolf120 - 27.02.2011, 18:37
Re: Countdown Textdraw issues :( - by BlackWolf120 - 28.02.2011, 13:29
Re: Countdown Textdraw issues :( - by BMUK - 28.02.2011, 14:01
Re: Countdown Textdraw issues :( - by BlackWolf120 - 04.03.2011, 14:44

Forum Jump:


Users browsing this thread: 5 Guest(s)