Textdraws/Sprites dissappearing, changing, and generally acting weird.
#1

Textdraw problem 1: SOLVED (TextDrawTextSize had to be used)
When I have numerous textdraws underneath each other in a menu-like order, and I make them all selectable with TextDrawSetSelectable(textdrawID, 1), and I select the bottom one, the ones above it are selected too when I hover over it.

For example:
Textdraw1 -> sendmsg '1'
Textdraw2 -> sendmsg '2'
Textdraw3 -> etc
Textdraw4

When I select textdraw1, only that one is selected. When I select textdraw2, both textdraw1 and 2 are selected. When I select textdraw3, textdraw1, 2, and 3 are selected, etc. I gave them simple sendclientmessage functions to check whether the server clicks on the right one, and it does. When I click on textdraw1, I get the msg '1', when I click on textdraw2, I get the msg '2', so the server sees the difference between the textdraws, but it still selects them all. I initialized every textdraw, so the problem can't be there.

Sort of the same thing happened with sprites. I had 9 16x16 sprites in a 3x3 configuration(plenty of space between them)

1 2 3
4 5 6
7 8 9

When I'd hover over 6, 4 gets selected too (not 5). When I hover over 8, 4 6 7 8 and 9 are selected as well. If I'd click on 7 or 8, textdraw 9 would get activated.

What the hell is going on and how can I fix this? xD

NOTE: My mouse can be on the other side of the screen, but when I get to the textdraw's height, it gets selected as well, as if there's an invisible button stretching out from 1 side of the screen to the other.

Textdraw problem 2: SOLVED (can't define the same sprite twice)
I have the LD_BEAT:left sprite in the script, but instead of showing the actual arrow txd of LD_BEAT:left, it shows the actual text 'LD BEAT:left". This is the code I use:

Код:
left= TextDrawCreate(271.000, 308.500, "LD_BEAT:left");
TextDrawFont(left, 4);
TextDrawTextSize(left, 10.000, 10.000);
TextDrawColor(left, 0x000000FF);
The weird thing is that when I use this in the standard grandlarc gamemode, it shows up like it should, as an arrow. But when I use it in my FS, it shows up as text. How do I fix that?

Textdraw problem 3: SOLVED (Forgot a simple TextDrawShowForPlayer, d'oh!)
Somewhat similar to the first problem, but not quite:

I have 10 textdraws lined up as follows:
Textdraw1
Textdraw2
Textdraw3
Textdraw4
Textdraw5 Textdraw6
Textdraw7
Textdraw8 Textdraw9
Textdraw10
They're all selectable, except for textdraws 4 and 7. Textdraws5,6,8, and 9 have backgrounds, so they look more like buttons. Before I made them selectable they showed up just fine, without any problems. But as soon as I used TextDrawSetSelectable, Textdraws4 and 7 dissappeared, and textdraws5,6,8 and 9 weren't selectable at all. When I hovered over texdraw2,3,or 10, the textdraws above were selected as well, like the first problem I described (but not the button textdraws, they simply can't be selected, and not the textdraws4 and 7 because they just dissappeared.

I have no idea what I'm doing wrong, or what I'm missing.

PS: All the textdraws in my problems are aligned to the center, but I tried adjusting it to either right, or left, but to no avail.
Reply
#2

Confirming problem 1
Reply
#3

Problem 1 is a problem with your textdraws/script.
You have to use TextDrawTextSize on each textdraw which defines the clickable area, when you use it correctly you won't have any problems anymore.
Reply
#4

Quote:
Originally Posted by Drebin
Посмотреть сообщение
Problem 1 is a problem with your textdraws/script.
You have to use TextDrawTextSize on each textdraw which defines the clickable area, when you use it correctly you won't have any problems anymore.
TextDrawTextSize did seem to fix the problem of all the above textdraws being selected. It did screw up the layout though, with the textdraws flowing into each other.. Any advice on which values for textdrawtextsize to use or is it simply a matter of trial and error?

PS: Trial and error synched everything back up. The 2 'dissappearing' textdraws was a retarded move of me forgetting to use TextDrawShowForPlayer for those 2. So problem 1 is solved, problem 3 was, in hindsight, not a problem, but that still leaves me with that sprite that appears as text. Anyone?

EDIT: Apparently you can't define the same sprite twice. I had new Text:left and new Text:left1. After I removed the other, the current one worked fine and displayed like it should.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)