Raised This Month: $183 Target: $400
 45% 

[L4D2] Airstuck teleportation patch


Post New Thread Reply   
 
Thread Tools Display Modes
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 12-07-2020 , 08:27   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #21

Do you remember this bug where a survivor got teleported by a special and pumeled even if it was not a charger ? There is a plugin who was trying to fix that, it was saving the position of the survivor to teleporthim back to his original position after having slayed the SI. Since last stand update i didn't have this bug anymore so i'm not sure it is still useful, still there is maybe something to do with this jockey exploit if someone can remake the plugin. It will be just a temporary fix but it is still better than nothing.

Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.31"

bool bSmoked[MAXPLAYERS+1];
float fLastPos[MAXPLAYERS+1][3];

public Plugin myinfo = 
{
	name = "[L4D2] Pummeled Survivor Fix",
	author = "cravenge",
	description = "Fixes Issues Where Survivors Are Suddenly Pummeled.",
	version = PLUGIN_VERSION,
	url = "https://forums.alliedmods.net/forumdisplay.php?f=108"
};

public void OnPluginStart()
{
	CreateConVar("pummeled_survivor_fix-l4d2_version", PLUGIN_VERSION, "Pummeled Survivor Fix Version", FCVAR_SPONLY|FCVAR_NOTIFY);
	
	HookEvent("round_start", OnRoundEvents);
	HookEvent("round_end", OnRoundEvents);
	HookEvent("finale_win", OnRoundEvents);
	HookEvent("mission_lost", OnRoundEvents);
	HookEvent("map_transition", OnRoundEvents);
	
	HookEvent("tongue_grab", OnTongueGrab);
	HookEvent("tongue_release", OnTongueRelease);
	
	AddNormalSoundHook(OnPummelSoundFix);
	
	CreateTimer(0.1, SaveClientPosition, _, TIMER_REPEAT);
	CreateTimer(1.0, CheckForPummelBugs, _, TIMER_REPEAT);
}

public Action OnPummelSoundFix(int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags, char soundEntry[PLATFORM_MAX_PATH], int &seed)
{
	if (StrContains(sample, "mortification", false) != -1 && GetEntPropEnt(entity, Prop_Send, "m_pummelAttacker") < 1)
	{
		return Plugin_Stop;
	}
	
	return Plugin_Continue;
}

public Action SaveClientPosition(Handle timer)
{
	if (!IsServerProcessing())
	{
		return Plugin_Continue;
	}
	
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i))
		{
			if (bSmoked[i] || GetEntProp(i, Prop_Send, "m_pounceAttacker") > 0 || GetEntProp(i, Prop_Send, "m_jockeyAttacker") > 0 || 
				GetEntProp(i, Prop_Send, "m_carryAttacker") > 0 || GetEntProp(i, Prop_Send, "m_pummelAttacker") > 0)
			{
				continue;
			}
			
			float fPos[3];
			GetEntPropVector(i, Prop_Send, "m_vecOrigin", fPos);
			
			fLastPos[i] = fPos;
		}
	}
	
	return Plugin_Continue;
}

public Action CheckForPummelBugs(Handle timer)
{
	if (!IsServerProcessing())
	{
		return Plugin_Continue;
	}
	
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && GetClientTeam(i) == 3 && IsPlayerAlive(i))
		{
			int iPummelVictim = GetEntPropEnt(i, Prop_Send, "m_pummelVictim");
			if (iPummelVictim < 1 || iPummelVictim > MaxClients || !IsClientInGame(iPummelVictim) || GetClientTeam(iPummelVictim) != 2 || !IsPlayerAlive(iPummelVictim))
			{
				continue;
			}
			
			if (GetEntProp(i, Prop_Send, "m_zombieClass") < 6 || (GetEntProp(i, Prop_Send, "m_zombieClass") == 6 && GetEntProp(i, Prop_Send, "m_isGhost", 1)) || GetEntProp(i, Prop_Send, "m_zombieClass") == 8)
			{
				if (GetEntProp(i, Prop_Send, "m_zombieClass") != 8)
				{
					ForcePlayerSuicide(i);
					PrintToChatAll("\x04[FIX]\x01 Slayed \x03%N\x01 For Having \x05Pummeled Survivor Bug\x01!", i);
				}
				else
				{
					PrintToChatAll("\x04[FIX]\x01 Prevented \x03%N\x01 From Bugging \x03%N\x01!", iPummelVictim, i);
				}
				
				Event eChargerPummelEnd = CreateEvent("charger_pummel_end", true);
				eChargerPummelEnd.SetInt("userid", GetClientUserId(i));
				eChargerPummelEnd.SetInt("victim", GetClientUserId(iPummelVictim));
				eChargerPummelEnd.Fire();
				
				TeleportEntity(iPummelVictim, fLastPos[iPummelVictim], NULL_VECTOR, NULL_VECTOR);
				
				SetEntPropEnt(i, Prop_Send, "m_pummelVictim", -1);
				SetEntPropEnt(iPummelVictim, Prop_Send, "m_pummelAttacker", -1);
			}
		}
	}
	
	return Plugin_Continue;
}

