Timer countdown with textdraws - 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: Timer countdown with textdraws (
/showthread.php?tid=573285)
Timer countdown with textdraws -
Zloto - 06.05.2015
I have a timer -
http://i.imgur.com/4NKcsN2.jpg But i want to make it dynamic to countdown. Now it only shows and then disapears.
Код:
stock CountDown(playerid, time)
{
CountDownTime[playerid] = time;
CTimer[playerid] = SetTimerEx("CountDownTimer", 1000, false, "i", playerid);
return 0;
}
forward CountDownTimer(playerid);
public CountDownTimer(playerid)
{
if(CountDownTime[playerid] > 1)
{
new timer[28];
format(timer, sizeof(timer), "%i Seconds", CountDownTime[playerid]);
GameTextForPlayer(playerid, timer, 1000, 0);
CountDownTime[playerid] -= 1;
return 1;
}
else
{
GameTextForPlayer(playerid, "GOOOOO!!!!", 1000, 0);
KillTimer(CTimer[playerid]);
}
return 1;
}
This is the code. And if you can help me to set it up on the top of the screen it will be very nice.
Re: Timer countdown with textdraws -
Konstantinos - 06.05.2015
PHP код:
stock CountDown(playerid, time)
{
CountDownTime[playerid] = time;
CTimer[playerid] = SetTimerEx("CountDownTimer", 1000, true, "i", playerid);
return 0;
}
forward CountDownTimer(playerid);
public CountDownTimer(playerid)
{
new timer[28];
format(timer, sizeof(timer), "%i Seconds", CountDownTime[playerid]);
GameTextForPlayer(playerid, timer, 1000, 3);
if(!(--CountDownTime[playerid]))
{
GameTextForPlayer(playerid, "~g~GOOOOO!!!!", 1000, 3);
KillTimer(CTimer[playerid]);
CTimer[playerid] = -1;
}
return 1;
}
Re: Timer countdown with textdraws -
036 - 06.05.2015
Just use gametext, its easier.
Re: Timer countdown with textdraws -
Zloto - 06.05.2015
Quote:
Originally Posted by Konstantinos
PHP код:
stock CountDown(playerid, time)
{
CountDownTime[playerid] = time;
CTimer[playerid] = SetTimerEx("CountDownTimer", 1000, true, "i", playerid);
return 0;
}
forward CountDownTimer(playerid);
public CountDownTimer(playerid)
{
new timer[28];
format(timer, sizeof(timer), "%i Seconds", CountDownTime[playerid]);
GameTextForPlayer(playerid, timer, 1000, 3);
if(!(--CountDownTime[playerid]))
{
GameTextForPlayer(playerid, "~g~GOOOOO!!!!", 1000, 3);
KillTimer(CTimer[playerid]);
CTimer[playerid] = -1;
}
return 1;
}
|
This man here is a BEAST! He helps a lot he deserves +1312 rep... Thanks again!