How to make textdraw hide after 10 seconds? - 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: How to make textdraw hide after 10 seconds? (
/showthread.php?tid=435143)
How to make textdraw hide after 10 seconds? -
lQs - 05.05.2013
Done.
Re: How to make textdraw hide after 10 seconds? -
f0cus - 05.05.2013
Use timer
Re: How to make textdraw hide after 10 seconds? -
MattyG - 05.05.2013
Just use SetTimerEx.
Re: How to make textdraw hide after 10 seconds? -
Goldilox - 05.05.2013
Create text draw, set timer to 10 seconds, and make a forward and public of what to do when the time is up. Put destroy the text draw.
pawn Code:
// on top of your script under includes.
new Text:sample;
//on gamemode init
sample = TextDrawCreate(240.0,580.0,"Soomro");
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/time", true))
{
TextDrawShowForPlayer(playerid, sample); // show the text draw we just created above in the variable sample.
SetTimerEx("TimeUp", 10000, false, "i", playerid); // Set 10 seconds 10000 ms = 10 sec
return 1;
}
return 0;
}
forward TimeUp(playerid);
public TimeUp(playerid)
{
TextDrawDestroy(sample); //Destroy the created text draw.
return 1;
}