SA-MP Forums Archive
[BUGS] New textdraw functions - 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: [BUGS] New textdraw functions (/showthread.php?tid=327246)



[BUGS] New textdraw functions - Drebin - 20.03.2012

Experienced a few things that looked weird:
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


Re: [BUGS] New textdraw functions - Gforcez - 20.03.2012

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.


Re: [BUGS] New textdraw functions - SpiritEvil - 20.03.2012

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


Re: [BUGS] New textdraw functions - Stepashka - 20.03.2012

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)



Re: [BUGS] New textdraw functions - Kalcor - 20.03.2012

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.


Re: [BUGS] New textdraw functions - SpiritEvil - 20.03.2012

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


AW: Re: [BUGS] New textdraw functions - Drebin - 20.03.2012

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.