AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Custom Buy Menu separate to categories (https://forums.alliedmods.net/showthread.php?t=332847)

YankoNL 06-04-2021 13:03

[Help] Custom Buy Menu separate to categories
 
Hello, I am trying to separate a list of custom weapons in to categories(Pistols, Shotguns, Snipers and so on). I am having trouble with that. I tried to edit the codes but the order of buying is messed up.

Original:
Code:

#include <amxmodx>
#include <fakemeta>
#include <zombieplaguenightmare>

#define VIP ADMIN_LEVEL_G

new Array:ItemName
new Array:ItemCost
new Array:ItemMinPlayers
new Array:ItemVip
new Array:ItemLimitInMapP
new Array:ItemLimitInRound
new Array:LimitForAllMap
new Array:LimitForAllRound
new Array:ItemTeam

new g_End, g_Item
new g_LimitInMap[33][512] , g_LimitInRound[33][512]
new g_LimitAllMap, g_LimitAllRound

public plugin_natives()
{
        register_native("zp_register_extra_iteem" , "native_register_extra_item" , 1)
        register_native("OpenWeaponMenu" , "WeaponMenu" , 1)
}

public plugin_init()
{
        g_Item = CreateMultiForward("zp_extra_item_selecteed", ET_CONTINUE, FP_CELL, FP_CELL)
}

public plugin_precache()
{
        ItemName = ArrayCreate(64, 1)
        ItemCost = ArrayCreate(32, 1)
        ItemMinPlayers = ArrayCreate(32, 1)
        ItemVip = ArrayCreate(32, 1)
        ItemLimitInMapP = ArrayCreate(32, 1)
        ItemLimitInRound = ArrayCreate(32, 1)
        LimitForAllMap = ArrayCreate(32, 1)
        LimitForAllRound = ArrayCreate(32, 1)
        ItemTeam =  ArrayCreate(32, 1)
}

public WeaponMenu(Player)
{
        if(!is_user_connected(Player) || !is_user_alive(Player))
        return PLUGIN_HANDLED
       
        if(!ArraySize(ItemName))
        {
                log_amx("[WeaponMenu] No extra items loaded (Name = 0)")
                return PLUGIN_HANDLED
        }
       
        new Menu
        Menu = menu_create("Weapon Menu:" , "WeaponMenuHand")
        new Buffer[64] , Name[32]
        new Item, team
       
        menu_setprop(Menu, MPROP_NUMBER_COLOR, "\r");
       
        for(Item = 0; Item < ArraySize(ItemName); Item ++)
        {
                team = ArrayGetCell(ItemTeam, Item)
               
                if ((zp_get_user_zombie(Player) && !zp_get_user_nemesis(Player) && !zpnm_get_user_assassin(Player) && !(team & ZP_TEAM_ZOMBIE)) || (!zp_get_user_zombie(Player) && !zp_get_user_survivor(Player) && !zpnm_get_user_sniper(Player) && !(team & ZP_TEAM_HUMAN)) || (zp_get_user_nemesis(Player) || (zpnm_get_user_assassin(Player) && !(team & ZP_TEAM_NEMESIS)) && !(team & ZP_TEAM_ASSASSIN)) || (zp_get_user_survivor(Player) && !(team & ZP_TEAM_SURVIVOR)))
                        continue
               
                ArrayGetString(ItemName, Item, Name, charsmax(Name))
               
                if(zp_get_user_ammo_packs(Player) < ArrayGetCell(ItemCost, Item))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\dUnavailable\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(ItemMinPlayers, Item) && get_playersnum() < ArrayGetCell(ItemMinPlayers, Item))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rMin Players: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemMinPlayers, Item))
                }
                else if(ArrayGetCell(ItemVip, Item) && ArrayGetCell(ItemVip, Item) && !(get_user_flags(Player) & VIP))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rV.I.P Only\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) == g_LimitInMap[Player][Item])
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rMap Limit: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemLimitInMapP, Item))
                }
                else if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) == g_LimitInRound[Player][Item])
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rRound Limit: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemLimitInRound  , Item))
                }
                else if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) == g_LimitAllMap)
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) == g_LimitAllRound)
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else
                {
                        formatex(Buffer, charsmax(Buffer), "\w%s \y[%d$]", Name, ArrayGetCell(ItemCost, Item))
                }
                menu_additem(Menu , Buffer)
               
                menu_setprop(Menu, MPROP_NEXTNAME, "Next")
                menu_setprop(Menu, MPROP_BACKNAME, "Back")
                menu_setprop(Menu, MPROP_EXITNAME, "Exit")
        }
        if (pev_valid(Player) == 2) set_pdata_int(Player, 205, 0, 5)
        menu_display(Player, Menu, 0)
        return PLUGIN_HANDLED
}

public WeaponMenuHand(Player, Menu, Item)
{
        if(!is_user_connected(Player) || !is_user_alive(Player))
        return PLUGIN_HANDLED
       
        if(zp_get_user_zombie(Player))
        return PLUGIN_HANDLED
       
        if(Item == MENU_EXIT)
        {
                menu_destroy(Menu)
                return PLUGIN_HANDLED
        }
       
        new Cost = ArrayGetCell(ItemCost, Item)
       
        if(zp_get_user_ammo_packs(Player) < Cost)
        {
                client_print(Player, print_center, "Not enough money")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemMinPlayers, Item) && get_playersnum() < ArrayGetCell(ItemMinPlayers, Item))
        {
                client_print(Player, print_center, "Need more players")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemVip, Item) && ArrayGetCell(ItemVip, Item) && !(get_user_flags(Player) & VIP))
        {
                client_print(Player, print_center, "You need to be V.I.P")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) == g_LimitInMap[Player][Item])
        {
                client_print(Player, print_center, "Weapon map limit reached: [%d]" , ArrayGetCell(ItemLimitInMapP, Item))
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) == g_LimitInRound[Player][Item])
        {
                client_print(Player, print_center, "Weapon round limit reached: [%d]" , ArrayGetCell(ItemLimitInRound, Item))
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) == g_LimitAllMap)
        {
                client_print(Player, print_center, "This weapon will be available next map.")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) == g_LimitAllRound)
        {
                client_print(Player, print_center, "This item will be available next round.")
                return PLUGIN_HANDLED
        }
       
        if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) > g_LimitInMap[Item][Player])
                g_LimitInMap[Player][Item] ++
        if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) > g_LimitInRound[Item][Player])
                g_LimitInRound[Player][Item] ++
        if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) > g_LimitAllMap)
                g_LimitAllMap ++
        if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) > g_LimitAllRound)
                g_LimitAllRound ++
        ExecuteForward(g_Item, g_End, Player, Item)
        zp_set_user_ammo_packs(Player, zp_get_user_ammo_packs(Player) - Cost)
        return PLUGIN_HANDLED
}

public zp_round_ended()
{
        g_LimitAllRound = false
       
        static Player, Itemid
       
        for (Player = 1; Player <= get_maxplayers(); Player++)
        {
                if(!is_user_connected(Player))
                        continue
               
                for (Itemid = 0; Itemid <= ArraySize(ItemName); Itemid++)
                {
                        g_LimitInRound[Player][Itemid] = 0
                }
        }
}

public native_register_extra_item(const Name[], Cost, MinPlayers, Vip, LimitInMap, LimitInRound, LimitAllMap, LimitAllRound, Team)
{
        param_convert(1)
       
        ArrayPushString(ItemName, Name)
        ArrayPushCell(ItemCost, Cost)
        ArrayPushCell(ItemMinPlayers, MinPlayers)
        ArrayPushCell(ItemVip, Vip)
        ArrayPushCell(ItemLimitInMapP, LimitInMap)
        ArrayPushCell(ItemLimitInRound, LimitInRound)
        ArrayPushCell(LimitForAllMap, LimitAllMap)
        ArrayPushCell(LimitForAllRound, LimitAllRound)
        ArrayPushCell(ItemTeam, Team)
       
        return ArraySize(ItemName) - 1
}

Code:

#include < amxmodx >
#include < zombieplaguenightmare >

native zp_register_extra_iteem( const Name[] , Cost , MinPlayers , Vip , LimitInMap , LimitInRound , LimitForAllMap , LimitForAllRound , Team )
forward zp_extra_item_selecteed( Player , Item )
/*==================================
        Pistols
==================================*/
native give_balrog1(Player)
native give_infinity(Player)
native give_janus1(Player)
//native give_gunslinger(Player)

/*==================================
        Shotguns
==================================*/
native give_spas12(Player)
native give_triplebarrel(Player)
native give_balrog11(Player) // Admin

