AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get slot weapon CSW ID (https://forums.alliedmods.net/showthread.php?t=251497)

FromTheFuture 11-14-2014 05:23

Get slot weapon CSW ID
 
Hi, how to get selected weapon CSW id on pressed slot? Or how to hook pressed slots cmds?

Bladell 11-15-2014 06:35

Re: Get slot weapon CSW ID
 
Maybe this can help you https://forums.alliedmods.net/showthread.php?t=182970

HamletEagle 11-15-2014 07:17

Re: Get slot weapon CSW ID
 
@Bladell, the method from the topic you linked used for detecting if a player has primary weapons is somehow inneficient:
Code:
//You would need hamsandwich module stock const m_rgpPlayerItems_CBasePlayer[ 6 ] = { 367 , 368 , ... } const XO_PLAYER = 5 #define HasPrimaryWeapon(%0)   ( get_pdata_cbase(%0,  m_rgpPlayerItems_CBasePlayer[ 1 ], XO_PLAYER ) )

Then, just do HasPrimaryWeapon(index). I don't understood what you need, but if you want to get the weapon slot use Ham_ItemSlot.

FromTheFuture 11-15-2014 11:53

Re: Get slot weapon CSW ID
 
Quote:

Originally Posted by HamletEagle (Post 2224408)
@Bladell, the method from the topic you linked used for detecting if a player has primary weapons is somehow inneficient:
Code:
//You would need hamsandwich module stock const m_rgpPlayerItems_CBasePlayer[ 6 ] = { 367 , 368 , ... } const XO_PLAYER = 5 #define HasPrimaryWeapon(%0)   ( get_pdata_cbase(%0,  m_rgpPlayerItems_CBasePlayer[ 1 ], XO_PLAYER ) )

Then, just do HasPrimaryWeapon(index). I don't understood what you need, but if you want to get the weapon slot use Ham_ItemSlot.

Ow, U can show me an example with Ham_ItemSlot?


All times are GMT -4. The time now is 17:38.

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