[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


Messages In This Thread

Forum Jump:


Users browsing this thread: