sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

CStrike Ext: Add native to retrieve loadout slot of weapon

Open roflmuffin opened this issue 5 years ago • 5 comments

Some events, mainly the "dm_bonus_weapon_start" event, pass the loadout slot of the weapon that is now the bonus weapon, rather than an item index or a weapon id.

We are already creating a map of this in the cstrike extension, this native simply returns another member from that mapped value.

Let me know if I have missed anything, do I also need to update the .inc file in the tests folder?

roflmuffin avatar Apr 23 '20 01:04 roflmuffin

@roflmuffin are you okay to continue working on this one?

KyleSanderson avatar Aug 07 '20 02:08 KyleSanderson

I'm sorry, I'm not familiar enough with this repo, I initially created this PR as a launching off point. For the commit I basically just copied the existing CS_WeaponIDToItemDefIndex and replaced the value it was returning, but I'm not sure what changes you are requesting, sorry.

I'm assuming you are saying that the Loadout slot should work on all cstrike, not just CSGO? Looking through the g_mapWeaponIDToDefIdx initialiser this looks like the case? Is there a way for me to test this locally without CSS?

roflmuffin avatar Aug 07 '20 05:08 roflmuffin

https://github.com/alliedmodders/sourcemod/pull/1241#issuecomment-670333916

You're likely going to need the game to test unfortunately. My apologies for the delay on the response, if you'd like to connect with me offline (or though here) I'd be happy to try and help.

KyleSanderson avatar May 20 '21 23:05 KyleSanderson

I think g_mapWeaponIDToDefIdx is only initialized for CSGO. @KyleSanderson do you think it's best to add a hardcoded list of loadoutslots to return for the limited set of weapons available in CSS?

peace-maker avatar Feb 01 '22 23:02 peace-maker

@KyleSanderson I'd be fine with only adding this for CS:GO since the information is right there. A note mentioning it's for CS:GO only would do for now until someone steps up and adds support for CS:S. What do you think?

peace-maker avatar Jul 11 '22 20:07 peace-maker