Raised This Month: $52 Target: $400
 13% 

Airblast prevention


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BloodyNightmare
Member
Join Date: Aug 2012
Location: Ontario, Canada
Old 01-15-2014 , 15:29   Airblast prevention
Reply With Quote #1

I've been looking at the code of several plugins (Dodge-ball && No Force) but I haven't found a proper way to handle this.

I'm looking for some kind of hook or plugin (if it already exists) that allows a player to enter a command to make them immune from being air-blasted. This is quite an issue on the server I run because of the open floating area of the map. I've tried using the TF2Items Method but nothing happens. Help is much appreciated.
__________________
BloodyNightmare is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 15:56   Re: Airblast prevention
Reply With Quote #2

Code:
HookEvent("object_deflected", Event_ObjectDeflected);
public Action:Event_ObjectDeflected(Handle:event, const String:name[], bool:dontBroadcast)
{
	new object = GetEventInt(event, "object_entindex");
	if ((object>=1) && (object<=MaxClients))
	{
		new Float:Vel[3];
		TeleportEntity(object, NULL_VECTOR, NULL_VECTOR, Vel); // Stops knockback
		TF2_RemoveCondition(object, TFCond_Dazed); // Stops slowdown
		SetEntPropVector(object, Prop_Send, "m_vecPunchAngle", Vel);
		SetEntPropVector(object, Prop_Send, "m_vecPunchAngleVel", Vel); // Stops screen shake  
	}
	return Plugin_Continue;
}
__________________
Mitchell is offline
BloodyNightmare
Member
Join Date: Aug 2012
Location: Ontario, Canada
Old 01-15-2014 , 17:48   Re: Airblast prevention
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
Code:
HookEvent("object_deflected", Event_ObjectDeflected);
public Action:Event_ObjectDeflected(Handle:event, const String:name[], bool:dontBroadcast)
{
	new object = GetEventInt(event, "object_entindex");
	if ((object>=1) && (object<=MaxClients))
	{
		new Float:Vel[3];
		TeleportEntity(object, NULL_VECTOR, NULL_VECTOR, Vel); // Stops knockback
		TF2_RemoveCondition(object, TFCond_Dazed); // Stops slowdown
		SetEntPropVector(object, Prop_Send, "m_vecPunchAngle", Vel);
		SetEntPropVector(object, Prop_Send, "m_vecPunchAngleVel", Vel); // Stops screen shake  
	}
	return Plugin_Continue;
}
Now would I be able to take this code, put it into a command so that only SPECIFIC players won't be affected by airblast?
__________________
BloodyNightmare is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 18:20   Re: Airblast prevention
Reply With Quote #4

Quote:
Originally Posted by BloodyNightmare View Post
Now would I be able to take this code, put it into a command so that only SPECIFIC players won't be affected by airblast?
You would need to make a boolean array for players that type that command to toggle it on/off then check:
if(someboolean[object])
{
//stop airblast
}
__________________
Mitchell is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-15-2014 , 16:01   Re: Airblast prevention
Reply With Quote #5

I'd think you'd be able to apply attribute 534 (the "airblast vulnerability multiplier hidden" attribute) with a value of 0.0 (or 0.01 if 0.0 doesn't work) to a player using the TF2Attributes plugin, but since it's intended to take values > 1, it may not actually work.

The reason I chose this attribute over the other version is because this attribute is actually used in the game on the ShortStop, so we know a value of 1.8 actually works to knock a player much farther.
__________________
Am I back? Well, we'll see.

Last edited by Powerlord; 01-15-2014 at 16:02.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-15-2014 , 17:09   Re: Airblast prevention
Reply With Quote #6

There is an attribute for airblast flags that will disable it from knocking back players, but will allow it to work on players. However, I forget what the values are.
__________________
Profile - Steam Group - Plugins - Blog - Donate
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
BloodyNightmare
Member
Join Date: Aug 2012
Location: Ontario, Canada
Old 01-15-2014 , 20:09   Re: Airblast prevention
Reply With Quote #7

I've attached the code I've written for this so far. I'm getting several compile errors that I'm not sure how to deal with. ( I'm new to SM coding )
Attached Files
File Type: sp Get Plugin or Get Source (AirblastPrevention.sp - 123 views - 1.5 KB)
__________________
BloodyNightmare is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 20:58   Re: Airblast prevention
Reply With Quote #8

Quote:
Originally Posted by BloodyNightmare View Post
I've attached the code I've written for this so far. I'm getting several compile errors that I'm not sure how to deal with. ( I'm new to SM coding )
Here i fixed it. use a difference checker.
also keep consistent with tabs and spaces
Attached Files
File Type: sp Get Plugin or Get Source (AirblastPrevention.sp - 245 views - 1.6 KB)
__________________
Mitchell is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 01-15-2014 , 21:04   Re: Airblast prevention
Reply With Quote #9

Code:
 406  399 CTFFlameThrower::DeflectPlayer(CTFPlayer *, CTFPlayer *, Vector &, Vector &, Vector &)
Hook and block this.
Note that the other checks are moot because there seem to be other methods for projectiles and entities (not sure if separated or altogether to be honest).

Two things to note about Mitchel's solution of which either one of them will become true:
1.) The player will be stopped entirely, so he'd have to accelerate again. In mid-air this would mean that he would drop like a stone.
2.) If you look up what the hl2sdk does in "TeleportEntity", you'll see that the given velocity will be kind of added up to the current entity's velocity. That way you can use "TeleportEntity" to apply multiple push-forces. That is why jumps work and won't stop your other movements for example.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.

Last edited by Dr. Greg House; 01-15-2014 at 21:08.
Dr. Greg House is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 21:27   Re: Airblast prevention
Reply With Quote #10

It's a beginning script. i dont think he'll be starting the advanced stuff right off the bat.
Quote:
Originally Posted by Dr. Greg House View Post
Mitchel's
:'(
__________________

Last edited by Mitchell; 01-15-2014 at 21:42.
Mitchell is offline
Reply


Thread Tools
Display Modes

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 13:55.


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