OnPlayerClickTextDraw Array Issues
#1

Here's the Issue:
I have an Array and the Textdraw Variables are saved in it.
pawn Код:
new Text:VariableHere[14];
Now when I get a player to click on the Textdraw and go to OnPlayerClickTextdraw
it doesn't do anything at all.

And on that note, after doing hours of searching, No for the love of god, I didn't leave out TextDrawTextSize
and Yes, SelectTextDraw is in there.
pawn Код:
HUDSideBar[9] = TextDrawCreate(624.799987, 252.373291, "hud:radar_tshirt");
    TextDrawLetterSize(HUDSideBar[9], 0.000000, 0.000000);
    TextDrawTextSize(HUDSideBar[9], 12.400017, 12.444452);
    TextDrawAlignment(HUDSideBar[9], 1);
    TextDrawColor(HUDSideBar[9], -1);
    TextDrawSetShadow(HUDSideBar[9], 0);
    TextDrawSetOutline(HUDSideBar[9], 0);
    TextDrawFont(HUDSideBar[9], 4);
    TextDrawSetSelectable(HUDSideBar[9], true);
pawn Код:
hook OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(clickedid == MMORPGHUDSideBar[9])
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on the T-Shirt Textdraw.");
        return 1;
        //CancelSelectTextDraw(playerid);
    }
}
Normally I wouldn't post on here because I like to troubleshoot my own errors and don't like to waste people's time with simple things that include leaving out one single ';', But, I'm desperate.
Reply
#2

The textsize doesn't look right to me, if you are unsure just do this.

https://sampwiki.blast.hk/wiki/TextDrawUseBox

This will show you visually where your box is (X) coordinate. Getting your (Y) coordinate is a matter of trial and error to fine tune. It is explained very poorly on the wiki how this works but you will see with the box on your values are not what you think they would be.
Reply
#3

You can leave out LetterSize completely, it's not used by sprites anyway. Setting it to 0.0, 0.0 has lead to problems for me before, so it might actually be that.

What Pottus said is true as well, but not in this case as it is a sprite and even if there's a box, it would be the exact same size as the sprite.
Reply
#4

Quote:
Originally Posted by NaS
Посмотреть сообщение
You can leave out LetterSize completely, it's not used by sprites anyway. Setting it to 0.0, 0.0 has lead to problems for me before, so it might actually be that.

What Pottus said is true as well, but not in this case as it is a sprite and even if there's a box, it would be the exact same size as the sprite.
I remember this, textdraws do operate strangely as I mentioned the wiki doesn't explain everything.
Reply
#5

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I remember this, textdraws do operate strangely as I mentioned the wiki doesn't explain everything.
That is so true. Especially TextDraws behave very weird if you use values that were never used by R*. But that is kind of obvious, as it was never supposed to be used by anyone but them
Reply
#6

First off, I hold you both in Very high regards in your scripting ability, alot of what I do can actually be traced back to you guys and your scripts/help for other people.

Quote:
Originally Posted by NaS
Посмотреть сообщение
You can leave out LetterSize completely, it's not used by sprites anyway. Setting it to 0.0, 0.0 has lead to problems for me before, so it might actually be that.
I removed the LetterSize and compiled it again, it didn't seem to do anything, I must however mention that for some reason when I click another TD it does something... weird... https://imgur.com/a/gNWXB

Notice the Question Mark? When I press anything else it highlights just fine, however if I press it some random "Back" TD appears that doesn't exist anywhere in my script, I don't even have the word Back in anything other than the "TextDrawBackgroundColor" parts.
Also, my TD seems to move weirdly and disappears in spots. Any Ideas?
Reply
#7

Quote:
Originally Posted by [TC]XxJuggaloxX
Посмотреть сообщение
First off, I hold you both in Very high regards in your scripting ability, alot of what I do can actually be traced back to you guys and your scripts/help for other people.



I removed the LetterSize and compiled it again, it didn't seem to do anything, I must however mention that for some reason when I click another TD it does something... weird... https://imgur.com/a/gNWXB

Notice the Question Mark? When I press anything else it highlights just fine, however if I press it some random "Back" TD appears that doesn't exist anywhere in my script, I don't even have the word Back in anything other than the "TextDrawBackgroundColor" parts.
Also, my TD seems to move weirdly and disappears in spots. Any Ideas?
This sounds like IDs messing up. Although I have no clue how the "Back" TextDraw gets there if it's not even created anywhere. Any Filterscripts or includes that possibly create TextDraws (my first thought was Model Browser Include "Back" Button)? Or any TextDrawSetString using a string that has been used by something else before (this happened to me earlier, very hard to track issue with random words appearing in TextDraws)? This could be related to the flickering TextDraws, as TextDraws are buggy if there are spaces at the very end (which is potentially the case).

Also I noticed that the variable name in the callback is "HUDSideBar" but during creation it's "MMORPGHUDSideBar".
Did you change them for the topic or is it like that in the script? Just making sure.
Reply
#8

Quote:
Originally Posted by NaS
Посмотреть сообщение
This sounds like IDs messing up. Although I have no clue how the "Back" TextDraw gets there if it's not even created anywhere. Any Filterscripts or includes that possibly create TextDraws (my first thought was Model Browser Include "Back" Button)? Or any TextDrawSetString using a string that has been used by something else before (this happened to me earlier, very hard to track issue with random words appearing in TextDraws)? This could be related to the flickering TextDraws, as TextDraws are buggy if there are spaces at the very end (which is potentially the case).

Also I noticed that the variable name in the callback is "HUDSideBar" but during creation it's "MMORPGHUDSideBar".
Did you change them for the topic or is it like that in the script? Just making sure.
I only have 1 filterscript loaded (I keep it on the low with those, don't like them.)
Yes I did change that for the topic, not sure why haha.

Alright, go ahead and B**** slap me. I'm VERY disappointed with myself. After your comment I unloaded the FS and it worked just fine.
I was using the aview Filterscript (Animations Browser which is probably the issue.
I'm VERY sorry I wasted your time.
Reply
#9

TextDrawTextSize(HUDSideBar[9], 12.400017, 12.444452);

try changing too
TextDrawTextSize(HUDSideBar[9], 300.400017, 12.444452);

12 is way to low, its like only 2 characters on a certain font. Play with these settings
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)