View Single Post
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 12-07-2016 , 09:34   Re: How to get sub weapon slot?
Reply With Quote #2

You need to loop the grenade slot.

PHP Code:
#define CS_SLOT_PRIMARY        0    /**< Primary weapon slot. */
#define CS_SLOT_SECONDARY    1    /**< Secondary weapon slot. */
#define CS_SLOT_KNIFE        2    /**< Knife slot. */
#define CS_SLOT_GRENADE        3    /**< Grenade slot (will only return one grenade). */
#define CS_SLOT_C4            4    /**< C4 slot. */ 
Quote:
Originally Posted by Franc1sco View Post
PHP Code:
new const g_iaGrenadeOffsets[] = {151716141817};

stock RemoveNades(iClient)
{
    while(
RemoveWeaponBySlot(iClientCS_SLOT_GRENADE)){}
    for(new 
06i++)
        
SetEntProp(iClientProp_Send"m_iAmmo"0_g_iaGrenadeOffsets[i]);
}

stock bool:RemoveWeaponBySlot(iClientiSlot)
{
    new 
iEntity GetPlayerWeaponSlot(iClientiSlot);
    if(
IsValidEdict(iEntity)) {
        
RemovePlayerItem(iClientiEntity);
        
AcceptEntityInput(iEntity"Kill");
        return 
true;
    }
    return 
false;


Last edited by TheWho; 12-07-2016 at 09:35.
TheWho is offline