Pressing ESC - OnPlayerClickPlayerTextdraw
#1

Hello there,


I want that when player presses ESC if its a PLAYERTEXTDRAW it will be canceled, I tried several times and searched a lot and I really COULDN'T understand, can anyone fix up my code without telling me to read something!

Thanks in advance
The code:

pawn Код:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(ShowingStats[playerid])
    {
        if(_:playertextid == Textdraw28 )
        {
            CancelSelectTextDraw(playerid);
            HidePlayerStatusTextDraws(playerid);
            return 1;
        }
    }
    return 1;
}

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(ShowingStats[playerid])
    {
        if(_:clickedid == INVALID_TEXT_DRAW)
        {
            CancelSelectTextDraw(playerid);
            HidePlayerStatusTextDraws(playerid);
        }
        return 1;
    }
    return 0;
}
Fix the codes! thanks buddies
Reply
#2

Esc is not detected at OnPlayerClickPlayerTextDraw, it'll only work at OnPlayerClickTextdraw. Only the second one will work.
Reply
#3

Can you fix the code man
Reply
#4

Quote:
Originally Posted by Natric
Посмотреть сообщение
Can you fix the code man
What is exactly your problem? Which code bugs out? Provide more information.
Reply
#5

I put in my script both codes and got no warnings or errors, I logged ingame Showed the textdraw and when I press ESC the selection is canelled but the textdraws still appear..
Reply
#6

Not sure as I rarely use textdraws, but I think you need to call the functions seperately. Try adding TextDrawDestroy(Text:text) under
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
Reply
#7

It's a player textdraw not normal
Reply
#8

TextDrawHideForPlayer(playerid, Text:text) ?

https://sampwiki.blast.hk/wiki/TextDrawHideForPlayer
Reply
#9

Show us the HidePlayerStatusTextDraws() function.
Reply
#10

Mionee stop posting read about playertextdraws they're normal textdraws!!!

Alright CuervO:
pawn Код:
stock HidePlayerStatusTextDraws(playerid)
{
    PlayerTextDrawHide(playerid, Textdraw0);
    PlayerTextDrawHide(playerid, Textdraw1);
    PlayerTextDrawHide(playerid, Textdraw2);
    PlayerTextDrawHide(playerid, Textdraw3);
    PlayerTextDrawHide(playerid, Textdraw4);
    PlayerTextDrawHide(playerid, Textdraw5);
    PlayerTextDrawHide(playerid, Textdraw6);
    PlayerTextDrawHide(playerid, Textdraw7);
    PlayerTextDrawHide(playerid, Textdraw8);
    PlayerTextDrawHide(playerid, Textdraw9);
    PlayerTextDrawHide(playerid, Textdraw10);
    PlayerTextDrawHide(playerid, Textdraw11);
    PlayerTextDrawHide(playerid, Textdraw12);
    PlayerTextDrawHide(playerid, Textdraw13);
    PlayerTextDrawHide(playerid, Textdraw14);
    PlayerTextDrawHide(playerid, Textdraw15);
    PlayerTextDrawHide(playerid, Textdraw16);
    PlayerTextDrawHide(playerid, Textdraw17);
    PlayerTextDrawHide(playerid, Textdraw18);
    PlayerTextDrawHide(playerid, Textdraw19);
    PlayerTextDrawHide(playerid, Textdraw20);
    PlayerTextDrawHide(playerid, Textdraw21);
    PlayerTextDrawHide(playerid, Textdraw22);
    PlayerTextDrawHide(playerid, Textdraw23);
    PlayerTextDrawHide(playerid, Textdraw24);
    PlayerTextDrawHide(playerid, Textdraw25);
    PlayerTextDrawHide(playerid, Textdraw26);
    PlayerTextDrawHide(playerid, Textdraw27);
    PlayerTextDrawHide(playerid, Textdraw28);
}

In addition I want to say that it works when I click on the textdraw and shit in OnPlayerClickPlayerTextdraw it hides but once I show the textdraw again and press Escape it just cancels the textdraw selection without hiding the textdraw please fix the code or make a code I tried for two days and I can't overcome this problem!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)