SA-MP Forums Archive
Player textdraw with timer - 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: Player textdraw with timer (/showthread.php?tid=614195)



Player textdraw with timer - TheBigFive - 05.08.2016

Hello again, ehm please don't kill me because I have asked a few questions lately.

I'm having some trouble with my textdraw which is supposed to show up if someone writes an invalid command for instance, then dissapear after like 5 seconds. I tried to do that, and the textdraw shows up but it never appears.

I also have some general questions regarding textdraws. Do I always need to place textdraws OnPlayerConnect? Meaning I can't have them in an include and store them somewhere else, becasue you know textdraws takes up so much space so I'd like to hide all my textdraws a little. Could of course make an include for OnPlayerConnect or whatever, but don't really know how that works out. My current code:

To make it easier to read through I uploaded it to pastebin:
http://pastebin.com/dszZKum5

It is probably shit, therefore I need suggestions how to improve and make it work.


Re: Player textdraw with timer - JustMe.77 - 05.08.2016

Put a few prints and see if the functions are executed.
You could put your Textdraw Code in a stock/function which is located in an include, then include the Include into your main script and put into On playeR connect just one single line of code to load the stock/function.


Re: Player textdraw with timer - AndySedeyn - 05.08.2016

It never appears because you aren't showing it to the player in the first place. Or are you deliberately not putting code in the pastebin? I'm thinking OnPlayerCommandPerformed being a key function in this.


Re: Player textdraw with timer - SickAttack - 05.08.2016

Move the timer to the function, don't put it in OnPlayerConnect.

Kill the timer when the function is used again.

Player TextDraws go in OnPlayerConnect. Global TDs go in OnGameModeInIt.


Re: Player textdraw with timer - TheBigFive - 05.08.2016

It does appear, the problem is that it doesn't dissapear Andy.
"It never appears because you aren't showing it to the player in the first place". I'm?
@Sick will try.

Confused.


Re: Player textdraw with timer - AndySedeyn - 05.08.2016

Quote:
Originally Posted by TheBigFive
Посмотреть сообщение
I tried to do that, and the textdraw shows up but it never appears.
Quote:
Originally Posted by TheBigFive
Посмотреть сообщение
It does appear, the problem is that it doesn't dissapear Andy.
"It never appears because you aren't showing it to the player in the first place". I'm?
I skimmed over the text and saw "it never appears" and not "The textdraw shows up" (see your quote). Sorry.
The timer after creating the textdraw is pretty useless since you're not showing the textdraw at that point. Instead, put the timer in your ServerMSG function as SickAttack said.