public void OnPluginEnd()
{
	UnhookEvent("round_start", OnRoundEvents);
	UnhookEvent("round_end", OnRoundEvents);
	UnhookEvent("finale_win", OnRoundEvents);
	UnhookEvent("mission_lost", OnRoundEvents);
	UnhookEvent("map_transition", OnRoundEvents);
	
	UnhookEvent("tongue_grab", OnTongueGrab);
	UnhookEvent("tongue_release", OnTongueRelease);
	
	RemoveNormalSoundHook(OnPummelSoundFix);
}

public void OnRoundEvents(Event event, const char[] name, bool dontBroadcast)
{
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i))
		{
			bSmoked[i] = false;
		}
	}
}

public void OnTongueGrab(Event event, const char[] name, bool dontBroadcast)
{
	int grabbed = GetClientOfUserId(event.GetInt("victim"));
	if (grabbed < 1 || grabbed > MaxClients || !IsClientInGame(grabbed) || GetClientTeam(grabbed) != 2 || bSmoked[grabbed])
	{
		return;
	}
	
	bSmoked[grabbed] = true;
}

public void OnTongueRelease(Event event, const char[] name, bool dontBroadcast)
{
	int released = GetClientOfUserId(event.GetInt("victim"));
	if (released < 1 || released > MaxClients || !IsClientInGame(released) || GetClientTeam(released) != 2 || bSmoked[released])
	{
		return;
	}
	
	bSmoked[released] = false;
}

Last edited by JLmelenchon; 12-07-2020 at 08:27.
JLmelenchon is offline
larrybrains
Senior Member
Join Date: May 2017
Old 12-15-2020 , 17:57   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #22

Quote:
Originally Posted by JLmelenchon View Post
Do you remember this bug where a survivor got teleported by a special and pumeled even if it was not a charger ? There is a plugin who was trying to fix that, it was saving the position of the survivor to teleporthim back to his original position after having slayed the SI. Since last stand update i didn't have this bug anymore so i'm not sure it is still useful, still there is maybe something to do with this jockey exploit if someone can remake the plugin. It will be just a temporary fix but it is still better than nothing.
I think it should be possible to make a plugin that checks the origin of a survivor every 500ms while they are jockeyed and if the difference between the new position and the previous position differs by more than some maximum, they were likely teleported and so it would then teleport them back to the previous position.

The only issue I see is if the survivor was dropped off of some height while being ridden, it might detect that as a teleport.

I might try to make this as a bandaid fix, thanks for the idea. I will share it here if I actually figure it out.
larrybrains is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 12-15-2020 , 18:06   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #23

Re-creating this in a plugin will fix all those exploits
__________________
Pelipoika is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 12-15-2020 , 21:54   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #24

Quote:
Originally Posted by larrybrains View Post
I think it should be possible to make a plugin that checks the origin of a survivor every 500ms while they are jockeyed and if the difference between the new position and the previous position differs by more than some maximum, they were likely teleported and so it would then teleport them back to the previous position.

The only issue I see is if the survivor was dropped off of some height while being ridden, it might detect that as a teleport.

