textdraw selectable on KeyStateChange
#1

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

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);
    }

}
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)