sourcemod
                                
                                
                                
                                    sourcemod copied to clipboard
                            
                            
                            
                        CStrike Ext: Add native to retrieve loadout slot of weapon
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 are you okay to continue working on this one?
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?
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.
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?
@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?