ESC - OnPlayerClickPlayerTextDraw
#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


Messages In This Thread
ESC - OnPlayerClickPlayerTextDraw - by Natric - 13.02.2014, 15:47
Re: ESC - OnPlayerClickPlayerTextDraw - by SniperArmy - 13.02.2014, 15:49
Re: ESC - OnPlayerClickPlayerTextDraw - by Natric - 13.02.2014, 15:50
Re: ESC - OnPlayerClickPlayerTextDraw - by SniperArmy - 13.02.2014, 15:54
Re: ESC - OnPlayerClickPlayerTextDraw - by Natric - 13.02.2014, 15:56
Re: ESC - OnPlayerClickPlayerTextDraw - by SniperArmy - 13.02.2014, 15:59
Re: ESC - OnPlayerClickPlayerTextDraw - by Natric - 13.02.2014, 16:01
Re: ESC - OnPlayerClickPlayerTextDraw - by Konstantinos - 13.02.2014, 16:07
Re: ESC - OnPlayerClickPlayerTextDraw - by Kyance - 13.02.2014, 16:07
Re: ESC - OnPlayerClickPlayerTextDraw - by Natric - 13.02.2014, 16:19

Forum Jump:


Users browsing this thread: 2 Guest(s)