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=557181)
TextDraw Help -
Ejected - 13.01.2015
How can I make a textdraw appear after using a command?
I want the textdraw to go away after a few seconds on its own too
(Just like a short message that shows up for a few seconds then goes away)
Re: TextDraw Help -
Ejected - 13.01.2015
EXAMPLE (textdraw at bottom like this after typing a cmd):
Re: TextDraw Help -
bgedition - 13.01.2015
make it with scanff2
Re: TextDraw Help -
Ejected - 13.01.2015
How can I make it with scanff2? Sorry, I'm extremely new to scripting, can you show me a short example?
Re: TextDraw Help -
Banana_Ghost - 13.01.2015
https://sampforum.blast.hk/showthread.php?tid=376758
https://sampforum.blast.hk/showthread.php?tid=442095
These are some textdraw editors you can use to make your textdraw.
I have made something to demonstrate how you could do what you're asking. I don't know where this textdraw is located as I have made up the coordinates, but this should give you an idea:
pawn Код:
#include <a_samp>
#include <zcmd>
new Text:ExampleText;//Here You Are Using A Variable To Store The Textdraw ID.
new tdhidetimer[MAX_PLAYERS];//This is the variable holding the timer information, you will see this used later.
forward TDHide(playerid);//We Are Forwarding A Public Function, You Will See Where This Comes In Handy.
public OnGameModeInit()
{
ExampleText = TextDrawCreate(200.0,200.0,"Example Textdraw");
//This Creates The Textdraw Using The Variable And The Function.
//The Variable (ExampleText) Will Be Used Later On In The Script.
return 1;
}
public OnGameModeExit()
{
TextDrawDestroy(ExampleText);//When The Gamemode Exits, This Destroys The Textdraw.
return 1;
}
//Below Is Our Example Command.
CMD:example(playerid,params[])
{
KillTimer(tdhidetimer[playerid]);//Here We Are Killing The Timer If There Is One Running
//To prevent the timer from running over and over from command spam.
TextDrawShowForPlayer(playerid,ExampleText);//This Is What Shows The Textdraw We Created Above.
SetPlayerHealth(playerid,98.0);//This is our example function, this will refill the player's health.
tdhidetimer[playerid] = SetTimerEx("TDHide",3*1000,false,"i",playerid);
//Above Is Our Timer, Notice How We Used The Timer Variable Above To Declare What It Equals.
/*
The SetTimerEx Calls This Way:
"TDHide" - The Forwarded Function Above And The Public Below This Command.
3*1000 - Says How Long It Will Be Before The public TDHide(playerid) function is called.
false - Means the timer will only run once, if set to true, it will continute to run at the time defined above.
"i" - You are passing a playerid for the timer, so use "i".
playerid - The Player To Set The Timer For. This is what "i" is meaning. Here we're using this timer,
on the player that typed the command, so playerid is appropriate.
*/
return 1;
}
//This is the function that is called once the timer has passed the 3 seconds we defined above.
public TDHide(playerid)
{
TextDrawHideForPlayer(playerid,ExampleText);//This will then hide the textdraw, and the player should no longer see it.
}
Re: TextDraw Help -
Ejected - 13.01.2015
This command worked but the textdraw doesnt go away
I have the public, new and forward lines too
never the less, +repped
Re: TextDraw Help -
Ejected - 13.01.2015
nevermind, it worked. I forgot to add the last public at the bottom