SA-MP Forums Archive
textdraw selectable on KeyStateChange - 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: textdraw selectable on KeyStateChange (/showthread.php?tid=544700)



textdraw selectable on KeyStateChange - Rudy_ - 03.11.2014

Hello, I have a little Problem.

So basically i was playing with Selectable textdraws, I tried to show the textdraws on OnPlayerKeyStateChange, and then let the player select textdraws.

But when i press they Key ' H ' The textdraws keep showing and dis-appearing (Same with the mouse cursor)
Any idea what's wrong?

pawn Код:
if (PRESSED(KEY_CTRL_BACK))
    {
        PlayerTextDrawShow(playerid, TDEditor1_PTD[playerid][0]);
            PlayerTextDrawShow(playerid, TDEditor1_PTD[playerid][1]);
            SelectTextDraw(playerid, 0x00FF00FF);
    }
    else if (RELEASED(KEY_CTRL_BACK))
    {
        PlayerTextDrawHide(playerid, TDEditor1_PTD[playerid][0]);
            PlayerTextDrawHide(playerid, TDEditor1_PTD[playerid][1]);
            CancelSelectTextDraw(playerid);
    }
Any idea? Thanks


Re: textdraw selectable on KeyStateChange - Dignity - 03.11.2014

pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))
   
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (HOLDING(KEY_CTRL_BACK))
    {
        PlayerTextDrawShow(playerid, TDEditor1_PTD[playerid][0]);
            PlayerTextDrawShow(playerid, TDEditor1_PTD[playerid][1]);
            SelectTextDraw(playerid, 0x00FF00FF);
    }
    else if (RELEASED(KEY_CTRL_BACK))
    {
        PlayerTextDrawHide(playerid, TDEditor1_PTD[playerid][0]);
            PlayerTextDrawHide(playerid, TDEditor1_PTD[playerid][1]);
            CancelSelectTextDraw(playerid);
    }

}



Re: textdraw selectable on KeyStateChange - Rudy_ - 03.11.2014

Yes, I have these on my code, It shows the Code when i'm Holding the H Key. It was all working before, Untill i added the 'SelectTextDraw' Now it keeps showing and hiding the textdraw again and again.