If the give_item is from the fun module, this may fix the problem. If not, just make sure give_item returns the weapon entity index. If it doesn't work, try debbuging your code.
Code:
public PRIMARY_WEAPONS_HANDLER ( iEntity, iMenu, iKey )
{
if ( iKey == MENU_EXIT )
{
menu_destroy ( iMenu );
return;
}
new iWeaponEntity = give_item ( iEntity, g_cPrimaryWeaponsEntity [ iKey ] );
//new iWeaponID = get_user_weapon ( iEntity );
new iWeaponID = cs_get_weapon_id( iWeaponEntity );
if ( GUN_BITS & (1<<iWeaponID) )
cs_set_user_bpammo ( iEntity, iWeaponID, 90 );
}
By the way, you should be returning PLUGIN_HANDLED in menu handlers, as stated in the docs.
Quote:
* The handler function should always return PLUGIN_HANDLED to block
* any old menu handlers from potentially feeding on the menu, unless
* that is the desired functionality.
|
https://www.amxmodx.org/api/newmenus/menu_create
__________________