[ZP40/ZP50] Make Knife Menu Appear After buying Weapons!
May 27, 2017 12:12:16 GMT
zmd94, $h@DoW, and 3 more like this
Post by $h@DoW on May 27, 2017 12:12:16 GMT
In this Tutorial I will show You how to make Knife menu which will automatically appear after buying primary and secondary weapons.
ZP 4.3
Open zombie_plague40.sma
Find this Line
Change this Too :-
ZP 5.0
Open zp50_buy_menu.sma
Find this Line
Change this Too :-
And u are done! Just then compile zombie_plague40.sma If u are using ZP 4.3 or Compile zp50_buy_menu.sma If u are using ZP 5.0
Note :- Please check your zp_knife_menu.sma that your knife menu command is /knife if it is not /knife then change it to this!
Hope this Will be HelpFul!
Any Questions Or Problems ? Ask in comment Section!
ZP 4.3
Open zombie_plague40.sma
Find this Line
// Buy Menu 2
public menu_buy2(id, key)
{
// Player dead?
if (!g_isalive[id])
return PLUGIN_HANDLED;
// Zombies or survivors get no guns
if (g_zombie[id] || g_survivor[id] || g_sniper[id])
return PLUGIN_HANDLED;
// Special keys / weapon list exceeded
if (key >= ArraySize(g_secondary_items))
{
// Toggle autoselect
if (key == MENU_KEY_AUTOSELECT)
WPN_AUTO_ON = 1 - WPN_AUTO_ON
// Reshow menu unless user exited
if (key != MENU_KEY_EXIT)
show_menu_buy2(id)
return PLUGIN_HANDLED;
}
// Store selected weapon
WPN_AUTO_SEC = key
// Drop secondary gun again, in case we picked another (bugfix)
drop_weapons(id, 2)
// Get weapon's id
static weaponid, wname[32]
weaponid = ArrayGetCell(g_secondary_weaponids, key)
ArrayGetString(g_secondary_items, key, wname, charsmax(wname))
// Give the new weapon and full ammo
fm_give_item(id, wname)
ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
return PLUGIN_HANDLED;
}
Change this Too :-
// Buy Menu 2
public menu_buy2(id, key)
{
// Player dead?
if (!g_isalive[id])
return PLUGIN_HANDLED;
// Zombies or survivors get no guns
if (g_zombie[id] || g_survivor[id] || g_sniper[id])
return PLUGIN_HANDLED;
// Special keys / weapon list exceeded
if (key >= ArraySize(g_secondary_items))
{
// Toggle autoselect
if (key == MENU_KEY_AUTOSELECT)
WPN_AUTO_ON = 1 - WPN_AUTO_ON
// Reshow menu unless user exited
if (key != MENU_KEY_EXIT)
show_menu_buy2(id)
return PLUGIN_HANDLED;
}
// Store selected weapon
WPN_AUTO_SEC = key
// Drop secondary gun again, in case we picked another (bugfix)
drop_weapons(id, 2)
// Get weapon's id
static weaponid, wname[32]
weaponid = ArrayGetCell(g_secondary_weaponids, key)
ArrayGetString(g_secondary_items, key, wname, charsmax(wname))
// Give the new weapon and full ammo
fm_give_item(id, wname)
ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
client_cmd(id, "say /knife") // Knife Menu
return PLUGIN_HANDLED;
}
ZP 5.0
Open zp50_buy_menu.sma
Find this Line
// Buy Secondary Weapon
buy_secondary_weapon(id, selection)
{
// Drop previous secondary weapon
drop_weapons(id, SECONDARY_ONLY)
// Get weapon's id
static weapon_name[32]
ArrayGetString(g_secondary_items, selection, weapon_name, charsmax(weapon_name))
new weaponid = get_weaponid(weapon_name)
// Give the new weapon and full ammo
give_item(id, weapon_name)
ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
// Secondary bought
flag_unset(g_CanBuySecondary, id)
}
Change this Too :-
// Buy Secondary Weapon
buy_secondary_weapon(id, selection)
{
// Drop previous secondary weapon
drop_weapons(id, SECONDARY_ONLY)
// Get weapon's id
static weapon_name[32]
ArrayGetString(g_secondary_items, selection, weapon_name, charsmax(weapon_name))
new weaponid = get_weaponid(weapon_name)
// Give the new weapon and full ammo
give_item(id, weapon_name)
ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[weaponid], AMMOTYPE[weaponid], MAXBPAMMO[weaponid])
client_cmd(id, "say /knife") // Knife Menu
// Secondary bought
flag_unset(g_CanBuySecondary, id)
}
And u are done! Just then compile zombie_plague40.sma If u are using ZP 4.3 or Compile zp50_buy_menu.sma If u are using ZP 5.0
Note :- Please check your zp_knife_menu.sma that your knife menu command is /knife if it is not /knife then change it to this!
Hope this Will be HelpFul!
Any Questions Or Problems ? Ask in comment Section!