Textdraw help! - 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: Textdraw help! (
/showthread.php?tid=430246)
Textdraw help! -
Gamer_007 - 13.04.2013
Guys,a little help I need.How to create a Textdraw which counts my time of Checkpoint hunt and when the Checkpoint re-spawns the timer again goes to the 10,i.e., How I show time to player that how much time is left to respawn the CP.
Re: Textdraw help! -
Shoulen - 13.04.2013
You could make a timer run in 1 second intervals and change a countdown variable each time and then restart the variables on the limit? If I understand you correctly...
https://sampwiki.blast.hk/wiki/SetTimer
Re: Textdraw help! -
Gamer_007 - 13.04.2013
Nah,you wont understood me.I want to say that "I have a Checkpoint Hunt system.It spawns at different location i have in script.It uses timer to respawn.I want to show
That Timer as Textdraw
Re: Textdraw help! -
Gamer_007 - 14.04.2013
B U M P ! ! !
Re: Textdraw help! -
Henix - 14.04.2013
hmm
https://sampwiki.blast.hk/wiki/TextDrawSetString
and
https://sampwiki.blast.hk/wiki/Control_Structures#Loops
pawn Код:
new Text:CooldownText;
public OnGameModeInit()
{
CooldownText = TextDrawCreate(320.0, 240.0, "Colldown");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cd", cmdtext, true, 10) == 0)
{
TextDrawShowForPlayer(playerid, CooldownText);
new a = 20;
while ( a > -1)
{
new newtext[128];
wait(1);
format(newtext, sizeof(newtext), "%d, sec", a);
TextDrawSetString(CooldownText, newtext );
a--;
}
return 1;
}
return 0;
}
wait(seconds)
{
new _newTime[4], _oldTime[4];
gettime(_oldTime[0], _oldTime[1], _oldTime[2]);
_oldTime[3] = _oldTime[2] + (_oldTime[1] * 60) + (_oldTime[0] * 600);
while(_newTime[3] != (_oldTime[3] + seconds))
{
gettime(_newTime[0], _newTime[1], _newTime[2]);
_newTime[3] = _newTime[2] + (_newTime[1] * 60) + (_newTime[0] * 600);
}
}