Raised This Month: $ Target: $400
 0% 

"Hooking" and over-riding +attack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZephirDX
New Member
Join Date: Aug 2008
Old 08-19-2008 , 13:35   "Hooking" and over-riding +attack
Reply With Quote #1

I'm very new to SourceMod, as is proved by me posting this in the wrong forum at first. I did my homework and looked all day over these forums and through where I could in SDK documents and couldn't really find a way to do what I want. So I guess I'll just ask the experts.


I want to be able to hook and conditionally disable the +attack/-attack command for Team Fortress 2. Basically, I'm writing a mini-game plugin for my clan's server, and I want to make it so the flamethrower can only use the compression blast, ie, no killing, just pushing. Other cases will still need to be able to use +attack. (Work arounds and alternatives welcome).

RegConsoleCmd("+attack"...) doesn't seem to work, nor does the "player_shoot" event. I read a post that used GetClientButtons() to detect an IN_ATTACK flag, but that does not allow me to block as I need to do.

Any help would be greatly appreciated. The results will be hilariously entertaining and certainly released to all.

Also: I want to control +duck as well, but I figure that will come with solving this problem.
ZephirDX is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 08-19-2008 , 14:16   Re: "Hooking" and over-riding +attack
Reply With Quote #2

Hate to be the one to say it, but it's not possible =/

Blocking fire and fire damage could maybe be possible (not a TF2 coder, not sure) but you can't hook client commands like +attack and block them from happening.

My best suggestion would be looking at the Hooker ext to catch and delete the creation of a fire entity created by Pyro?
__________________
Greyscale is offline
DiscoBBQ
Veteran Member
Join Date: Jan 2005
Location: Clemson, South Carolina
Old 08-19-2008 , 14:18   Re: "Hooking" and over-riding +attack
Reply With Quote #3

Yeah it's good to see someone doing their homework before asking, but I have tried multiple times and have failed to actually block firing.
__________________
"Every man is guilty of all the good he did not do"
DiscoBBQ is offline
pRED*
Join Date: Dec 2006
Old 08-19-2008 , 18:19   Re: "Hooking" and over-riding +attack
Reply With Quote #4

Using a c++ extension you can hook ProcessUserCmds and remove the +attack flag.
Probably will still animate client side for the firer though.
pRED* is offline
ZephirDX
New Member
Join Date: Aug 2008
Old 08-19-2008 , 18:43   Re: "Hooking" and over-riding +attack
Reply With Quote #5

Darn, Thanks for the info tho. Good to know about the extensions. Guess that's where I'll head next.
ZephirDX is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 08-20-2008 , 03:11   Re: "Hooking" and over-riding +attack
Reply With Quote #6

ZephirDX@: hi..if its just the flamethrower you wan't to block then there is an easy way, im pretty sure that when a pyro +attacks an "fire" entity is created and im 100% about that so you what you could try doing in game frame is checking for fire entities just with the "fire" classname and checking if their m_iOwnerEntity is a valid player in game and alive, and then deleting them...in theory it should work fine its not a great way to do it but you have no other options with sourcemod yet.
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
Tauphi
SourceMod Donor
Join Date: Sep 2004
Location: Germany
Old 10-02-2008 , 09:23   Re: "Hooking" and over-riding +attack
Reply With Quote #7

Quote:
Originally Posted by pRED* View Post
Using a c++ extension you can hook ProcessUserCmds and remove the +attack flag.
Probably will still animate client side for the firer though.
which extension ?
__________________
Tauphi is offline
Send a message via ICQ to Tauphi Send a message via Skype™ to Tauphi
necrosect
Senior Member
Join Date: Jun 2008
Old 10-02-2008 , 09:35   Re: "Hooking" and over-riding +attack
Reply With Quote #8

probably hooker ?
necrosect is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 10-02-2008 , 09:54   Re: "Hooking" and over-riding +attack
Reply With Quote #9

hook 'weapon_fire' event; Check if "m_nButtons" is IN_ATTACK set buttons &= ~IN_ATTACK
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Tauphi
SourceMod Donor
Join Date: Sep 2004
Location: Germany
Old 10-02-2008 , 10:34   Re: "Hooking" and over-riding +attack
Reply With Quote #10

in TF2 the weapon_fire event does not exist ...

and how do I set IN_ATTACK ? there is only a GetClientButtons() method, no SetClientButtons ...
__________________
Tauphi is offline
Send a message via ICQ to Tauphi Send a message via Skype™ to Tauphi
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 04:05.


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