[TF2] How to Get Saxxy Classname?
Team,
How can I reliably return the weapon classname of a players active weapon when they are holding a saxxy weapon such as 'The Bat Outta Hell' or the 'Prinny Machete' For example, if I equip 'The Bat Outta Hell' each of these functions will return a classname of 'tf_weapon_bonesaw'. How do I get a classname of 'saxxy'? Code:
char sWeapon2[32]; |
Re: [TF2] How to Get Saxxy Classname?
There's a netprop for the weapons named m_iItemDefinitionIndex. You can try to get the Saxxy's index, then have a check on the netprop comparing it to the numbered index you found.
As far as I know not all weapons have their own classnames; some just reuse existing ones. |
Re: [TF2] How to Get Saxxy Classname?
Sounds like an XY problem; what's your goal here, exactly?
The most foolproof way would be to look it up in the schema with the item's definition index. TF2Econ_GetItemClassName from my Econ Data library would be the newest way of going about that. |
Re: [TF2] How to Get Saxxy Classname?
Thanks nosoop! The TF2Econ_GetItemClassName works great.
Use case: I use it to troubleshoot weapon specific problems within the Uber Upgrades plugin because it uses weapon classes to determine upgrade menus that are displayed to the client. Example Problem: In my most recent example an Engineer claimed the buildings upgrade menu wouldn't appear when he used the Prinny Machete (a saxxy class weapon). Typical troubleshooting step: I use the !getweapon command from Joined Senses Attribute Setter plugin to determine a players weapon class. I noticed the weapon indexes being returned were sometimes wrong, and also noticed that the weaponclass returned was always wrong when the player had a saxxy class weapon equipped. While testing fixes to the plugin I realized that the SourceMod function "GetClientWeapon" and SMLIB Function "Client_GetActiveWeaponName" do not return the correct classname with saxxy class weapons. However, the TF2Econ_GetItemClassName function you provided works great. Thanks! |
All times are GMT -4. The time now is 16:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.