AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon slot detection (https://forums.alliedmods.net/showthread.php?t=131642)

Alucard^ 07-07-2010 08:09

Weapon slot detection
 
Well, like title said... i want to detect the slot of a weapon id... i think that the best way is with offset but, i can't find it the one to detect slot... the only thing that i found it is this: http://wiki.amxmodx.org/CWeaponBox_(CS) * first, 34 offset * but don't know... this is the correct one that i should use it?

wrecked_ 07-07-2010 08:24

Re: Weapon slot detection
 
Well, this may be of use to you: https://forums.alliedmods.net/showth...47#post1109747

Alucard^ 07-07-2010 15:07

Re: Weapon slot detection
 
Emm, but as far as i understand in the code of connor he is doing the inverse... he is detecting the weapon that are in the stock that you set... or i am wrong?

I want to detect the number of the slot, giving an id (or name, doesn't matter) of the weapon.

EDIT: Maybe i can use that code using a loop to detect the correct slot, but i will wait a better method =p

wrecked_ 07-07-2010 15:43

Re: Weapon slot detection
 
Code:
new const Slots[] = {     0, // NULL     2, // CSW_P228     0, // NULL     1, // CSW_SCOUT     4, // CSW_HEGRENADE     1, // CSW_XM1014     5, // CSW_C4     1, // CSW_MAC10     1, // CSW_AUG     4, // CSW_SMOKEGRENADE     2, // CSW_ELITE     2, // CSW_FIVESEVEN     1, // CSW_UMP45     1, // CSW_SG550     1, // CSW_GALIL     1, // CSW_FAMAS     2, // CSW_USP     2, // CSW_GLOCK     1, // CSW_AWP     1, // CSW_MP5NAVY     1, // CSW_M249     1, // CSW_M3     1, // CSW_M4A1     1, // CSW_TMP     1, // CSW_G3SG1     4, // CSW_FLASHBANG     2, // CSW_DEAGLE     1, // CSW_SG552     1, // CSW_AK47     3, // CSW_KNIFE     1 // CSW_P90 } GetSlotNumber( Wep )     return ( 0 <= Wep < sizeof Slots ) ? Slots[Wep] : 0;

ConnorMcLeod 07-07-2010 16:02

Re: Weapon slot detection
 
What do you want exactly ?

Weapon Slot by weapon entity index ?
- ExecuteHam(Ham_Item_ItemSlot, iWeaponEntity)

By weapon type ?
- Use the lookup table wrecked_ pointed

-> Slots[CSW_SCOUT]

This is not a loop.

Alucard^ 07-07-2010 19:06

Re: Weapon slot detection
 
Cool, i think i will use the Ham_Item_ItemSlot, thanks connor and wrecked.


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

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