/*==================================
        Automated Rifles
==================================*/
native give_g11(Player)
native give_cv80(Player)
native give_balrog3(Player)
native give_balrog5(Player)
native give_cartblue(Player)
native give_skull3(Player)
native give_skull4(Player)
native give_plasma Player) //Admin

/*==================================
        Sniper Rifles
==================================*/
native give_bow(Player)
native give_m95(Player)

/*==================================
        Heavy Machiene Guns
==================================*/
native give_janus7(Player)

/*==================================
        Extra Equipment
==================================*/
native give_at4(Player)
native give_spear(Player)
native give_chainsaw(Player)
native give_bazooka(Player)

new const EXTRA_ITEM_COST[] =                                { 20000 , 10000 , 800 , 1000 , 1500 , 3000 , 15000 , 10000 , 50000 , 30000 , 5000 , 3200 , 2000 , 1700 , 2200 , 7000 , 6500 , 10000 , 50000, 1000 } ;
new const EXTRA_ITEM_MIN_PLAYERS[] =                { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2, 0 } ;
new const EXTRA_ITEM_VIP[] =                                { 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 1} ;
new const EXTRA_ITEM_LIMIT_MAP_ID[] =                { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0 } ;
new const EXTRA_ITEM_LIMIT_ROUND_ID[] =          { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2, 0 } ;
new const EXTRA_ITEM_LIMIT_MAP_0[] =                { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0 } ;
new const EXTRA_ITEM_LIMIT_ROUND_0[] =                { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0 } ;

new gItem[22] ;

public plugin_init()
{       
        gItem[0] = zp_register_extra_iteem("Balrog11" , EXTRA_ITEM_COST[0] , EXTRA_ITEM_MIN_PLAYERS[0] , EXTRA_ITEM_VIP[0] , EXTRA_ITEM_LIMIT_MAP_ID[0] , EXTRA_ITEM_LIMIT_ROUND_ID[0], EXTRA_ITEM_LIMIT_MAP_0[0], EXTRA_ITEM_LIMIT_ROUND_0[0], ZP_TEAM_HUMAN )
        gItem[1] = zp_register_extra_iteem("PlasmaGun" , EXTRA_ITEM_COST[1] , EXTRA_ITEM_MIN_PLAYERS[1] , EXTRA_ITEM_VIP[1] , EXTRA_ITEM_LIMIT_MAP_ID[1] , EXTRA_ITEM_LIMIT_ROUND_ID[1], EXTRA_ITEM_LIMIT_MAP_0[1], EXTRA_ITEM_LIMIT_ROUND_0[1], ZP_TEAM_HUMAN )
        gItem[2] = zp_register_extra_iteem("Dual Infinity" , EXTRA_ITEM_COST[2] , EXTRA_ITEM_MIN_PLAYERS[2] , EXTRA_ITEM_VIP[2] , EXTRA_ITEM_LIMIT_MAP_ID[2] , EXTRA_ITEM_LIMIT_ROUND_ID[2], EXTRA_ITEM_LIMIT_MAP_0[2], EXTRA_ITEM_LIMIT_ROUND_0[2], ZP_TEAM_HUMAN )
        gItem[3] = zp_register_extra_iteem("Janus1" , EXTRA_ITEM_COST[3] , EXTRA_ITEM_MIN_PLAYERS[3] , EXTRA_ITEM_VIP[3] , EXTRA_ITEM_LIMIT_MAP_ID[3] , EXTRA_ITEM_LIMIT_ROUND_ID[3], EXTRA_ITEM_LIMIT_MAP_0[3], EXTRA_ITEM_LIMIT_ROUND_0[3], ZP_TEAM_HUMAN )
        gItem[4] = zp_register_extra_iteem("Balrog3" , EXTRA_ITEM_COST[4] , EXTRA_ITEM_MIN_PLAYERS[4] , EXTRA_ITEM_VIP[4] , EXTRA_ITEM_LIMIT_MAP_ID[4] , EXTRA_ITEM_LIMIT_ROUND_ID[4], EXTRA_ITEM_LIMIT_MAP_0[4], EXTRA_ITEM_LIMIT_ROUND_0[4], ZP_TEAM_HUMAN )
        gItem[5] = zp_register_extra_iteem("Balrog5" , EXTRA_ITEM_COST[5] , EXTRA_ITEM_MIN_PLAYERS[5] , EXTRA_ITEM_VIP[5] , EXTRA_ITEM_LIMIT_MAP_ID[5] , EXTRA_ITEM_LIMIT_ROUND_ID[5], EXTRA_ITEM_LIMIT_MAP_0[5], EXTRA_ITEM_LIMIT_ROUND_0[5], ZP_TEAM_HUMAN )
        gItem[6] = zp_register_extra_iteem("Skull3" , EXTRA_ITEM_COST[6] , EXTRA_ITEM_MIN_PLAYERS[6] , EXTRA_ITEM_VIP[6] , EXTRA_ITEM_LIMIT_MAP_ID[6] , EXTRA_ITEM_LIMIT_ROUND_ID[6], EXTRA_ITEM_LIMIT_MAP_0[6], EXTRA_ITEM_LIMIT_ROUND_0[6], ZP_TEAM_HUMAN )
        gItem[7] = zp_register_extra_iteem("Skull4" , EXTRA_ITEM_COST[7] , EXTRA_ITEM_MIN_PLAYERS[7] , EXTRA_ITEM_VIP[7] , EXTRA_ITEM_LIMIT_MAP_ID[7] , EXTRA_ITEM_LIMIT_ROUND_ID[7], EXTRA_ITEM_LIMIT_MAP_0[7], EXTRA_ITEM_LIMIT_ROUND_0[7], ZP_TEAM_HUMAN )
        gItem[8] = zp_register_extra_iteem("Janus7" , EXTRA_ITEM_COST[8] , EXTRA_ITEM_MIN_PLAYERS[8] , EXTRA_ITEM_VIP[8] , EXTRA_ITEM_LIMIT_MAP_ID[8] , EXTRA_ITEM_LIMIT_ROUND_ID[8], EXTRA_ITEM_LIMIT_MAP_0[8], EXTRA_ITEM_LIMIT_ROUND_0[8], ZP_TEAM_HUMAN )
        gItem[9] = zp_register_extra_iteem("AT4" , EXTRA_ITEM_COST[9] , EXTRA_ITEM_MIN_PLAYERS[9] , EXTRA_ITEM_VIP[9] , EXTRA_ITEM_LIMIT_MAP_ID[9] , EXTRA_ITEM_LIMIT_ROUND_ID[9], EXTRA_ITEM_LIMIT_MAP_0[9], EXTRA_ITEM_LIMIT_ROUND_0[9], ZP_TEAM_HUMAN )
        gItem[10] = zp_register_extra_iteem("Bow" , EXTRA_ITEM_COST[10] , EXTRA_ITEM_MIN_PLAYERS[10] , EXTRA_ITEM_VIP[10] , EXTRA_ITEM_LIMIT_MAP_ID[10] , EXTRA_ITEM_LIMIT_ROUND_ID[10], EXTRA_ITEM_LIMIT_MAP_0[10], EXTRA_ITEM_LIMIT_ROUND_0[10], ZP_TEAM_HUMAN )
        gItem[11] = zp_register_extra_iteem("CV80" , EXTRA_ITEM_COST[11] , EXTRA_ITEM_MIN_PLAYERS[11] , EXTRA_ITEM_VIP[11] , EXTRA_ITEM_LIMIT_MAP_ID[11] , EXTRA_ITEM_LIMIT_ROUND_ID[11], EXTRA_ITEM_LIMIT_MAP_0[11], EXTRA_ITEM_LIMIT_ROUND_0[11], ZP_TEAM_HUMAN )
        gItem[12] = zp_register_extra_iteem("G11" , EXTRA_ITEM_COST[12] , EXTRA_ITEM_MIN_PLAYERS[12] , EXTRA_ITEM_VIP[12] , EXTRA_ITEM_LIMIT_MAP_ID[12] , EXTRA_ITEM_LIMIT_ROUND_ID[12], EXTRA_ITEM_LIMIT_MAP_0[12], EXTRA_ITEM_LIMIT_ROUND_0[12], ZP_TEAM_HUMAN )
        gItem[13] = zp_register_extra_iteem("Spas12" , EXTRA_ITEM_COST[13] , EXTRA_ITEM_MIN_PLAYERS[13] , EXTRA_ITEM_VIP[13] , EXTRA_ITEM_LIMIT_MAP_ID[13] , EXTRA_ITEM_LIMIT_ROUND_ID[13], EXTRA_ITEM_LIMIT_MAP_0[13], EXTRA_ITEM_LIMIT_ROUND_0[13], ZP_TEAM_HUMAN )
        gItem[14] = zp_register_extra_iteem("TripleBarrel" , EXTRA_ITEM_COST[14] , EXTRA_ITEM_MIN_PLAYERS[14] , EXTRA_ITEM_VIP[14] , EXTRA_ITEM_LIMIT_MAP_ID[14] , EXTRA_ITEM_LIMIT_ROUND_ID[14], EXTRA_ITEM_LIMIT_MAP_0[14], EXTRA_ITEM_LIMIT_ROUND_0[14], ZP_TEAM_HUMAN )
        gItem[15] = zp_register_extra_iteem("M95" , EXTRA_ITEM_COST[15] , EXTRA_ITEM_MIN_PLAYERS[15] , EXTRA_ITEM_VIP[15] , EXTRA_ITEM_LIMIT_MAP_ID[15] , EXTRA_ITEM_LIMIT_ROUND_ID[15], EXTRA_ITEM_LIMIT_MAP_0[15], EXTRA_ITEM_LIMIT_ROUND_0[15], ZP_TEAM_HUMAN )
        gItem[16] = zp_register_extra_iteem("Spear" , EXTRA_ITEM_COST[16] , EXTRA_ITEM_MIN_PLAYERS[16] , EXTRA_ITEM_VIP[16] , EXTRA_ITEM_LIMIT_MAP_ID[16] , EXTRA_ITEM_LIMIT_ROUND_ID[16], EXTRA_ITEM_LIMIT_MAP_0[16], EXTRA_ITEM_LIMIT_ROUND_0[16], ZP_TEAM_HUMAN )
        gItem[17] = zp_register_extra_iteem("Cart Blue" , EXTRA_ITEM_COST[17] , EXTRA_ITEM_MIN_PLAYERS[17] , EXTRA_ITEM_VIP[17] , EXTRA_ITEM_LIMIT_MAP_ID[17] , EXTRA_ITEM_LIMIT_ROUND_ID[17], EXTRA_ITEM_LIMIT_MAP_0[17], EXTRA_ITEM_LIMIT_ROUND_0[17], ZP_TEAM_HUMAN )
        gItem[18] = zp_register_extra_iteem("ChainSaw" , EXTRA_ITEM_COST[18] , EXTRA_ITEM_MIN_PLAYERS[18] , EXTRA_ITEM_VIP[18] , EXTRA_ITEM_LIMIT_MAP_ID[18] , EXTRA_ITEM_LIMIT_ROUND_ID[18], EXTRA_ITEM_LIMIT_MAP_0[18], EXTRA_ITEM_LIMIT_ROUND_0[18], ZP_TEAM_HUMAN )
        gItem[19] = zp_register_extra_iteem("Bazooka" , EXTRA_ITEM_COST[19] , EXTRA_ITEM_MIN_PLAYERS[19] , EXTRA_ITEM_VIP[19] , EXTRA_ITEM_LIMIT_MAP_ID[19] , EXTRA_ITEM_LIMIT_ROUND_ID[19], EXTRA_ITEM_LIMIT_MAP_0[19], EXTRA_ITEM_LIMIT_ROUND_0[19], ZP_TEAM_HUMAN )
}

