[NOTE] Using CancelSelectTextDraw in OnPlayerClickTextDraw (without bugging up)
#1

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
Reply
#2

Use special define for check invalid TextDraw ID
pawn Код:
if (clickedid != Text:INVALID_TEXT_DRAW)
And never cleared value type!
Reply
#3

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 .
Reply
#4

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Thanks, fixed it .
read all topic:
Quote:
Originally Posted by Stepashka
Посмотреть сообщение
And never cleared value type!
Reply
#5

nice find hiddos
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)