I might try to make this as a bandaid fix, thanks for the idea. I will share it here if I actually figure it out.
Or maybe have a check if the position is out of bounds, each map have one different i think and it seems more safe.

In the meantime i disabled some plugins interacting with jockey (jockey deadstop, l4d2_getup_slide_fix, bunny hop blocker, pumeled survivor fix) but it is been only one week so it is a little too early to say if one of them could cause that. Still the exploit is feasible on official servers so.

Last edited by JLmelenchon; 12-15-2020 at 22:00.
JLmelenchon is offline
canadianjeff
Senior Member
Join Date: Sep 2016
Old 12-27-2020 , 05:27   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #25

I too have seen this exploited on vanilla valve servers since atleast 2015 now that Back 4 Blood is out might be time to finally put L4D2 to rest and let it rot
canadianjeff is offline
larrybrains
Senior Member
Join Date: May 2017
Old 12-28-2020 , 23:42   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #26

Quote:
Originally Posted by JLmelenchon View Post
Or maybe have a check if the position is out of bounds, each map have one different i think and it seems more safe.
Thanks for this suggestion. I have been using the attached plugin I built for the last few weeks on my server and have seen it work 3 or 4 times now.

When a survivor gets jockeyed, it saves the jockeyed survivors position every 1.2 seconds and checks if their position is inside the world every 2 seconds, and if they are found to be outside of the world, it teleports them back to the last saved position. These timers could possible be reduced in length, but it seems to work well enough as is.

I am new at building Sourcemod plugins and I sort of pieced this together from a few other unstuck teleport type plugins out there, so if you feel like this could be improved upon, go for it.

Compiled on SM 1.10
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_unteleport_jockey.sp - 14 views - 4.6 KB)
File Type: smx l4d2_unteleport_jockey.smx (7.2 KB, 5 views)
larrybrains is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 12-29-2020 , 06:28   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #27

If jockey is going for an instant death fall will it be considered as outside world ?

Quote:
Originally Posted by larrybrains View Post
Thanks for this suggestion. I have been using the attached plugin I built for the last few weeks on my server and have seen it work 3 or 4 times now.

When a survivor gets jockeyed, it saves the jockeyed survivors position every 1.2 seconds and checks if their position is inside the world every 2 seconds, and if they are found to be outside of the world, it teleports them back to the last saved position. These timers could possible be reduced in length, but it seems to work well enough as is.

I am new at building Sourcemod plugins and I sort of pieced this together from a few other unstuck teleport type plugins out there, so if you feel like this could be improved upon, go for it.

Compiled on SM 1.10

Last edited by JLmelenchon; 12-29-2020 at 06:28.
JLmelenchon is offline
larrybrains
Senior Member
Join Date: May 2017
Old 12-29-2020 , 14:04   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #28

Quote:
Originally Posted by JLmelenchon View Post
If jockey is going for an instant death fall will it be considered as outside world ?
I don't believe so. It uses TR_PointOutsideWorld to test the survivors position.
larrybrains is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 01-05-2021 , 12:38   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #29

Thanks I will test your plugin but with only the chat message for now, just to be sure there is no false detections. By the way it will be nice to have a logtofile message with the player name and steamid of the jockey + the rided survivor.

Last edited by JLmelenchon; 01-05-2021 at 12:40.
JLmelenchon is offline
larrybrains
Senior Member
Join Date: May 2017
Old 01-05-2021 , 17:41   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #30

Quote:
Originally Posted by JLmelenchon View Post
Thanks I will test your plugin but with only the chat message for now, just to be sure there is no false detections. By the way it will be nice to have a logtofile message with the player name and steamid of the jockey + the rided survivor.
So far I haven't had any false detections that I know of, but it has missed a couple where the survivor was teleported by the jockey, but wasn't actually teleported out of the world, so in those instances it didn't trigger the plugin to teleport them back.

I will look into adding some kind of logging.

EDIT:

Also, was wondering if you have had any jockey teleports since you disabled those plugins? (jockey deadstop, l4d2_getup_slide_fix, bunny hop blocker, pumeled survivor fix)

Last edited by larrybrains; 01-05-2021 at 17:43.
larrybrains 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 17:04.


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