public zp_extra_item_selecteed( Player , Item )
{
        if( Item == gItem[0] ) GiveWeapon( Player , 1 ) ;
        if( Item == gItem[1] ) GiveWeapon( Player , 2 ) ;
        if( Item == gItem[2] ) GiveWeapon( Player , 3 ) ;
        if( Item == gItem[3] ) GiveWeapon( Player , 4 ) ;
        if( Item == gItem[4] ) GiveWeapon( Player , 5 ) ;
        if( Item == gItem[5] ) GiveWeapon( Player , 6 ) ;
        if( Item == gItem[6] ) GiveWeapon( Player , 7 ) ;
        if( Item == gItem[7] ) GiveWeapon( Player , 8 ) ;
        if( Item == gItem[8] ) GiveWeapon( Player , 9 ) ;
        if( Item == gItem[9] ) GiveWeapon( Player , 10 ) ;
        if( Item == gItem[10] ) GiveWeapon( Player , 11 ) ;
        if( Item == gItem[11] ) GiveWeapon( Player , 12 ) ;
        if( Item == gItem[12] ) GiveWeapon( Player , 13 ) ;
        if( Item == gItem[13] ) GiveWeapon( Player , 14 ) ;
        if( Item == gItem[14] ) GiveWeapon( Player , 15 ) ;
        if( Item == gItem[15] ) GiveWeapon( Player , 16 ) ;
        if( Item == gItem[16] ) GiveWeapon( Player , 17 ) ;
        if( Item == gItem[17] ) GiveWeapon( Player , 18 ) ;
        if( Item == gItem[18] ) GiveWeapon( Player , 19 ) ;
        if( Item == gItem[19] ) GiveWeapon( Player , 20 ) ;
}

public GiveWeapon( Player , Weapon )
{
        switch( Weapon )
        {
                case 1:        give_balrog11( Player ) ;
                case 2:        give_plasma( Player ) ;
                case 3:        give_infinity( Player ) ;
                case 4:        give_janus1( Player ) ;
                case 5:        give_balrog3( Player ) ;
                case 6:        give_balrog5( Player ) ;
                case 7:        give_skull3( Player ) ;
                case 8:        give_skull4( Player ) ;
                case 9:        give_janus7( Player ) ;
                case 10:        give_at4( Player ) ;
                case 11:        give_bow( Player ) ;
                case 12:        give_cv80( Player ) ;
                case 13:        give_g11( Player ) ;
                case 14:        give_spas12( Player ) ;
                case 15:        give_triplebarrel( Player ) ;
                case 16:        give_m95( Player ) ;
                case 17:        give_spear( Player ) ;
                case 18:        give_cartblue( Player ) ;
                case 19:        give_chainsaw( Player ) ;
                case 20:        give_bazooka(Player);
        }
}

The mess I made:
Code:

#include <amxmodx>
#include <fakemeta>
#include <zombieplaguenightmare>

#define VIP ADMIN_LEVEL_G

new Array:ItemName
new Array:ItemSort
new Array:ItemCost
new Array:ItemMinPlayers
new Array:ItemVip
new Array:ItemLimitInMapP
new Array:ItemLimitInRound
new Array:LimitForAllMap
new Array:LimitForAllRound
new Array:ItemTeam

new g_End, g_Item
new g_LimitInMap[33][512] , g_LimitInRound[33][512]
new g_LimitAllMap, g_LimitAllRound

public plugin_natives()
{
        register_native("zp_register_extra_iteem" , "native_register_extra_item" , 1)
        register_native("OpenWeaponMenu" , "WeaponMenu" , 1)
}

public plugin_init()
{
        register_clcmd( "say /buy","MainMenu")
        g_Item = CreateMultiForward("zp_extra_item_selecteed", ET_CONTINUE, FP_CELL, FP_CELL)
}

public plugin_precache()
{
        ItemName = ArrayCreate(64, 1)
        ItemSort = ArrayCreate(8, 1)
        ItemCost = ArrayCreate(32, 1)
        ItemMinPlayers = ArrayCreate(32, 1)
        ItemVip = ArrayCreate(32, 1)
        ItemLimitInMapP = ArrayCreate(32, 1)
        ItemLimitInRound = ArrayCreate(32, 1)
        LimitForAllMap = ArrayCreate(32, 1)
        LimitForAllRound = ArrayCreate(32, 1)
        ItemTeam =  ArrayCreate(32, 1)
}

public MainMenu(Player)
{
        new MenuMain = menu_create("Main Gun Menu", "menu_gun_handler")

        menu_additem(MenuMain, "Pistols", "", 0)
        menu_additem(MenuMain, "Shotguns", "", 0)

        menu_display(Player, MenuMain, 0)
}

public menu_gun_handler(Player, MenuMain, Item)
{
        if(!is_user_connected(Player) || !is_user_alive(Player))
        return PLUGIN_HANDLED
       
        if(zp_get_user_zombie(Player))
        return PLUGIN_HANDLED
       
        switch(Item)
        {
                case 0:
                {
                        PistolMenu(Player)
                }
                case 1:
                {
                        WeaponMenu(Player)
                }
        }
       
        if(Item == MENU_EXIT)
        {
                menu_destroy(MenuMain)
                return PLUGIN_HANDLED
        }
        return PLUGIN_HANDLED
}

