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

Solved: Allow weapon switches in situations you normally can't


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 04-19-2015 , 13:55   Solved: Allow weapon switches in situations you normally can't
Reply With Quote #1

I'm trying to think of how to do this. I know how to use SDKHooks/DHooks now so those work too.

Essentially I'm trying to make it so Heavies can weapon switch as long as their minigun's m_iWeaponState is 0. It's 0 when the heavy is idle or winding down his minigun. Normally you cannot weaponswitch until he is done winding down.

I only know how to detect weapon switches after they've occurred via the provided SDKHooks... afaik you can't detect slot1/slot2/slot3 keypresses in TF2 via Sourcemod, so I have no way to detect if clients "Attempt" to weapon switch.

So the only other options afaik would be to patch ... something that tells the client whether or not it's okay to switch. I guess?
__________________

Last edited by Chdata; 04-19-2015 at 15:36.
Chdata is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 04-19-2015 , 14:55   Re: TF2: Allow weapon switches in situations you normally can't
Reply With Quote #2

I don't think the client sends anything about it.
Miu is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 04-19-2015 , 15:35   Re: TF2: Allow weapon switches in situations you normally can't
Reply With Quote #3

Solved.

Looked at Weapon_CanSwitchTo() / CanHolster / CanDeploy in the source SDK and valve dev wiki.

Also here's this:

PHP Code:

// m_iWeaponState for Miniguns
enum
{
    
WeaponState_Idle 0// Applies while winding down
    
WeaponState_WindUp,
    
WeaponState_Firing,
    
WeaponState_Revved


... Somehow I always manage to solve my own stuff shortly after I give up and ask for help.
__________________

Last edited by Chdata; 04-21-2015 at 12:17.
Chdata is offline
Reply



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 01:34.


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