countdown texdraw only for 1 player? - 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: countdown texdraw only for 1 player? (
/showthread.php?tid=203760)
countdown texdraw only for 1 player? -
BlackWolf120 - 27.12.2010
hi,
as soon as u enter a checkpoint a texdraw appears that counts backwards from 15 to 0.
but this only happens for 1 player.
If another player enters the cp he doesnt see the textdraw.
I dont know why.
I also have to say that only a player that enters the cp shall see the countdown.
pawn Код:
new countdownzone = 15;
new Text:MiniCountdown;
forward counterzone(playerid);
MiniCountdown = TextDrawCreate(3.000000, 412.000000, "15");
TextDrawBackgroundColor(MiniCountdown, 255);
TextDrawFont(MiniCountdown, 3);
TextDrawLetterSize(MiniCountdown, 0.939999, 3.900000);
TextDrawColor(MiniCountdown, -1);
TextDrawSetOutline(MiniCountdown, 1);
TextDrawSetProportional(MiniCountdown, 1);
TextDrawUseBox(MiniCountdown, 0);
TextDrawBoxColor(MiniCountdown, 1684300900);
TextDrawTextSize(MiniCountdown, 41.000000, 0.000000);
public counterzone(playerid)
{
if(countdownzone > 0)
{
CDONZone = SetTimer("counterzone",990,false); //as soon as the player leaves the cp it kills the timer
new textformat[85];
format(textformat,sizeof textformat,"~g~%d",countdownzone);
TextDrawSetString(MiniCountdown,textformat);
TextDrawShowForPlayer(playerid,MiniCountdown);
countdownzone --;
}
return 1;
}
Re: countdown texdraw only for 1 player? -
titanak - 27.12.2010
pawn Код:
new HasEntered[MAX_PLAYERS]; // Top Of GameMode
pawn Код:
//OnPlayerEnterCheckpoint Function
HasEntered[playerid] = 1;
pawn Код:
public counterzone(playerid)
{
for(new i; i < MAX_PLAYERS; i ++)
{
if(HasEntered[i] == 1 && countdownzone > 0) {
CDONZone = SetTimer("counterzone",990,false); //as soon as the player leaves the cp it kills the timer
new textformat[85];
format(textformat,sizeof textformat,"~g~%d",countdownzone);
TextDrawSetString(MiniCountdown,textformat);
TextDrawShowForPlayer(i,MiniCountdown);
countdownzone --;
}
}
return 1; }
pawn Код:
HasEntered[playerid] = 0; // When Countdown Ends..
Something Like That...