public WeaponMenu(Player)
{
        if(!is_user_connected(Player) || !is_user_alive(Player))
        return PLUGIN_HANDLED
       
        if(!ArraySize(ItemName))
        {
                log_amx("[WeaponMenu] No extra items loaded (Name = 0)")
                return PLUGIN_HANDLED
        }
       
        new MenuWeapons
        MenuWeapons = menu_create("Weapon Buy Menu:" , "WeaponMenuHand")
        new Buffer[64] , Name[32]
        new Item, team
       
        menu_setprop(MenuWeapons, MPROP_NUMBER_COLOR, "\r");
       
        for(Item = 0; Item < ArraySize(ItemName); Item ++)
        {
                team = ArrayGetCell(ItemTeam, Item)
               
                if ((zp_get_user_zombie(Player) && !zp_get_user_nemesis(Player) && !zpnm_get_user_assassin(Player) && !(team & ZP_TEAM_ZOMBIE)) || (!zp_get_user_zombie(Player) && !zp_get_user_survivor(Player) && !zpnm_get_user_sniper(Player) && !(team & ZP_TEAM_HUMAN)) || (zp_get_user_nemesis(Player) || (zpnm_get_user_assassin(Player) && !(team & ZP_TEAM_NEMESIS)) && !(team & ZP_TEAM_ASSASSIN)) || (zp_get_user_survivor(Player) && !(team & ZP_TEAM_SURVIVOR)))
                        continue
               
                ArrayGetString(ItemName, Item, Name, charsmax(Name))
               
                if(zp_get_user_ammo_packs(Player) < ArrayGetCell(ItemCost, Item))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\dUnavailable\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(ItemMinPlayers, Item) && get_playersnum() < ArrayGetCell(ItemMinPlayers, Item))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rMin Players: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemMinPlayers, Item))
                }
                else if(ArrayGetCell(ItemVip, Item) && ArrayGetCell(ItemVip, Item) && !(get_user_flags(Player) & VIP))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rV.I.P Only\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) == g_LimitInMap[Player][Item])
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rMap Limit: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemLimitInMapP, Item))
                }
                else if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) == g_LimitInRound[Player][Item])
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rRound Limit: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemLimitInRound  , Item))
                }
                else if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) == g_LimitAllMap)
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) == g_LimitAllRound)
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else
                {
                        formatex(Buffer, charsmax(Buffer), "\w%s \y[%d$]", Name, ArrayGetCell(ItemCost, Item))
                }
                menu_additem(MenuWeapons , Buffer)
               
                menu_setprop(MenuWeapons, MPROP_NEXTNAME, "Next")
                menu_setprop(MenuWeapons, MPROP_BACKNAME, "Back")
                menu_setprop(MenuWeapons, MPROP_EXITNAME, "Exit")
        }
        if(pev_valid(Player) == 2) set_pdata_int(Player, 205, 0, 5)
        menu_display(Player, MenuWeapons, 0)
        return PLUGIN_HANDLED
}

public WeaponMenuHand(Player, MenuWeapons, Item)
{
        if(!is_user_connected(Player) || !is_user_alive(Player))
        return PLUGIN_HANDLED
       
        if(zp_get_user_zombie(Player))
        return PLUGIN_HANDLED
       
        if(Item == MENU_EXIT)
        {
                menu_destroy(MenuWeapons)
                return PLUGIN_HANDLED
        }
       
        new Cost = ArrayGetCell(ItemCost, Item)
       
        if(zp_get_user_ammo_packs(Player) < Cost)
        {
                client_print(Player, print_center, "Not enough money")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemMinPlayers, Item) && get_playersnum() < ArrayGetCell(ItemMinPlayers, Item))
        {
                client_print(Player, print_center, "Need more players")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemVip, Item) && ArrayGetCell(ItemVip, Item) && !(get_user_flags(Player) & VIP))
        {
                client_print(Player, print_center, "You need to be V.I.P")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) == g_LimitInMap[Player][Item])
        {
                client_print(Player, print_center, "Weapon map limit reached: [%d]" , ArrayGetCell(ItemLimitInMapP, Item))
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) == g_LimitInRound[Player][Item])
        {
                client_print(Player, print_center, "Weapon round limit reached: [%d]" , ArrayGetCell(ItemLimitInRound, Item))
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) == g_LimitAllMap)
        {
                client_print(Player, print_center, "This weapon will be available next map.")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) == g_LimitAllRound)
        {
                client_print(Player, print_center, "This item will be available next round.")
                return PLUGIN_HANDLED
        }
       
        if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) > g_LimitInMap[Item][Player])
                g_LimitInMap[Player][Item] ++
        if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) > g_LimitInRound[Item][Player])
                g_LimitInRound[Player][Item] ++
        if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) > g_LimitAllMap)
                g_LimitAllMap ++
        if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) > g_LimitAllRound)
                g_LimitAllRound ++
        ExecuteForward(g_Item, g_End, Player, Item)
        zp_set_user_ammo_packs(Player, zp_get_user_ammo_packs(Player) - Cost)
        return PLUGIN_HANDLED
}

public PistolMenu(Player)
{
        new PistolMenu
        PistolMenu = menu_create("Weapon Buy Menu:" , "menu_handler1")
        new Buffer[64] , Name[32]
        new Item, team
       
        menu_setprop(PistolMenu, MPROP_NUMBER_COLOR, "\r");
       
        for(Item = 0; Item < ArraySize(ItemName); Item ++)
        {
                team = ArrayGetCell(ItemTeam, Item)
               
                if ((zp_get_user_zombie(Player) && !zp_get_user_nemesis(Player) && !zpnm_get_user_assassin(Player) && !(team & ZP_TEAM_ZOMBIE)) || (!zp_get_user_zombie(Player) && !zp_get_user_survivor(Player) && !zpnm_get_user_sniper(Player) && !(team & ZP_TEAM_HUMAN)) || (zp_get_user_nemesis(Player) || (zpnm_get_user_assassin(Player) && !(team & ZP_TEAM_NEMESIS)) && !(team & ZP_TEAM_ASSASSIN)) || (zp_get_user_survivor(Player) && !(team & ZP_TEAM_SURVIVOR)))
                        continue
                       
                if (ArrayGetCell(ItemSort, Item) == 1)
                {
                ArrayGetString(ItemName, Item, Name, charsmax(Name))
               
                if(zp_get_user_ammo_packs(Player) < ArrayGetCell(ItemCost, Item))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\dUnavailable\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(ItemMinPlayers, Item) && get_playersnum() < ArrayGetCell(ItemMinPlayers, Item))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rMin Players: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemMinPlayers, Item))
                }
                else if(ArrayGetCell(ItemVip, Item) && ArrayGetCell(ItemVip, Item) && !(get_user_flags(Player) & VIP))
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rV.I.P Only\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) == g_LimitInMap[Player][Item])
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rMap Limit: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemLimitInMapP, Item))
                }
                else if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) == g_LimitInRound[Player][Item])
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rRound Limit: \y%d\w]", Name, ArrayGetCell(ItemCost, Item) , ArrayGetCell(ItemLimitInRound  , Item))
                }
                else if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) == g_LimitAllMap)
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) == g_LimitAllRound)
                {
                        formatex(Buffer, charsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]", Name, ArrayGetCell(ItemCost, Item))
                }
                else
                {
                        formatex(Buffer, charsmax(Buffer), "\w%s \y[%d$]", Name, ArrayGetCell(ItemCost, Item))
                }
                menu_additem(PistolMenu , Buffer)
               
                menu_setprop(PistolMenu, MPROP_NEXTNAME, "Next")
                menu_setprop(PistolMenu, MPROP_BACKNAME, "Back")
                menu_setprop(PistolMenu, MPROP_EXITNAME, "Exit")
                }
        }
        if(pev_valid(Player) == 2) set_pdata_int(Player, 205, 0, 5)
        menu_display(Player, PistolMenu, 0)
        return PLUGIN_HANDLED
}

