AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Exit Menu (https://forums.alliedmods.net/showthread.php?t=225199)

Cheezpuff 09-01-2013 18:04

[HELP] Exit Menu
 
How to add that menu exit.
0: exit
Code:

    format(menu,511,"\r[4Honor`] \wZombies Selection Menu^nSelect your favorite \yZombie \wClass:^n\w%s^n", menu)
    if(curnum==8 && offset<12)
    {
        keys += (1<<8)
        format(menu,511,"%s^n\w9. Next",menu)
    }
    if(offset)
    {
        keys += (1<<9)
        format(menu,511,"%s^n\w0. Back",menu)
    }

    show_menu(id,keys,menu,-1,"ZClassSelect")
}

public zclass_pushed(id,key)
{
    if(key<8)
    {
        if (g_iMenuOptions[id][key] == g_iZombieClass[id])
        {
            client_cmd(id, "spk %s", LOCK_FAIL);
           
            print_color(id, "%s %L", MODNAME, LANG_SERVER, "CLASS_CURRENT")
            show_zclass_menu(id,g_iMenuOffset[id])
            return ;
        }
       
        new iCache3 = ArrayGetCell(g_zclass_admin, g_iMenuOptions[id][key])
       
        if ((iCache3 != ADMIN_ALL || !iCache3) && !access(id, iCache3))
        {
            print_color(id, "%s %L", MODNAME, LANG_SERVER, "CLASS_NO_ACCESS")
            show_zclass_menu(id,g_iMenuOffset[id])
            return ;
        }
       
        g_iNextClass[id] = g_iMenuOptions[id][key]
   
        new szCache1[32]
        ArrayGetString(g_zclass_name, g_iMenuOptions[id][key], szCache1, charsmax(szCache1))
       
        if (!g_isZombie[id] || (g_isZombie[id] && (g_boolCanBuild || g_boolPrepTime)))
            ColorChat(id, RED, "^4%s ^1You have selected^4 %s^1 as your next class", MODNAME, szCache1)
        if (!g_isAlive[id])
            ColorChat(id, RED, "%s %L", MODNAME, LANG_SERVER, "CLASS_RESPAWN")
        g_iMenuOffset[id] = 0
       
        if (g_isZombie[id] && (g_boolCanBuild || g_boolPrepTime))
            ExecuteHamB(Ham_CS_RoundRespawn, id)
           
        ExecuteForward(g_fwClassPicked, g_fwDummyResult, id, g_iZombieClass[id]);
    }
    else
    {
        if(key==8)
            g_iMenuOffset[id] += 8
        if(key==9)
            g_iMenuOffset[id] -= 8
        show_zclass_menu(id,g_iMenuOffset[id])
    }

    return ;
}


Black Rose 09-01-2013 19:23

Re: [HELP] Exit Menu
 
This will add "Exit" to the first page:
Code:
    if(offset)     {         keys += (1<<9)         format(menu,511,"%s^n\w0. Back",menu)     }
-->
Code:
    keys += (1<<9)     if(offset)         format(menu,511,"%s^n\w0. Back",menu)     else         format(menu,511,"%s^n\w0. Exit",menu)
&
Code:
        if(key==9)             g_iMenuOffset[id] -= 8
-->
Code:
        if(key==9) {             if(!g_iMenuOffset[id])                 return;             else                 g_iMenuOffset[id] -= 8         }

This will replace "Back" with "Exit" on all pages:
Code:
    if(offset)     {         keys += (1<<9)         format(menu,511,"%s^n\w0. Back",menu)     }
-->
Code:
    keys += (1<<9)     format(menu,511,"%s^n\w0. Exit",menu)
&
Code:
        if(key==9)             g_iMenuOffset[id] -= 8
-->
Code:
        if(key==9)             return;

Blizzard_87 09-01-2013 20:30

Re: [HELP] Exit Menu
 
Or simply use the new menu system.

Cheezpuff 09-02-2013 00:46

Re: [HELP] Exit Menu
 
ok, let me try late and i edit my post.


All times are GMT -4. The time now is 19:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.