Function Bug - 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)
+--- Thread: Function Bug (
/showthread.php?tid=575977)
Function Bug -
Rodri99 - 31.05.2015
forward countdownforddo(playerid);
public countdownforddo(playerid)
{
if(CountDown==71) GameTextForPlayer(playerid,"~y~Starting...",1000,1 );
CountDown--;
if(CountDown==0)
{
GameTextForPlayer(playerid,"~r~YOU LOSE!",1000,1);
CountDown = -1;
return 0;
}
else
{
new text[7]; format(text,sizeof(text),"~g~%d",CountDown);
GameTextForPlayer(playerid,text,1000,1);
}
SetTimer("countdownforddo",1000,0);
return 0;
}
How can i script a function to erase this gamemodetext count?
Thanks to all replies,
Rodri.
Rodri99 is online now Add to Rodri99's Reputation Report Post
Re: Function Bug -
Yashas - 31.05.2015
Use [+code+] [/code] to add code in your thread (Remove the + from the tag)
Код:
forward countdownforddo(playerid);
public countdownforddo(playerid)
{
if(CountDown==71) GameTextForPlayer(playerid,"~y~Starting...",1000,1 );
CountDown--;
if(CountDown==0)
{
GameTextForPlayer(playerid,"~r~YOU LOSE!",1000,1);
CountDown = -1;
return 0;
}
else
{
new text[7]; format(text,sizeof(text),"~g~%d",CountDown);
GameTextForPlayer(playerid,text,1000,1);
}
SetTimer("countdownforddo",1000,0);
return 0;
}
I am guessing that you want to stop the countdown.
Instead of creating a timer every one second, create one timer for the whole process.
Код:
timerid = SetTimer("countdownforddo",1000,true);
Make a global variable timerid and start the timer using the code given above when you want to start.
Then use KillTimer(timerid); to stop the countdown