What's wrong with my Textdraw clickable?
#1

Well , my textdraw "Entrar" is still showing if i press the key "ESC" , here's my code

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == IconosEntradas[0])
    {
        TextDrawShowForPlayer(playerid,Caja);
        TextDrawShowForPlayer(playerid,Entrada[0]);
        SelectTextDraw(playerid, Color_Rojo);
    }
    return 1;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != 65535)
    {
        if(clickedid == Entrada[0])
        {
            SetPlayerVirtualWorld( playerid, 5);
            SetPlayerInterior( playerid, 5);
            SetPlayerPos( playerid, 1409.53857, 1316.47266, 1501.04822);
        }

        TextDrawHideForPlayer(playerid, Caja);
        TextDrawHideForPlayer(playerid, Entrada[0]);

        CancelSelectTextDraw(playerid);
    }
    return 1;
}
I don't know what is wrong
Reply
#2

Wiki: clickedid: The ID of the clicked textdraw. INVALID_TEXT_DRAW if selection was cancelled.
INVALID_TEXT_DRAW is 65535
so in this line :

pawn Код:
if(_:clickedid != 65535)
you defined if clickid isn't invalid OR selection NOT Canceled ~~~> do something

you have to use TextDrawHideForPlayer with else

edit:
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(_:clickedid != 65535)
    {
        if(clickedid == Entrada[0])
        {
            SetPlayerVirtualWorld( playerid, 5);
            SetPlayerInterior( playerid, 5);
            SetPlayerPos( playerid, 1409.53857, 1316.47266, 1501.04822);
        }
        CancelSelectTextDraw(playerid);
    }
    else
    {
    TextDrawHideForPlayer(playerid, Caja);
    TextDrawHideForPlayer(playerid, Entrada[0]);
    CancelSelectTextDraw(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)