public menu_handler1(Player, PistolMenu, Item)
{
        if(!is_user_connected(Player) || !is_user_alive(Player))
        return PLUGIN_HANDLED
       
        if(zp_get_user_zombie(Player))
        return PLUGIN_HANDLED
       
        if(Item == MENU_EXIT)
        {
                menu_destroy(PistolMenu)
                return PLUGIN_HANDLED
        }
       
        if (ArrayGetCell(ItemSort, Item) == 1)
        {
        new Cost = ArrayGetCell(ItemCost, Item)
       
        if(zp_get_user_ammo_packs(Player) < Cost)
        {
                client_print(Player, print_center, "Not enough money")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemMinPlayers, Item) && get_playersnum() < ArrayGetCell(ItemMinPlayers, Item))
        {
                client_print(Player, print_center, "Need more players")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemVip, Item) && ArrayGetCell(ItemVip, Item) && !(get_user_flags(Player) & VIP))
        {
                client_print(Player, print_center, "You need to be V.I.P")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) == g_LimitInMap[Player][Item])
        {
                client_print(Player, print_center, "Weapon map limit reached: [%d]" , ArrayGetCell(ItemLimitInMapP, Item))
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) == g_LimitInRound[Player][Item])
        {
                client_print(Player, print_center, "Weapon round limit reached: [%d]" , ArrayGetCell(ItemLimitInRound, Item))
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) == g_LimitAllMap)
        {
                client_print(Player, print_center, "This weapon will be available next map.")
                return PLUGIN_HANDLED
        }
        if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) == g_LimitAllRound)
        {
                client_print(Player, print_center, "This item will be available next round.")
                return PLUGIN_HANDLED
        }
       
        if(ArrayGetCell(ItemLimitInMapP, Item) && ArrayGetCell(ItemLimitInMapP, Item) > g_LimitInMap[Item][Player])
                g_LimitInMap[Player][Item] ++
        if(ArrayGetCell(ItemLimitInRound, Item) && ArrayGetCell(ItemLimitInRound, Item) > g_LimitInRound[Item][Player])
                g_LimitInRound[Player][Item] ++
        if(ArrayGetCell(LimitForAllMap, Item) && ArrayGetCell(LimitForAllMap, Item) > g_LimitAllMap)
                g_LimitAllMap ++
        if(ArrayGetCell(LimitForAllRound, Item) && ArrayGetCell(LimitForAllRound, Item) > g_LimitAllRound)
                g_LimitAllRound ++
        ExecuteForward(g_Item, g_End, Player, Item)
        zp_set_user_ammo_packs(Player, zp_get_user_ammo_packs(Player) - Cost)
        return PLUGIN_HANDLED
        }
        return PLUGIN_HANDLED
}

public zp_round_ended()
{
        g_LimitAllRound = false
       
        static Player, Itemid
       
        for (Player = 1; Player <= get_maxplayers(); Player++)
        {
                if(!is_user_connected(Player))
                        continue
               
                for (Itemid = 0; Itemid <= ArraySize(ItemName); Itemid++)
                {
                        g_LimitInRound[Player][Itemid] = 0
                }
        }
}

public native_register_extra_item(const Name[], Sort, Cost, MinPlayers, Vip, LimitInMap, LimitInRound, LimitAllMap, LimitAllRound, Team)
{
        param_convert(1)
       
        ArrayPushString(ItemName, Name)
        ArrayPushCell(ItemSort, Sort)
        ArrayPushCell(ItemCost, Cost)
        ArrayPushCell(ItemMinPlayers, MinPlayers)
        ArrayPushCell(ItemVip, Vip)
        ArrayPushCell(ItemLimitInMapP, LimitInMap)
        ArrayPushCell(ItemLimitInRound, LimitInRound)
        ArrayPushCell(LimitForAllMap, LimitAllMap)
        ArrayPushCell(LimitForAllRound, LimitAllRound)
        ArrayPushCell(ItemTeam, Team)
       
        return ArraySize(ItemName) - 1
}

Code:

#include < amxmodx >
#include < zombieplaguenightmare >

native zp_register_extra_iteem(const Name[], Sort, Cost, MinPlayers, Vip, LimitInMap, LimitInRound, LimitForAllMap, LimitForAllRound, Team)
forward zp_extra_item_selecteed(Player , Item)
/*==================================
        Pistols
==================================*/
native give_balrog1(Player)
native give_infinity(Player)
native give_janus1(Player)
//native give_gunslinger(Player)

/*==================================
        Shotguns
==================================*/
native give_spas12(Player)
native give_triplebarrel(Player)
native give_balrog11(Player) // Admin

/*==================================
        Automated Rifles
==================================*/
native give_g11(Player)
native give_cv80(Player)
native give_balrog3(Player)
native give_balrog5(Player)
native give_cartblue(Player)
native give_skull3(Player)
native give_skull4(Player)
native give_plasma(Player) //Admin

/*==================================
        Sniper Rifles
==================================*/
native give_bow(Player)
native give_m95(Player)

/*==================================
        Heavy Machiene Guns
==================================*/
native give_janus7(Player)

/*==================================
        Extra Equipment
==================================*/
native give_at4(Player)
native give_spear(Player)
native give_chainsaw(Player)
native give_bazooka(Player)

/*==================================
        Settings
==================================*/

new const EXTRA_ITEM_SORT[] =                        { 2        , 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0, 1 } ;
new const EXTRA_ITEM_COST[] =                        { 20000, 10000, 800, 1000, 1500, 3000,  15000, 10000, 50000, 30000, 5000, 3200, 2000, 1700, 2200, 7000, 6500, 10000, 50000, 1000, 1000}
new const EXTRA_ITEM_MIN_PLAYERS[] =        { 0        , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2, 0, 0 } ;
new const EXTRA_ITEM_VIP[] =                        { 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 1, 1 } ;
new const EXTRA_ITEM_LIMIT_MAP_ID[] =        { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0, 0 } ;
new const EXTRA_ITEM_LIMIT_ROUND_ID[] =        { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2, 0, 0 } ;
new const EXTRA_ITEM_LIMIT_MAP_0[] =        { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0, 0 } ;
new const EXTRA_ITEM_LIMIT_ROUND_0[] =        { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0, 0 } ;

new gItem[22] ;

