Почему какой бы я пункт не выбирал всё равно игрока убивает?
Код:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fun>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Admin"
new item
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /menu", "menu")
}
public menu(id)
{
new menuha = menu_create("Test menu", "test_menu")
menu_additem(menuha, "Suicude", "1")
menu_additem(menuha, "255 Health", "2")
menu_additem(menuha, "Respawn", "3")
menu_setprop(menuha, MPROP_EXITNAME, "Exit")
menu_display(id, menuha, 0)
}
public test_menu(id, menu)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5 ,iName, 63, callback);
new key = str_to_num(data)
switch(key)
{
case 1:
{
if(is_user_alive(id))
{
user_kill(id, 1)
}
else
{
set_hudmessage(0, 42, 255, 0.33, 0.54, 0, 6.0, 3.0)
show_hudmessage(id, "You already dead.")
}
}
case 2:
{
set_user_health(id, 255)
}
case 3:
{
if(is_user_alive(id))
{
set_hudmessage(0, 42, 255, 0.33, 0.54, 0, 6.0, 3.0)
show_hudmessage(id, "You already alive.")
}
else
{
spawn(id)
}
}
}
}