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

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 , 14: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 , 14: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
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-15-2014 , 15:01   Re: Airblast prevention
Reply With Quote #3

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.
__________________
Not currently working on SourceMod plugin development.

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

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 - Plugins
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 , 16:48   Re: Airblast prevention
Reply With Quote #5

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 , 17:20   Re: Airblast prevention
Reply With Quote #6

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
BloodyNightmare
Member
Join Date: Aug 2012
Location: Ontario, Canada
Old 01-15-2014 , 19: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 - 187 views - 1.5 KB)
__________________
BloodyNightmare is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 19: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 - 396 views - 1.6 KB)
Mitchell is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 01-15-2014 , 20: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 20:08.
Dr. Greg House is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 20: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 20:42.
Mitchell 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 05:09.


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