View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-29-2020 , 13:00   Re: Detect if the weapon has a bullet
Reply With Quote #6

So use it like this in your code:
PHP Code:
new const m_pActiveItem 373

if (cs_get_weapon_ammo(get_pdata_cbase(idm_pActiveItem )) >= 1
This should work if players have only ups(no other items, not even knife).
PHP Code:

new activeItem get_pdata_cbase(idm_pActiveItem)
//check to see if activeItem entity is valid

if (cs_get_weapon_ammo(activeItem) >= 1)
        return
    
cs_set_weapon_ammo(activeItem1
If they can have more items, you need to check m_rgpPlayerItems[1](1 = pistol slot) offset(either directly, if they can have only USP or loop thru it using m_pNext if they can have 2 or more pistols).
__________________

Last edited by HamletEagle; 06-29-2020 at 13:01.
HamletEagle is offline