[BUGS] New textdraw functions
#1

Experienced a few things that looked weird:
  • When you press ESC while you're selecting textdraws, the mouse will disappear but you can't look around anymore.
  • When you press ESC while the mouse if hovering above a textdraw, the mouse will disappear, the textdraw will stay with the selected colour and you can't look around anymore.
Also, if you press ESC the textdraws still show, and since you can't detect when a player presses ESC in this case, you can not hide them.

Not sure if bugs, but these things seem suspicious to me.

EDIT: The mouse thing seemed to be a PC issue, but the problem with the colour still exists
Reply
#2

Quote:

When you press ESC while the mouse if hovering above a textdraw, the mouse will disappear, the textdraw will stay with the selected colour and you can't look around anymore.

Confirmed. Got this also.
Reply
#3

Running some tests I managed to fix this bug and it came out it's pretty simple to fix.
Before (or after, it doesn't matter) every "SelectTextDraw" function add a PVar and set its value to one (Example: SetPVarInt(playerid, "UsingCursor", 1)). Then BEFORE (this is important) Every "CancelSelectTextDraw" function set the PVar's value to 0 (SetPVarInt(playerid, "UsingCursor", 0) in this case). Then add this piece of code anywhere in "OnPlayerClickTextDraw" callback.

pawn Code:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    new msg[100];
    format(msg,sizeof(msg),"Selected: %d", int:clickedid);
    if(strcmp(msg, "Selected: 65535",true) == 0 && GetPVarInt(playerid, "UsingCursor") == 1)
    {
        SelectTextDraw(playerid, 0x9999BBBB);
    }
    return 1;
}
I hope it helps
Reply
#4

pawn Code:
new msg[100];
format(msg,sizeof(msg),"Selected: %d", int:clickedid);
if(strcmp(msg, "Selected: 65535",true) == 0 && GetPVarInt(playerid, "UsingCursor") == 1)
change to:
pawn Code:
if (Text:INVALID_TEXT_DRAW == clickedid && GetPVarInt(playerid, "UsingCursor") == 1)
Reply
#5

The ESC thing is intentional. It's so the player can cancel selecting a textdraw (65535 = 0xFFFF = invalid id). In most cases, I assume once the player has finished selecting a textdraw, the textdraws will be deleted by the gamemode and new textdraws will be shown or action will be taken on the server based on what the user selected.
Reply
#6

Quote:
Originally Posted by Stepashka
View Post
pawn Code:
new msg[100];
format(msg,sizeof(msg),"Selected: %d", int:clickedid);
if(strcmp(msg, "Selected: 65535",true) == 0 && GetPVarInt(playerid, "UsingCursor") == 1)
change to:
pawn Code:
if (Text:INVALID_TEXT_DRAW == clickedid && GetPVarInt(playerid, "UsingCursor") == 1)
Yeah, that could work too xD
Reply
#7

Quote:
Originally Posted by Kalcor
View Post
The ESC thing is intentional. It's so the player can cancel selecting a textdraw (65535 = 0xFFFF = invalid id). In most cases, I assume once the player has finished selecting a textdraw, the textdraws will be deleted by the gamemode and new textdraws will be shown or action will be taken on the server based on what the user selected.
Alright, thanks for clearing that out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)