/*============================================================================================================================================================
 Syntaxis (Name | Cost | Min Players | VIP Only | Personal Limit Map | Personal Limit Round | Global Limit Map | Global Round Limit | ZP_TEAM_HUMAN or ZOMBIE)
 Example: gItem[1234] = zp_register_extra_iteem("AK-47", 2750, 0, 0, 0, 0, 0, 0, ZP_TEAM_HUMAN)
============================================================================================================================================================*/
public plugin_init()
{
        gItem[0] = zp_register_extra_iteem("Balrog11" , EXTRA_ITEM_SORT[0], EXTRA_ITEM_COST[0] , EXTRA_ITEM_MIN_PLAYERS[0] , EXTRA_ITEM_VIP[0] , EXTRA_ITEM_LIMIT_MAP_ID[0] , EXTRA_ITEM_LIMIT_ROUND_ID[0], EXTRA_ITEM_LIMIT_MAP_0[0], EXTRA_ITEM_LIMIT_ROUND_0[0], ZP_TEAM_HUMAN )
        gItem[1] = zp_register_extra_iteem("PlasmaGun" , EXTRA_ITEM_SORT[1], EXTRA_ITEM_COST[1] , EXTRA_ITEM_MIN_PLAYERS[1] , EXTRA_ITEM_VIP[1] , EXTRA_ITEM_LIMIT_MAP_ID[1] , EXTRA_ITEM_LIMIT_ROUND_ID[1], EXTRA_ITEM_LIMIT_MAP_0[1], EXTRA_ITEM_LIMIT_ROUND_0[1], ZP_TEAM_HUMAN )
        gItem[2] = zp_register_extra_iteem("Dual Infinity" , EXTRA_ITEM_SORT[2], EXTRA_ITEM_COST[2] , EXTRA_ITEM_MIN_PLAYERS[2] , EXTRA_ITEM_VIP[2] , EXTRA_ITEM_LIMIT_MAP_ID[2] , EXTRA_ITEM_LIMIT_ROUND_ID[2], EXTRA_ITEM_LIMIT_MAP_0[2], EXTRA_ITEM_LIMIT_ROUND_0[2], ZP_TEAM_HUMAN )
        gItem[3] = zp_register_extra_iteem("Janus1" , EXTRA_ITEM_SORT[3], EXTRA_ITEM_COST[3] , EXTRA_ITEM_MIN_PLAYERS[3] , EXTRA_ITEM_VIP[3] , EXTRA_ITEM_LIMIT_MAP_ID[3] , EXTRA_ITEM_LIMIT_ROUND_ID[3], EXTRA_ITEM_LIMIT_MAP_0[3], EXTRA_ITEM_LIMIT_ROUND_0[3], ZP_TEAM_HUMAN )
        gItem[4] = zp_register_extra_iteem("Balrog3" , EXTRA_ITEM_SORT[4], EXTRA_ITEM_COST[4] , EXTRA_ITEM_MIN_PLAYERS[4] , EXTRA_ITEM_VIP[4] , EXTRA_ITEM_LIMIT_MAP_ID[4] , EXTRA_ITEM_LIMIT_ROUND_ID[4], EXTRA_ITEM_LIMIT_MAP_0[4], EXTRA_ITEM_LIMIT_ROUND_0[4], ZP_TEAM_HUMAN )
        gItem[5] = zp_register_extra_iteem("Balrog5" , EXTRA_ITEM_SORT[5], EXTRA_ITEM_COST[5] , EXTRA_ITEM_MIN_PLAYERS[5] , EXTRA_ITEM_VIP[5] , EXTRA_ITEM_LIMIT_MAP_ID[5] , EXTRA_ITEM_LIMIT_ROUND_ID[5], EXTRA_ITEM_LIMIT_MAP_0[5], EXTRA_ITEM_LIMIT_ROUND_0[5], ZP_TEAM_HUMAN )
        gItem[6] = zp_register_extra_iteem("Skull3" , EXTRA_ITEM_SORT[6], EXTRA_ITEM_COST[6] , EXTRA_ITEM_MIN_PLAYERS[6] , EXTRA_ITEM_VIP[6] , EXTRA_ITEM_LIMIT_MAP_ID[6] , EXTRA_ITEM_LIMIT_ROUND_ID[6], EXTRA_ITEM_LIMIT_MAP_0[6], EXTRA_ITEM_LIMIT_ROUND_0[6], ZP_TEAM_HUMAN )
        gItem[7] = zp_register_extra_iteem("Skull4" , EXTRA_ITEM_SORT[7], EXTRA_ITEM_COST[7] , EXTRA_ITEM_MIN_PLAYERS[7] , EXTRA_ITEM_VIP[7] , EXTRA_ITEM_LIMIT_MAP_ID[7] , EXTRA_ITEM_LIMIT_ROUND_ID[7], EXTRA_ITEM_LIMIT_MAP_0[7], EXTRA_ITEM_LIMIT_ROUND_0[7], ZP_TEAM_HUMAN )
        gItem[8] = zp_register_extra_iteem("Janus7" , EXTRA_ITEM_SORT[8], EXTRA_ITEM_COST[8] , EXTRA_ITEM_MIN_PLAYERS[8] , EXTRA_ITEM_VIP[8] , EXTRA_ITEM_LIMIT_MAP_ID[8] , EXTRA_ITEM_LIMIT_ROUND_ID[8], EXTRA_ITEM_LIMIT_MAP_0[8], EXTRA_ITEM_LIMIT_ROUND_0[8], ZP_TEAM_HUMAN )
        gItem[9] = zp_register_extra_iteem("AT4" , EXTRA_ITEM_SORT[9], EXTRA_ITEM_COST[9] , EXTRA_ITEM_MIN_PLAYERS[9] , EXTRA_ITEM_VIP[9] , EXTRA_ITEM_LIMIT_MAP_ID[9] , EXTRA_ITEM_LIMIT_ROUND_ID[9], EXTRA_ITEM_LIMIT_MAP_0[9], EXTRA_ITEM_LIMIT_ROUND_0[9], ZP_TEAM_HUMAN )
        gItem[10] = zp_register_extra_iteem("Bow" , EXTRA_ITEM_SORT[10], EXTRA_ITEM_COST[10] , EXTRA_ITEM_MIN_PLAYERS[10] , EXTRA_ITEM_VIP[10] , EXTRA_ITEM_LIMIT_MAP_ID[10] , EXTRA_ITEM_LIMIT_ROUND_ID[10], EXTRA_ITEM_LIMIT_MAP_0[10], EXTRA_ITEM_LIMIT_ROUND_0[10], ZP_TEAM_HUMAN )
        gItem[11] = zp_register_extra_iteem("CV80" , EXTRA_ITEM_SORT[11],EXTRA_ITEM_COST[11] , EXTRA_ITEM_MIN_PLAYERS[11] , EXTRA_ITEM_VIP[11] , EXTRA_ITEM_LIMIT_MAP_ID[11] , EXTRA_ITEM_LIMIT_ROUND_ID[11], EXTRA_ITEM_LIMIT_MAP_0[11], EXTRA_ITEM_LIMIT_ROUND_0[11], ZP_TEAM_HUMAN )
        gItem[12] = zp_register_extra_iteem("G11" , EXTRA_ITEM_SORT[12],EXTRA_ITEM_COST[12] , EXTRA_ITEM_MIN_PLAYERS[12] , EXTRA_ITEM_VIP[12] , EXTRA_ITEM_LIMIT_MAP_ID[12] , EXTRA_ITEM_LIMIT_ROUND_ID[12], EXTRA_ITEM_LIMIT_MAP_0[12], EXTRA_ITEM_LIMIT_ROUND_0[12], ZP_TEAM_HUMAN )
        gItem[13] = zp_register_extra_iteem("Spas12" , EXTRA_ITEM_SORT[13], EXTRA_ITEM_COST[13] , EXTRA_ITEM_MIN_PLAYERS[13] , EXTRA_ITEM_VIP[13] , EXTRA_ITEM_LIMIT_MAP_ID[13] , EXTRA_ITEM_LIMIT_ROUND_ID[13], EXTRA_ITEM_LIMIT_MAP_0[13], EXTRA_ITEM_LIMIT_ROUND_0[13], ZP_TEAM_HUMAN )
        gItem[14] = zp_register_extra_iteem("TripleBarrel" , EXTRA_ITEM_SORT[14], EXTRA_ITEM_COST[14] , EXTRA_ITEM_MIN_PLAYERS[14] , EXTRA_ITEM_VIP[14] , EXTRA_ITEM_LIMIT_MAP_ID[14] , EXTRA_ITEM_LIMIT_ROUND_ID[14], EXTRA_ITEM_LIMIT_MAP_0[14], EXTRA_ITEM_LIMIT_ROUND_0[14], ZP_TEAM_HUMAN )
        gItem[15] = zp_register_extra_iteem("M95" , EXTRA_ITEM_SORT[15], EXTRA_ITEM_COST[15] , EXTRA_ITEM_MIN_PLAYERS[15] , EXTRA_ITEM_VIP[15] , EXTRA_ITEM_LIMIT_MAP_ID[15] , EXTRA_ITEM_LIMIT_ROUND_ID[15], EXTRA_ITEM_LIMIT_MAP_0[15], EXTRA_ITEM_LIMIT_ROUND_0[15], ZP_TEAM_HUMAN )
        gItem[16] = zp_register_extra_iteem("Spear" , EXTRA_ITEM_SORT[16],EXTRA_ITEM_COST[16] , EXTRA_ITEM_MIN_PLAYERS[16] , EXTRA_ITEM_VIP[16] , EXTRA_ITEM_LIMIT_MAP_ID[16] , EXTRA_ITEM_LIMIT_ROUND_ID[16], EXTRA_ITEM_LIMIT_MAP_0[16], EXTRA_ITEM_LIMIT_ROUND_0[16], ZP_TEAM_HUMAN )
        gItem[17] = zp_register_extra_iteem("Cart Blue" , EXTRA_ITEM_SORT[17],EXTRA_ITEM_COST[17] , EXTRA_ITEM_MIN_PLAYERS[17] , EXTRA_ITEM_VIP[17] , EXTRA_ITEM_LIMIT_MAP_ID[17] , EXTRA_ITEM_LIMIT_ROUND_ID[17], EXTRA_ITEM_LIMIT_MAP_0[17], EXTRA_ITEM_LIMIT_ROUND_0[17], ZP_TEAM_HUMAN )
        gItem[18] = zp_register_extra_iteem("ChainSaw" , EXTRA_ITEM_SORT[18],EXTRA_ITEM_COST[18] , EXTRA_ITEM_MIN_PLAYERS[18] , EXTRA_ITEM_VIP[18] , EXTRA_ITEM_LIMIT_MAP_ID[18] , EXTRA_ITEM_LIMIT_ROUND_ID[18], EXTRA_ITEM_LIMIT_MAP_0[18], EXTRA_ITEM_LIMIT_ROUND_0[18], ZP_TEAM_HUMAN )
        gItem[19] = zp_register_extra_iteem("Bazooka" , EXTRA_ITEM_SORT[19], EXTRA_ITEM_COST[19] , EXTRA_ITEM_MIN_PLAYERS[19] , EXTRA_ITEM_VIP[19] , EXTRA_ITEM_LIMIT_MAP_ID[19] , EXTRA_ITEM_LIMIT_ROUND_ID[19], EXTRA_ITEM_LIMIT_MAP_0[19], EXTRA_ITEM_LIMIT_ROUND_0[19], ZP_TEAM_HUMAN )
        gItem[20] = zp_register_extra_iteem("Balrog-I" , EXTRA_ITEM_SORT[20], EXTRA_ITEM_COST[20] , EXTRA_ITEM_MIN_PLAYERS[20] , EXTRA_ITEM_VIP[20] , EXTRA_ITEM_LIMIT_MAP_ID[20] , EXTRA_ITEM_LIMIT_ROUND_ID[20], EXTRA_ITEM_LIMIT_MAP_0[20], EXTRA_ITEM_LIMIT_ROUND_0[20], ZP_TEAM_HUMAN )
}

