how can i make a native like this?
PHP Code:
addmenu_hp(const name, const handler, team)
I want to add a menu to the / hp command with this native. Please give an example
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
regsiret_clcmd("say /hp", "hpcdm")
}
public hpcmd(id)
{
new szText[555 char]
formatex(szText, charsmax(szText), "HP")
new menu = menu_create(szText, "hp2")
formatex(szText, chatsmax(szText), "\w 300 HP")
menu_additem(szText, menu, "1", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_CONTINUE
}
public hp2(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[ 6 ], iName[ 64 ], access, callback;
menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback );
switch(key)
{
case 1:
{
set_user_health(id, 300)
}
}
return PLUGIN_HANDLED
}