View Single Post
psychonic

BAFFLED
Join Date: May 2008
Old 12-21-2009 , 09:46   Re: [TF2] Get active weapon
Reply With Quote #6

Quote:
Originally Posted by Mnkras View Post
which do you suggest? i am going to have it so that there is an effect on the player if they have that weapon out
Looking up the m_hActiveWeapon will tell you the entity index of the weapon. From there, you can get the classname with GetEdictClassname (after checking IsValidEdict ofc) and easily get/set properties of the weapon.

If you only need the classname and nothing else (ex. "tf_weapon_flamethrower"), then the GetClientWeapon function is simpler to use and would be a better fit.
psychonic is offline