Raised This Month: $51 Target: $400
 12% 

Solved [TF2] How to Get Saxxy Classname?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-16-2019 , 22:44   [TF2] How to Get Saxxy Classname?
Reply With Quote #1

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];
GetClientWeapon(target, sWeapon2, sizeof(sWeapon2));

/**
* Gets the classname and entity index of the current/active weapon of a client.
*
* @param client		Client Index.
* @param buffer		String Buffer to store the weapon's classname.
* @param size			Max size of String: buffer.
* @return				Weapon Entity Index on success or INVALID_ENT_REFERENCE otherwise
*/
stock Client_GetActiveWeaponName(client, String:buffer[], size)
{
	new weapon = Client_GetActiveWeapon(client);

	if (weapon == INVALID_ENT_REFERENCE) {
		buffer[0] = '\0';
		return INVALID_ENT_REFERENCE;
	}

	Entity_GetClassName(weapon, buffer, size);

	return weapon;
}
Note, these functions seem to return the correct classname on all of the other weapon classes that I tested.

Last edited by PC Gamer; 11-18-2019 at 09:36. Reason: Solved
PC Gamer is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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