|
AlliedModders Donor
|
12-07-2016
, 09:34
Re: How to get sub weapon slot?
|
#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
PHP Code:
new const g_iaGrenadeOffsets[] = {15, 17, 16, 14, 18, 17};
stock RemoveNades(iClient) { while(RemoveWeaponBySlot(iClient, CS_SLOT_GRENADE)){} for(new i = 0; i < 6; i++) SetEntProp(iClient, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]); }
stock bool:RemoveWeaponBySlot(iClient, iSlot) { new iEntity = GetPlayerWeaponSlot(iClient, iSlot); if(IsValidEdict(iEntity)) { RemovePlayerItem(iClient, iEntity); AcceptEntityInput(iEntity, "Kill"); return true; } return false; }
|
Last edited by TheWho; 12-07-2016 at 09:35.
|
|
|
|