Raised This Month: $ Target: $400
 0% 

cs_set_user_bpammo not working


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-18-2021 , 08:32   Re: cs_set_user_bpammo not working
Reply With Quote #3

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
__________________









Last edited by CrazY.; 01-18-2021 at 08:41.
CrazY. is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode