Raised This Month: $209 Target: $400
 52% 

How to get sub weapon slot?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nekoz
Member
Join Date: Oct 2016
Old 12-05-2016 , 04:46   How to get sub weapon slot?
Reply With Quote #1

There is an explosive slot in there but in insurgency, the explosive slot can hold 2 different explosive type.
The GetPlayerWeaponSlot only able to grab the first explosive, unable to get the second one.
I use a for loop to print out all the slots, still no luck.

In-Game:





Console:



You see in the screenshot? It missing a grenade.
I'm wondering is there a sub slot function for it...

Last edited by Nekoz; 12-05-2016 at 05:17.
Nekoz is offline
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
Mitchell
~lick~
Join Date: Mar 2010
Old 12-07-2016 , 09:52   Re: How to get sub weapon slot?
Reply With Quote #3

That's to remove a weapon from the player's slot, and this is for insurgency, I don't think CS has the same structure.
Mitchell is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 12-07-2016 , 09:58   Re: How to get sub weapon slot?
Reply With Quote #4

Quote:
Originally Posted by TheWho View Post
You need to loop the grenade slot.
TheWho is offline
Nekoz
Member
Join Date: Oct 2016
Old 12-08-2016 , 07:18   Re: How to get sub weapon slot?
Reply With Quote #5

The one u showing me is just remove the weapon by looping the same slot
And I don't get how that grenade offset work

What i'm trying to do is grab the entity of the missing grenade from the slot so I can modify it instead of removing them

Last edited by Nekoz; 12-08-2016 at 07:25.
Nekoz is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 12-08-2016 , 10:03   Re: How to get sub weapon slot?
Reply With Quote #6

99% of us have nothing to do with insurgency but I think that they do the same as in csgo with grenades so that's why I quoted it.
TheWho is offline
Nekoz
Member
Join Date: Oct 2016
Old 12-08-2016 , 10:53   Re: How to get sub weapon slot?
Reply With Quote #7

Quote:
Originally Posted by TheWho View Post
99% of us have nothing to do with insurgency but I think that they do the same as in csgo with grenades so that's why I quoted it.
It work pretty much the same
Ur script work but I don't wanna remove the weapon
I wanna grab the weapon ID off from the slot
Nekoz is offline
Reply


Thread Tools
Display Modes

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 19:30.


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