SA-MP Forums Archive
Pressing ESC - OnPlayerClickPlayerTextdraw - 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: Pressing ESC - OnPlayerClickPlayerTextdraw (/showthread.php?tid=494654)



Pressing ESC - OnPlayerClickPlayerTextdraw - Natric - 14.02.2014

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


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - CuervO - 14.02.2014

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


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - Natric - 14.02.2014

Can you fix the code man


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - CuervO - 14.02.2014

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


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - Natric - 14.02.2014

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


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - Dignity - 14.02.2014

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)



Re: Pressing ESC - OnPlayerClickPlayerTextdraw - Natric - 14.02.2014

It's a player textdraw not normal


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - Dignity - 14.02.2014

TextDrawHideForPlayer(playerid, Text:text) ?

https://sampwiki.blast.hk/wiki/TextDrawHideForPlayer


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - CuervO - 14.02.2014

Show us the HidePlayerStatusTextDraws() function.


Re: Pressing ESC - OnPlayerClickPlayerTextdraw - Natric - 14.02.2014

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!