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

Solved L4d - Prevent infected cloning on servers with unlimited team switching


Post New Thread Reply   
 
Thread Tools Display Modes
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 01-18-2022 , 14:17   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #11

That is true, Marttt, the initial question is solved with the script I attached.

The incap thing is not connected to it, it is a standalone bug.

So we can stop the discussion here at that point.

Maybe if it's possible to fix it, we can make a fix plugin later, if possible in a different thread or so.
__________________

Last edited by finishlast; 01-18-2022 at 14:25.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-18-2022 , 14:54   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #12

When player spawn as infected, then switch team, bot will be leave behind as infected.

So, block jointeam when player is alive in infected team.
PHP Code:
enum
{
    
unknown 0,
    
Spectator,
    
Survivor,
    
Infected
}

char teamname[][] =
{
    
"unknown",
    
"Spectator",
    
"Survivor",
    
"Infected"
}

public 
void OnPluginStart()
{
    
AddCommandListener(listen"jointeam");
}

public 
Action listen(int client, const char[] commandint args)
{
    if(
client || !IsClientInGame(client) || IsFakeClient(client)  || GetClientTeam(client) != Infected)
        return 
Plugin_Continue;

    if(
GetEntProp(clientProp_Send"m_iPlayerState") == 0)
    {
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;

Bacardi is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 01-19-2022 , 11:21   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #13

Ah, very good, Bacardi.

That solves both problems at the same time.

I combined both into one script, so when tank becomes bot, it removes the left behind infected plus blocking the switch while alive.

Second will block the incap or instant kill bug.

Thank you all. That's cool.
__________________

Last edited by finishlast; 01-20-2022 at 13:04.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-19-2022 , 11:31   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #14

You're welcome.

ps
Where god dam Google translate today ?? It have been gone from quick choose.
__________________
Do not Private Message @me
Bacardi is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 01-19-2022 , 14:19   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #15

Oh, I was celebrating too early.

The incap bug even works unspawned.

So all you need is to actually switch teams to incap or kill the bot, no need to spawn.

Now that is worse.

Maybe it can be blocked if the damage itself is blocked for a milisecond after switch for the client that is switching?

During the switch, I can see the one time damage:

On Dead Air
OnTakeDamage victim: 2,attacker: 667, damage is 100.000000 (only incap)

On Blood harvest
OnTakeDamage victim: 2,attacker: 297, damage is 500.000000 (instant death)

I think I fixed it with attached version, it should block the damage for 0.1 sec.

In my tests it seems to be enough.

I attached both variants, the one where you can switch teams always and the one bacardi suggested.

Maybe someone can move this thread to scripting forums.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_no_clone_of_infected_v2.sp - 89 views - 3.3 KB)
File Type: sp Get Plugin or Get Source (l4d_no_clone_of_infected.sp - 86 views - 2.9 KB)
__________________

Last edited by finishlast; 01-19-2022 at 15:07.
finishlast is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 01-29-2022 , 06:50   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #16

Quote:
Originally Posted by finishlast View Post
So all you need is to actually switch teams to incap or kill the bot, no need to spawn.
Interesting, I test myself and can trigger this bug 100% in l4d1. Nice observation,
it explains why sometimes survivor get killed/incapped for no reason in versus mode..

Your code is good, but it would affect all survivors and block every damage within 0.1 second since you are using global variable.

Here I come to share how I fix.
Both of them only apply to l4d1
l4d_nosecondchances.sp: When a spawned Infected Player disconnects or becomes Tank the AI SI will instantly get killed unless it has someone capped.
- Using "player_bot_replace" event is better than "player_team", game triggers this event when bot replaces player

l4d_switch_team_survivor_dead_fix: Fixed a bug sometimes infected player switchs team to survivor, the survivor gets incapped/killed instantly
- Using variables to record each player and save GetEngineTime(), block damage only if damage type is DMG_FALL
Attached Files
File Type: sp Get Plugin or Get Source (l4d_nosecondchances.sp - 108 views - 2.3 KB)
File Type: sp Get Plugin or Get Source (l4d_switch_team_survivor_dead_fix.sp - 115 views - 2.5 KB)
__________________

Last edited by HarryPotter; 01-29-2022 at 07:00.
HarryPotter is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 01-29-2022 , 12:34   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #17

Thanks harry that does seem to work also!

So they somehow take the fall dmg with them by switching, interesting
__________________
finishlast is offline
plug344
Member
Join Date: Dec 2021
Old 02-24-2022 , 07:21   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #18

Sorry, do L4D2 have these errors and need to be fixed?

Last edited by plug344; 02-25-2022 at 03:56.
plug344 is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 02-28-2022 , 04:35   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #19

Unsure about the bot cloning part, but for the instant death part, yes.
__________________
finishlast is offline
plug344
Member
Join Date: Dec 2021
Old 03-01-2022 , 18:52   Re: L4d - Prevent infected cloning on servers with unlimited team switching
Reply With Quote #20

Thank you very much for your reply.
plug344 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 13:41.


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