public zp_extra_item_selecteed( Player , Item )
{
        if( Item == gItem[0] ) GiveWeapon( Player , 1 ) ;
        if( Item == gItem[1] ) GiveWeapon( Player , 2 ) ;
        if( Item == gItem[2] ) GiveWeapon( Player , 3 ) ;
        if( Item == gItem[3] ) GiveWeapon( Player , 4 ) ;
        if( Item == gItem[4] ) GiveWeapon( Player , 5 ) ;
        if( Item == gItem[5] ) GiveWeapon( Player , 6 ) ;
        if( Item == gItem[6] ) GiveWeapon( Player , 7 ) ;
        if( Item == gItem[7] ) GiveWeapon( Player , 8 ) ;
        if( Item == gItem[8] ) GiveWeapon( Player , 9 ) ;
        if( Item == gItem[9] ) GiveWeapon( Player , 10 ) ;
        if( Item == gItem[10] ) GiveWeapon( Player , 11 ) ;
        if( Item == gItem[11] ) GiveWeapon( Player , 12 ) ;
        if( Item == gItem[12] ) GiveWeapon( Player , 13 ) ;
        if( Item == gItem[13] ) GiveWeapon( Player , 14 ) ;
        if( Item == gItem[14] ) GiveWeapon( Player , 15 ) ;
        if( Item == gItem[15] ) GiveWeapon( Player , 16 ) ;
        if( Item == gItem[16] ) GiveWeapon( Player , 17 ) ;
        if( Item == gItem[17] ) GiveWeapon( Player , 18 ) ;
        if( Item == gItem[18] ) GiveWeapon( Player , 19 ) ;
        if( Item == gItem[19] ) GiveWeapon( Player , 20 ) ;
        if( Item == gItem[20] ) GiveWeapon( Player , 21 ) ;
}

public GiveWeapon( Player , Weapon )
{
        switch( Weapon )
        {
                case 1:        give_balrog11( Player ) ;
                case 2:        give_plasma( Player ) ;
                case 3:        give_infinity( Player ) ;
                case 4:        give_janus1( Player ) ;
                case 5:        give_balrog3( Player ) ;
                case 6:        give_balrog5( Player ) ;
                case 7:        give_skull3( Player ) ;
                case 8:        give_skull4( Player ) ;
                case 9:        give_janus7( Player ) ;
                case 10:        give_at4( Player ) ;
                case 11:        give_bow( Player ) ;
                case 12:        give_cv80( Player ) ;
                case 13:        give_g11( Player ) ;
                case 14:        give_spas12( Player ) ;
                case 15:        give_triplebarrel( Player ) ;
                case 16:        give_m95( Player ) ;
                case 17:        give_spear( Player ) ;
                case 18:        give_cartblue( Player ) ;
                case 19:        give_chainsaw( Player ) ;
                case 20:        give_bazooka(Player);
                case 21:        give_balrog1(Player);
        }
}


YankoNL 06-06-2021 18:51

Re: [Help] Custom Buy Menu separate to categories
 
Can someone please help? Or just tell me how can I do it and I will try, please.

Supremache 06-06-2021 20:50

Re: [Help] Custom Buy Menu separate to categories
 
I tried to optimizing original codes:
Spoiler


Example:
PHP Code:

new g_iItem[3]

public 
plugin_init()
{     
    
g_iItem[0] = zp_register_extra_iteem("Pistols Shop"00000000)
    
g_iItem[1] = zp_register_extra_iteem("Shotguns Shop"00000000)
    
g_iItem[2] = zp_register_extra_iteem("Snipers Shop"00000000)
}

public 
zp_extra_item_selecteedid Item )
{
    if( 
Item == g_iItem[0] )
        
PistolsMenu(id)
        
    if( 
Item == g_iItem[1] )
        
ShotgunsMenu(id)
        
    if( 
Item == g_iItem[2] )
        
SnipersMenu(id)
}

public 
PistolsMenu(id)
{
    
// Great the menu
}

public 
ShotgunsMenu(id)
{
    
// Great the menu
}

public 
SnipersMenu(id)
{
    
// Great the menu



YankoNL 06-07-2021 03:20

Re: [Help] Custom Buy Menu separate to categories
 
Quote:

Originally Posted by Supremache (Post 2749087)
I tried to optimizing original codes:
Spoiler


Example:
PHP Code:

new g_iItem[3]

public 
plugin_init()
{     
    
g_iItem[0] = zp_register_extra_iteem("Pistols Shop"00000000)
    
g_iItem[1] = zp_register_extra_iteem("Shotguns Shop"00000000)
    
g_iItem[2] = zp_register_extra_iteem("Snipers Shop"00000000)
}

public 
zp_extra_item_selecteedid Item )
{
    if( 
Item == g_iItem[0] )
        
PistolsMenu(id)
        
    if( 
Item == g_iItem[1] )
        
ShotgunsMenu(id)
        
    if( 
Item == g_iItem[2] )
        
SnipersMenu(id)
}

public 
PistolsMenu(id)
{
    
// Great the menu
}

public 
ShotgunsMenu(id)
{
    
// Great the menu
}

public 
SnipersMenu(id)
{
    
// Great the menu



Thank you so much you legend! Thank you for the optimization. I just want to ask about the menu, how should I put the items in them?
Like this?
PHP Code:

public PistolsMenu(id)
{
    new 
PMenu
    PMenu 
menu_create("Choose your pistol" "WeaponMenuHand")
    new 
Buffer[64] , Name[32]
    new 
Itemteam
    
    menu_setprop
(PMenuMPROP_NUMBER_COLOR"\r");
    
    for(
Item 0Item ArraySize(ItemName); Item ++)
    {
        
team ArrayGetCell(ItemTeamItem)
        
        if ((
zp_get_user_zombie(Player) && !zp_get_user_nemesis(Player) && !zpnm_get_user_assassin(Player) && !(team ZP_TEAM_ZOMBIE)) || (!zp_get_user_zombie(Player) && !zp_get_user_survivor(Player) && !zpnm_get_user_sniper(Player) && !(team ZP_TEAM_HUMAN)) || (zp_get_user_nemesis(Player) || (zpnm_get_user_assassin(Player) && !(team ZP_TEAM_NEMESIS)) && !(team ZP_TEAM_ASSASSIN)) || (zp_get_user_survivor(Player) && !(team ZP_TEAM_SURVIVOR)))
            continue
        
        
ArrayGetString(ItemNameItemNamecharsmax(Name))
        
        if(
zp_get_user_ammo_packs(Player) < ArrayGetCell(ItemCostItem))
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\dUnavailable\w]"NameArrayGetCell(ItemCostItem))
        }
        else if(
ArrayGetCell(ItemMinPlayersItem) && get_playersnum() < ArrayGetCell(ItemMinPlayersItem))
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rMin Players: \y%d\w]"NameArrayGetCell(ItemCostItem) , ArrayGetCell(ItemMinPlayersItem))
        }
        else if(
ArrayGetCell(ItemVipItem) && ArrayGetCell(ItemVipItem) && !(get_user_flags(Player) & VIP))
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rV.I.P Only\w]"NameArrayGetCell(ItemCostItem))
        }
        else if(
ArrayGetCell(ItemLimitInMapPItem) && ArrayGetCell(ItemLimitInMapPItem) == g_LimitInMap[Player][Item])
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rMap Limit: \y%d\w]"NameArrayGetCell(ItemCostItem) , ArrayGetCell(ItemLimitInMapPItem))
        }
        else if(
ArrayGetCell(ItemLimitInRoundItem) && ArrayGetCell(ItemLimitInRoundItem) == g_LimitInRound[Player][Item])
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rRound Limit: \y%d\w]"NameArrayGetCell(ItemCostItem) , ArrayGetCell(ItemLimitInRound  Item))
        }
        else if(
ArrayGetCell(LimitForAllMapItem) && ArrayGetCell(LimitForAllMapItem) == g_LimitAllMap)
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]"NameArrayGetCell(ItemCostItem))
        }
        else if(
ArrayGetCell(LimitForAllRoundItem) && ArrayGetCell(LimitForAllRoundItem) == g_LimitAllRound)
        {
            
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]"NameArrayGetCell(ItemCostItem))
        }
        else
        {
            
formatex(Buffercharsmax(Buffer), "\w%s \y[%d$]"NameArrayGetCell(ItemCostItem))
        }
        
menu_additem(PMenu Buffer)
        
        
menu_setprop(PMenuMPROP_NEXTNAME"Next")
        
menu_setprop(PMenuMPROP_BACKNAME"Back")
        
menu_setprop(PMenuMPROP_EXITNAME"Exit")
    }
    if (
pev_valid(Player) == 2set_pdata_int(Player20505)
    
menu_display(PlayerPMenu0)
    return 
PLUGIN_HANDLED
}

