Code:
[de]
CHOOSE_WEAPON = Du hast gewaehlt:
CHOOSE_RANDOM_WEAPON = wurde zufaellig ausgewaehlt.
Example how you can do the menu handling much easier and readable:
PHP Code:
new const primaries[][] =
{
"weapon_m249",
"weapon_m4a1",
"weapon_ak47",
"weapon_mp5navy"
}
new const primarynames[][] =
{
"M249",
"M4A1",
"AK-47",
"MP5"
}
public mostrarmenu(id)
{
new menu = menu_create("\rChoose the weapon \yprimary \rsurvivor:", "mostrar_cliente")
menu_additem(menu, "\yM249", "0", 0)
menu_additem(menu, "\yM4a1", "1", 0)
menu_additem(menu, "\yAK47", "2", 0)
menu_additem(menu, "\yMP5", "3", 0)
menu_additem(menu, "\yRandom", "4", 0)
menu_display(id, menu, 0)
}
public mostrar_cliente(id, menu, item)
{
new data[6], iName[2];
new access, callback;
menu_item_getinfo( menu, item, access, data,5, iName, 1, callback );
new choice = str_to_num(data);
if( choice == 4 )
choice = random_num( 0, 3 );
drop_weapons( id, 1 );
fm_give_item( id, primaries[choice] );
client_print( id, print_chat, "[CWS] %L %s", id, "CHOOSE_WEAPON", primarynames[choice] );
if( get_pcvar_num( pcvar_secondary ) )
mostrarmenu2( id );
menu_destroy( menu );
return PLUGIN_HANDLED;
}
__________________