AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   How to get sub weapon slot? (https://forums.alliedmods.net/showthread.php?t=291252)

Nekoz 12-05-2016 04:46

How to get sub weapon slot?
 
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:

http://i.imgur.com/5Nj1YY5.png



Console:

http://i.imgur.com/W88wdpE.png

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

TheWho 12-07-2016 09:34

Re: How to get sub weapon slot?
 
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 (Post 2302058)
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;




Mitchell 12-07-2016 09:52

Re: How to get sub weapon slot?
 
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.

TheWho 12-07-2016 09:58

Re: How to get sub weapon slot?
 
Quote:

Originally Posted by TheWho (Post 2475858)
You need to loop the grenade slot.


Nekoz 12-08-2016 07:18

Re: How to get sub weapon slot?
 
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

TheWho 12-08-2016 10:03

Re: How to get sub weapon slot?
 
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.

Nekoz 12-08-2016 10:53

Re: How to get sub weapon slot?
 
Quote:

Originally Posted by TheWho (Post 2476165)
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


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

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