public 
PMenuHand(PlayerMenuItem)
{
    if(!
is_user_connected(Player) || !is_user_alive(Player))
    return 
PLUGIN_HANDLED
    
    
if(zp_get_user_zombie(Player))
    return 
PLUGIN_HANDLED
    
    
if(Item == MENU_EXIT
    {
        
menu_destroy(PMenu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
Cost ArrayGetCell(ItemCostItem)
    
    if(
zp_get_user_ammo_packs(Player) < Cost)
    {
        
client_print(Playerprint_center"Not enough money")
        return 
PLUGIN_HANDLED
    
}
    if(
ArrayGetCell(ItemMinPlayersItem) && get_playersnum() < ArrayGetCell(ItemMinPlayersItem))
    {
        
client_print(Playerprint_center"Need more players")
        return 
PLUGIN_HANDLED
    
}
    if(
ArrayGetCell(ItemVipItem) && ArrayGetCell(ItemVipItem) && !(get_user_flags(Player) & VIP))
    {
        
client_print(Playerprint_center"You need to be V.I.P")
        return 
PLUGIN_HANDLED
    
}
    if(
ArrayGetCell(ItemLimitInMapPItem) && ArrayGetCell(ItemLimitInMapPItem) == g_LimitInMap[Player][Item])
    {
        
client_print(Playerprint_center"Weapon map limit reached: [%d]" ArrayGetCell(ItemLimitInMapPItem))
        return 
PLUGIN_HANDLED
    
}
    if(
ArrayGetCell(ItemLimitInRoundItem) && ArrayGetCell(ItemLimitInRoundItem) == g_LimitInRound[Player][Item])
    {
        
client_print(Playerprint_center"Weapon round limit reached: [%d]" ArrayGetCell(ItemLimitInRoundItem))
        return 
PLUGIN_HANDLED
    
}
    if(
ArrayGetCell(LimitForAllMapItem) && ArrayGetCell(LimitForAllMapItem) == g_LimitAllMap)
    {
        
client_print(Playerprint_center"This weapon will be available next map.")
        return 
PLUGIN_HANDLED
    
}
    if(
ArrayGetCell(LimitForAllRoundItem) && ArrayGetCell(LimitForAllRoundItem) == g_LimitAllRound)
    {
        
client_print(Playerprint_center"This item will be available next round.")
        return 
PLUGIN_HANDLED
    
}
    
    if(
ArrayGetCell(ItemLimitInMapPItem) && ArrayGetCell(ItemLimitInMapPItem) > g_LimitInMap[Item][Player])
        
g_LimitInMap[Player][Item] ++
    if(
ArrayGetCell(ItemLimitInRoundItem) && ArrayGetCell(ItemLimitInRoundItem) > g_LimitInRound[Item][Player])
        
g_LimitInRound[Player][Item] ++
    if(
ArrayGetCell(LimitForAllMapItem) && ArrayGetCell(LimitForAllMapItem) > g_LimitAllMap)
        
g_LimitAllMap ++
    if(
ArrayGetCell(LimitForAllRoundItem) && ArrayGetCell(LimitForAllRoundItem) > g_LimitAllRound)
        
g_LimitAllRound ++
    
ExecuteForward(g_Itemg_EndPlayerItem)
    
zp_set_user_ammo_packs(Playerzp_get_user_ammo_packs(Player) - Cost)
    return 
PLUGIN_HANDLED


And if I do it like this all items will get displayed in pistol menu

Supremache 06-07-2021 07:25

Re: [Help] Custom Buy Menu separate to categories
 
Quote:

Originally Posted by YankoNL (Post 2749118)
Thank you so much you legend! Thank you for the optimization. I just want to ask about the menu, how should I put the items in them?
And if I do it like this all items will get displayed in pistol menu

There are three ways to do that:
1. Add hard codded to the menu after adding array by switching the items and check if there are hard coded items founded
Ex:
PHP Code:

enum _:ItemsHardCodded {
    
Pistols,
};


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Load up the hard coded extra items
    
native_zp_register_item_pistol("Pistol 1"1001000020)
    
native_zp_register_item_pistol("Pistol 2"500000000)

}

public 
PistolsMenu(id)
{
    new 
PMenu
    PMenu 
menu_create("Choose your pistol" "WeaponMenuHand")
    new 
Buffer[64] , Name[32]
    new 
Itemteam
    
    menu_setprop
(PMenuMPROP_NUMBER_COLOR"\r");
    
    for(
Item 0Item ArraySize(ItemName); Item ++)
    {
        
team ArrayGetCell(ItemTeamItem)
        
        if ((
zp_get_user_zombie(Player) && !zp_get_user_nemesis(Player) && !zpnm_get_user_assassin(Player) && !(team ZP_TEAM_ZOMBIE)) || (!zp_get_user_zombie(Player) && !zp_get_user_survivor(Player) && !zpnm_get_user_sniper(Player) && !(team ZP_TEAM_HUMAN)) || (zp_get_user_nemesis(Player) || (zpnm_get_user_assassin(Player) && !(team ZP_TEAM_NEMESIS)) && !(team ZP_TEAM_ASSASSIN)) || (zp_get_user_survivor(Player) && !(team ZP_TEAM_SURVIVOR)))
            continue
        
        
ArrayGetString(ItemNameItemNamecharsmax(Name))
        
        switch (
Item)
        {
            case 
Pistols:
            {     
// Vip Only
                
if(get_user_flags(Player) & VIP)
                    
formatex(Buffercharsmax(Buffer), "Pistol 1")
            }
            default:
            {
                if(
zp_get_user_ammo_packs(Player) < ArrayGetCell(ItemCostItem))
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\dUnavailable\w]"NameArrayGetCell(ItemCostItem))
                }
                else if(
ArrayGetCell(ItemMinPlayersItem) && get_playersnum() < ArrayGetCell(ItemMinPlayersItem))
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rMin Players: \y%d\w]"NameArrayGetCell(ItemCostItem) , ArrayGetCell(ItemMinPlayersItem))
                }
                else if(
ArrayGetCell(ItemVipItem) && ArrayGetCell(ItemVipItem) && !(get_user_flags(Player) & VIP))
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rV.I.P Only\w]"NameArrayGetCell(ItemCostItem))
                }
                else if(
ArrayGetCell(ItemLimitInMapPItem) && ArrayGetCell(ItemLimitInMapPItem) == g_LimitInMap[Player][Item])
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rMap Limit: \y%d\w]"NameArrayGetCell(ItemCostItem) , ArrayGetCell(ItemLimitInMapPItem))
                }
                else if(
ArrayGetCell(ItemLimitInRoundItem) && ArrayGetCell(ItemLimitInRoundItem) == g_LimitInRound[Player][Item])
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rRound Limit: \y%d\w]"NameArrayGetCell(ItemCostItem) , ArrayGetCell(ItemLimitInRound  Item))
                }
                else if(
ArrayGetCell(LimitForAllMapItem) && ArrayGetCell(LimitForAllMapItem) == g_LimitAllMap)
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]"NameArrayGetCell(ItemCostItem))
                }
                else if(
ArrayGetCell(LimitForAllRoundItem) && ArrayGetCell(LimitForAllRoundItem) == g_LimitAllRound)
                {
                    
formatex(Buffercharsmax(Buffer), "\d%s %d$ \w[\rOut of Stock\w]"NameArrayGetCell(ItemCostItem))
                }
                else
                {
                    
formatex(Buffercharsmax(Buffer), "\w%s \y[%d$]"NameArrayGetCell(ItemCostItem))
                }
            }
        }
        
menu_additem(PMenu Buffer)
        
        
menu_setprop(PMenuMPROP_NEXTNAME"Next")
        
menu_setprop(PMenuMPROP_BACKNAME"Back")
        
menu_setprop(PMenuMPROP_EXITNAME"Exit")
    }
    if (
pev_valid(Player) == 2set_pdata_int(Player20505)
    
menu_display(PlayerPMenu0)
    return 
PLUGIN_HANDLED


And do the samething in menu_handler

2. Remove array and make the menu like normal
3. if you make the menu with array then you have to make natives for extra_pristols, extra_weapons, extra_snipers

YankoNL 06-07-2021 07:36

Re: [Help] Custom Buy Menu separate to categories
 
Hard coding will be difficult for editing and adding new weapons, with natives sounds good but I need to figure out how to do that.

Supremache 06-07-2021 07:40

Re: [Help] Custom Buy Menu separate to categories
 
Quote:

Originally Posted by YankoNL (Post 2749133)
Hard coding will be difficult for editing and adding new weapons, with natives sounds good but I need to figure out how to do that.

What i mean about hard codding is making the default weapons with the original menu EXAMPLE


All times are GMT -4. The time now is 02:33.

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