ESC - OnPlayerClickPlayerTextDraw
#1

Hello there,

I want that the player textdraw is going to be hidden after pressing Escape (ESC) heres the code under OnPlayerClickPlayerTextDraw

pawn Код:
if(ShowingStats[playerid])
    {
        if(playertextid == Textdraw28)
        {
            HidePlayerStatusTextDraws(playerid);
            CancelSelectTextDraw(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "The textdraw was canceled successfuly!.");
            ShowingStats[playerid] = 0;
            return 1;
        }
        else
        {
            HidePlayerStatusTextDraws(playerid);
            CancelSelectTextDraw(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "The textdraw was canceled successfuly!.");
        }
        return 1;
    }
Thanks in advance!
Reply
#2

Quote:
Originally Posted by Natric
Посмотреть сообщение
Hello there,

I want that the player textdraw is going to be hidden after pressing Escape (ESC) heres the code under OnPlayerClickPlayerTextDraw

pawn Код:
if(ShowingStats[playerid])
    {
        if(playertextid == Textdraw28)
        {
            HidePlayerStatusTextDraws(playerid);
            CancelSelectTextDraw(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "The textdraw was canceled successfuly!.");
            ShowingStats[playerid] = 0;
            return 1;
        }
        else
        {
            HidePlayerStatusTextDraws(playerid);
            CancelSelectTextDraw(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "The textdraw was canceled successfuly!.");
        }
        return 1;
    }
Thanks in advance!
You can also do when the player presses ESC You can set them to another world like: SetPlayerVirtualWorld or something.
Reply
#3

What do you mean? did you even read my question!
Reply
#4

Quote:
Originally Posted by Natric
Посмотреть сообщение
What do you mean? did you even read my question!
Oh sorry bro. My bad. try this: https://sampwiki.blast.hk/wiki/ShowNameTags
Reply
#5

Are you kidding me!

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
I did a createplayertextdraw - textdraws and I want when pressing escape they should get hidden... please read questions
help if u can
Reply
#6

Quote:
Originally Posted by Natric
Посмотреть сообщение
Are you kidding me!

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
I did a createplayertextdraw - textdraws and I want when pressing escape they should get hidden... please read questions
help if u can
Dude I'm trying to help you. I'm not a good scripter. I'm just trying to help :S
Reply
#7

Alright, leave it for the others then thanks anyway
Reply
#8

https://sampforum.blast.hk/showthread.php?tid=475845&page=2
Reply
#9

https://sampwiki.blast.hk/wiki/Keys
(Didn't find any "ESC", maybe make it on a diff. key?)
After you've select the key, put the code on "OnPlayerKeyStateChange" ..

EDIT: Konstantinos was faster
Reply
#10

It still doesnt work for me, heres the code:

pawn Код:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(ShowingStats[playerid])
    {
        if(playertextid == Textdraw28)
        {
            HidePlayerStatusTextDraws(playerid);
            CancelSelectTextDraw(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "The textdraw was canceled successfuly!.");
            ShowingStats[playerid] = 0;
            return 1;
        }
    }
    if(GetPVarInt(playerid, "mS_list_active") == 1 || (GetTickCount()-GetPVarInt(playerid, "mS_list_time")) > 200)
    {
        new curpage = GetPVarInt(playerid, "mS_list_page");

        // Handle: cancel button
        if(playertextid == gCancelButtonTextDrawId[playerid]) {
            new listID = mS_GetPlayerCurrentListID(playerid);
            if(listID == mS_CUSTOM_LISTID)
            {
                new extraid = GetPVarInt(playerid, "mS_custom_extraid");
                HideModelSelectionMenu(playerid);
                CallLocalFunction("OnPlayerModelSelectionEx", "dddd", playerid, 0, extraid, -1);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
            else
            {
                HideModelSelectionMenu(playerid);
                CallLocalFunction("OnPlayerModelSelection", "dddd", playerid, 0, listID, -1);
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
            return 1;
        }

        // Handle: next button
        if(playertextid == gNextButtonTextDrawId[playerid]) {
            new listID = mS_GetPlayerCurrentListID(playerid);
            if(listID == mS_CUSTOM_LISTID)
            {
                if(curpage < (mS_GetNumberOfPagesEx(playerid) - 1)) {
                    SetPVarInt(playerid, "mS_list_page", curpage + 1);
                    mS_ShowPlayerMPs(playerid);
                    mS_UpdatePageTextDraw(playerid);
                    PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
                } else {
                    PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
                }
            }
            else
            {
                if(curpage < (mS_GetNumberOfPages(listID) - 1)) {
                    SetPVarInt(playerid, "mS_list_page", curpage + 1);
                    mS_ShowPlayerMPs(playerid);
                    mS_UpdatePageTextDraw(playerid);
                    PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
                } else {
                    PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
                }
            }
            return 1;
        }

        // Handle: previous button
        if(playertextid == gPrevButtonTextDrawId[playerid]) {
            if(curpage > 0) {
                SetPVarInt(playerid, "mS_list_page", curpage - 1);
                mS_ShowPlayerMPs(playerid);
                mS_UpdatePageTextDraw(playerid);
                PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
            } else {
                PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            }
            return 1;
        }

        // Search in the array of textdraws used for the items
        new x=0;
        while(x != mS_SELECTION_ITEMS) {
            if(playertextid == gSelectionItems[playerid][x])
            {
                new listID = mS_GetPlayerCurrentListID(playerid);
                if(listID == mS_CUSTOM_LISTID)
                {
                    PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
                    new item_id = gSelectionItemsTag[playerid][x];
                    new extraid = GetPVarInt(playerid, "mS_custom_extraid");
                    HideModelSelectionMenu(playerid);
                    CallLocalFunction("OnPlayerModelSelectionEx", "dddd", playerid, 1, extraid, item_id);
                    return 1;
                }
                else
                {
                    PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
                    new item_id = gSelectionItemsTag[playerid][x];
                    HideModelSelectionMenu(playerid);
                    CallLocalFunction("OnPlayerModelSelection", "dddd", playerid, 1, listID, item_id);
                    return 1;
                }
            }
            x++;
        }
    }
    return 1;
}
Under On

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(GetPVarInt(playerid, "mS_ignore_next_esc") == 1) {
        SetPVarInt(playerid, "mS_ignore_next_esc", 0);
        return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);
    }
    if(GetPVarInt(playerid, "mS_list_active") == 0) return CallLocalFunction("MP_OPCTD", "ii", playerid, _:clickedid);

    // Handle: They cancelled (with ESC)
    if(clickedid == Text:INVALID_TEXT_DRAW)
    {
        if(ShowingStats[playerid])
        {
            HidePlayerStatusTextDraws(playerid);
            CancelSelectTextDraw(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "The textdraw was canceled successfuly!.");
            ShowingStats[playerid] = 0;
            return 1;
        }
        new listid = mS_GetPlayerCurrentListID(playerid);
        if(listid == mS_CUSTOM_LISTID)
        {
            new extraid = GetPVarInt(playerid, "mS_custom_extraid");
            mS_DestroySelectionMenu(playerid);
            CallLocalFunction("OnPlayerModelSelectionEx", "dddd", playerid, 0, extraid, -1);
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
        }
        else
        {
            mS_DestroySelectionMenu(playerid);
            CallLocalFunction("OnPlayerModelSelection", "dddd", playerid, 0, listid, -1);
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)