SA-MP Forums Archive
CancelSelectTextDraw Bugged. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: CancelSelectTextDraw Bugged. (/showthread.php?tid=481847)



CancelSelectTextDraw Bugged. - Roel - 17.12.2013

Hello,

When CancelSelectTextDraw is called, CancelSelectTextDraw calls OnPlayerClickTextDraw which is totaly pointless.

This is not a problem at all, except the fact that it is given INVALID_TEXT_DRAW as clickedid.
Which makes the script that I use when a player hits ESC when he is under SelectTextDraw broken.

Also another thing that i just don't get, why dont make something like OnPlayerCanceledSelectTextDraw or something... so you can detect when a player hits ESC on a logical way.

Thanks for reading.


Re: CancelSelectTextDraw Bugged. - Pottus - 17.12.2013

Not a bug at all and it is not pointless.


pawn Код:
forward ClickPlayerItemDraw(playerid, Text:clickedid);
public ClickPlayerItemDraw(playerid, Text:clickedid)
{
    // Close code
    if(Text:INVALID_TEXT_DRAW == clickedid)
    {
        HidePlayerItemDraws(playerid);
        TextDrawOpen[playerid] = false;
        PlayerItemDrawOpen[playerid] = false;
    }

    // Click Close
    else if(Text:Click_Itemdraw_Close == clickedid) CancelSelectTextDraw(playerid);
}
How hard is it to that ?


Re: CancelSelectTextDraw Bugged. - Roel - 17.12.2013

Ye well rethink your answer, because it is pointless.

I see what basicly happends, when a player hits ESC, the script just calls CancelSelectTextDraw.
Which is fine, but when I want to cancel the selection scriptside, I don't want it to go over OnPlayerClickTextDraw.
So this makes the function CancelSelectTextDraw kind of bugged.
If not, then tell me the point of it.


Re: CancelSelectTextDraw Bugged. - Pottus - 17.12.2013

Take a look at my code above.


Re: CancelSelectTextDraw Bugged. - Roel - 17.12.2013

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Take a look at my code above.
Ye well that doesn't change a thing, now take a look at my code, and let me explain what is going on.

pawn Код:
public OnPlayerClickTextDraw(playerid,Text:clickedid)
{
    if(_:clickedid == INVALID_TEXT_DRAW)
    {
        if(pList[playerid][LIST_TYPE] != FALSE) ClosePlayerList(playerid);
        if(pList[playerid][OPTION_TYPE] != FALSE) ClosePlayerOptions(playerid);
    }
    return 1;
}
Now at some command this code is runned:
pawn Код:
ClosePlayerList(playerid);
ShowPlayerOptions(playerid,OPTION_FURNITURE);
Now inside ClosePlayerList there has been used a CancelSelectTextDraw call.
Inside ShowPlayerOptions the variable: pList[playerid][OPTION_TYPE] has been set on true

When CancelSelectTextDraw gets called in ClosePlayerList, this OPTION_TYPE variable is already set on true in ShowPlayerOptions., which makes my ShowPlayerOptions textdraws directly get destroyed because of CancelSelectTextDraw .

And I can't remove CancelSelectTextDraw from ClosePlayerList, because ClosePlayerList is used on alot of different locations in my script.