learn it in new plugin and than use your known in your plugin
from documentation:
Menus
Menus are HUD messages that give a player a choice of options to select. They are quite messy to deal with but can be very useful for things like voting and command selection.
Menus must be registered by two things - a set of "keys" that tells how many options to register and a string which identifies the menu as unique. This string must appear in the beginning of every menu you want to trigger your function. When you display a menu, you can show it to one or more players. Once they hit a key, the result of their key press will be sent to the function you registered the menu to.
For our example, we'll make a menu that displays a list of guns: AK47, M4A1, or AWP, to a player. Whichever he selects, he will be given.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
public plugin_init()
{
register_plugin("Menu Demo", "1.0", "BAILOPAN")
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
register_menucmd(register_menuid("Which Weapon?"), keys, "giveWeapon")
}
Two commands are apparent here - register_menuid and register_menucmd. register_menuid registers a short phrase that will appear at the beginning of the menu, then returns an id. This id is the first parameter to register_menucmd. The second parameter to register_menucmd is the key configuration. Our menu will have three options, so we've added three menu keys in. In actuality, these are bitwise flags totalling "7", but that's not important. The last parameter is the public function that will handle the menu results.
Next, how do we show the menu? Let's make a quick console command: "giveme".
Code:
public plugin_init()
{
register_plugin("Menu Demo", "1.0", "BAILOPAN")
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
register_menucmd(register_menuid("Which Weapon?"), keys, "giveWeapon")
register_clcmd("giveme", "showWeaponMenu")
}
register_clcmd is similar to register_concmd, except it only takes two parameters. It's used to register any command a client can use (except for special ones, like +attack).
Code:
//The clcmd function will just give us the player id
public showWeaponMenu(id)
{
new menu[192]
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
format(menu, 191, "Which Weapon?^n^n1. AK47^n2. M4A1^n3. AWP")
show_menu(id, keys, menu)
return PLUGIN_HANDLED
}
//Our menu function will get the player id and the key they pressed
public giveWeapon(id, key)
{
//key will start at zero
if (key == 0)
{
give_item(id, "weapon_ak47")
} else if (key == 1) {
give_item(id, "weapon_m4a1")
} else if (key == 2) {
give_item(id, "weapon_awp")
}
}
And we're done! The format line may be a little confusing. The "^n" means "new line", so the menu looks nicely formatted. You can use other modifiers in VGUI2 mods, such as "\w" for white text, "\r" for red text, and "\y" for yellow text. When a player types the command, he will see the menu. When he hits a key, the giveWeapon function will receive his id and the key number he pressed. Then he will get a gun corresponding to what he chose.