[NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) - 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: [NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) (
/showthread.php?tid=328257)
[NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) -
Hiddos - 24.03.2012
I've got no clue why, but CancelSelectTextDraw calls OnPlayerClickTextDraw (Seriously, what useful information would it pass?).
Code like this:
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
/*
-- other code --
*/
CancelSelectTextDraw(playerid);
}
CancelSelectTextdraw calls OnPlayerClickTextDraw, so using the function in OnPlayerClickTextDraw results in an endless loop.
I did some research and found that CancelSelectTextDraw calls OnPlayerClickTextDraw with a textdraw ID of 65535 - INVALID_TEXT_DRAW. That said: If you want to use CancelSelectTextDraw in OnPlayerClickTextDraw without creating an eternal loop, you'll need to adjust your code to something like this:
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(_:clickedid != INVALID_TEXT_DRAW)
{
/*
-- other code --
*/
CancelSelectTextDraw(playerid);
}
}
I guess they'll fix this in a later RC, but for whomever is already experiencing problems this could be a workaround.
Edit: Small fix
Edit: Tweaked 65535 to INVALID_TEXT_DRAW - thanks to Stepashka
Re: [NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) -
Stepashka - 24.03.2012
Use special define for check invalid TextDraw ID
pawn Код:
if (clickedid != Text:INVALID_TEXT_DRAW)
And never cleared value type!
Re: [NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) -
Hiddos - 24.03.2012
Quote:
Originally Posted by Stepashka
Use special define for check invalid TextDraw ID
pawn Код:
if (clickedid != Text:INVALID_TEXT_DRAW)
And never cleared value type!
|
Thanks, fixed it

.
Re: [NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) -
Stepashka - 24.03.2012
Quote:
Originally Posted by Hiddos
Thanks, fixed it  .
|
read all topic:
Quote:
Originally Posted by Stepashka
And never cleared value type!
|
Re: [NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) -
legodude - 24.03.2012
nice find hiddos
Re: [NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up) -
Hiddos - 24.03.2012
Quote:
Originally Posted by legodude
nice find hiddos
|
I've looked around the forums a bit and noticed I wasn't the only one having this issue. You would've found out as well if you'd use it I guess
Quote:
Originally Posted by Stepashka
read all topic:
|
It'll result in the same effect