SA-MP Forums Archive
Same player textdraw for multiple uses? - 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: Same player textdraw for multiple uses? (/showthread.php?tid=659202)



Same player textdraw for multiple uses? - DatGuySleepy - 27.09.2018

So I've messed around with textdraws and came across a little problem. I created a single textdraw with the intention to use that player textdraw for multiple different texts and tasks. When I click that particular textdraw it's supposed to close out other textdraws and show different ones. But when I click on it, it does a task that it's not supposed to.

Example:

A player selects the player textdraw 'category A', and a list of textdraws pop up. At the bottom of the list, the textdraw "Next Page" is created. It should go to the next page for 'category A'. Then when a player selects the 'category B' textdraw, a different list is created with the same "Next Page" textdraw at the bottom of the list.

Textdraw "Next Page", when clicked it destroys a list of textdraws and creates a new list of textdraws for category 'A'.

And that same textdraw is used again, but with a different PlayerText:Label[MAX_PLAYERS].

This different, but identical, Textdraw "Next Page", when clicked it should destroy and create a new list of textdraws for category 'B'.

The issue is that instead of creating the next set of textdraws list for category 'B', it destroys the textdraws it's supposed to but creates the textdraws that are meant for category 'A'.


My questions are,
Could the issue be that if a selectable textdraw that is the same color/sizes/etc. is created in the same location than the other identical one then when clicked it gets confused on which variant of that textdraw it is?

Another thing is, on the process of destroying and creating the new list, should I make it so it hides the textdraws then destroys them? I only made it so when it's clicked it destroys the textdraws straight away and creates the new ones.

I tried having the player textdraw text edited to "Next Page for A" and "Next Page for B", but the same issue continues. I've tried finding a solution for the last two days. Any help is appreciated, repping.


Re: Same player textdraw for multiple uses? - sakhary - 27.09.2018

When you destroy the textdraws be sure to reset their variable value to PlayerText:-1


Re: Same player textdraw for multiple uses? - DatGuySleepy - 27.09.2018

Quote:
Originally Posted by sakhary
Посмотреть сообщение
When you destroy the textdraws be sure to reset their variable value to PlayerText:-1
Words can't describe just how grateful I am of you.. Thanks so much! This fixed the issue, plus you've taught me something I wasn't aware of.