Quote:
Originally Posted by Kartush
Thank you for your answer.
Very good plugins , both are working perfect .
It is possible to add an option [Previous Setup] and [Remember Selection] like those from CSDM equip menu ?
Also if is possible to make it come forward when you get respawned? without any command like this from
|
I think with remember selection there would be a lot of use cases for me to do, but you can modify it urself further.
Down here there are 3 different menus you can choose, add as many as u want like previously.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
register_plugin("Open Menu: Commands Menu", "1.1", "Critmedin");
register_clcmd("say /menu", "m_menu");
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
}
public m_menu(id)
{
if(1 <= get_user_team(id) <= 2 && is_user_alive(id))
{
show_main_menu(id);
}
else
{
client_print(id, print_chat, "You cannot open this menu!");
}
return PLUGIN_HANDLED;
}
public fwHamPlayerSpawnPost(iPlayer) {
if (is_user_alive(iPlayer)) {
show_main_menu(iPlayer);
}
return HAM_IGNORED;
}
public show_main_menu(id)
{
new menu = menu_create("Main Menu:", "main_menu_handler");
menu_additem(menu, "Knives");
menu_additem(menu, "Assault Rifles");
menu_additem(menu, "Pistols");
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public show_knives_menu(id)
{
new menu = menu_create("Knives Menu:", "command_menu_handler");
menu_additem(menu, "Butterfly Knife");
menu_additem(menu, "Karambit");
menu_additem(menu, "Bayonet");
// Add more knife items if needed
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public show_assault_rifles_menu(id)
{
new menu = menu_create("Assault Rifles Menu:", "command_menu_handler");
menu_additem(menu, "AK47");
menu_additem(menu, "M4A1");
menu_additem(menu, "Famas");
// Add more assault rifle items if needed
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public show_pistols_menu(id)
{
new menu = menu_create("Pistols Menu:", "command_menu_handler");
menu_additem(menu, "Desert Eagle");
menu_additem(menu, "Glock");
menu_additem(menu, "USP");
// Add more pistol items if needed
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public main_menu_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
switch(item)
{
case 0: show_knives_menu(id);
case 1: show_assault_rifles_menu(id);
case 2: show_pistols_menu(id);
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public command_menu_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
switch(menu)
{
// Knives Menu
case 0:
switch(item)
{
case 0: client_cmd(id, "item_ButterflyKnife");
case 1: client_cmd(id, "item_Karambit");
case 2: client_cmd(id, "item_Bayonet");
// Add more knife cases if needed
}
// Assault Rifles Menu
case 1:
switch(item)
{
case 0: client_cmd(id, "item_AK47");
case 1: client_cmd(id, "item_M4A1");
case 2: client_cmd(id, "item_Famas");
// Add more assault rifle cases if needed
}
// Pistols Menu
case 2:
switch(item)
{
case 0: client_cmd(id, "item_DesertEagle");
case 1: client_cmd(id, "item_Glock");
case 2: client_cmd(id, "item_USP");
// Add more pistol cases if needed
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}