Raised This Month: $32 Target: $400
 8% 

Solved Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" != 2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-17-2019 , 11:16   Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" != 2
Reply With Quote #1

Hi,

L4D1 game is incorrectly set black/white state according to "survivor_max_incapacitated_count" ConVar.
When you set that ConVar e.g. to "4"
Quote:
sm_cvar "survivor_max_incapacitated_count" 4
Code:
public OnPluginStart()
{
	RegConsoleCmd("sm_test", CmdMessage); //,		ADMFLAG_ROOT);
}

public Action CmdMessage(int client, int args)
{
	int iRevCount = GetEntProp(client, Prop_Send, "m_currentReviveCount");
	int iGoingToDie = GetEntProp(client, Prop_Send, "m_isGoingToDie");
	
	PrintToChat(client, "iRevCount: %i, iGoingToDie: %i", iRevCount, iGoingToDie);
	
	//SetEntProp(client, Prop_Send, "m_isGoingToDie", 0);
	//SetEntProp(client, Prop_Send, "m_currentReviveCount", 3);
	
	return Plugin_Handled;
}
on start: (iRevCount: 0, iGoingToDie: 0)
after 1 incap/revive: (iRevCount: 1, iGoingToDie: 1)
after 2 incap/revive: you become black/white (iRevCount: 2, iGoingToDie: 1)
after 3 incap/revive: you become NOT black/white (iRevCount: 3, iGoingToDie: 1)
after 4 incap/revive: you stay NOT black/white (iRevCount: 4, iGoingToDie: 1)
5 incap = death.

How to fix that?

Also, "m_isGoingToDie" looks like useless. What is it for?
When I change it, nothing happen.

When I change "m_isGoingToDie" to 2 player become black/white.
When I change "m_isGoingToDie" to anything, but 2, player become NOT black/white.

Is there a way to make player not black/white other then changing "m_isGoingToDie" property?

Thanks.

=======

Not actual. Fixed by this plugin from SilverShot: https://forums.alliedmods.net/showthread.php?t=322132
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 03-18-2020 at 19:14.
Dragokas is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 01-18-2019 , 10:33   Re: Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" !=
Reply With Quote #2

Not sure if l4d1 has that property but you could maybe look for m_bIsOnThirdStrike or something similar like that and try to check / reset that one.
xerox8521 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-18-2019 , 11:04   Re: Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" !=
Reply With Quote #3

thank you.
In L4D1 no entities has m_bIsOnThirdStrike property.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-18-2019 at 11:04.
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-18-2019 , 12:01   Re: Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" !=
Reply With Quote #4

When become black/white:

Quote:
baseclass->m_clrRender (268 ) changed from -1 to -16776961
baseclass->m_iAddonBits (6144) changed from 23 to 39
CTerrorPlayer->m_currentReviveCount (7104) changed from 1 to 2
After medkit:

Quote:
baseclass->m_clrRender (268 ) changed from -16776961 to -1
baseclass->m_iAddonBits (6144) changed from 23 to 39
CTerrorPlayer->m_currentReviveCount (7104) changed from 2 to 0
Changing these props doesn't help:
Code:
	/*
	SetEntProp(client, Prop_Send, "m_clrRender", -16776961);
	SetEntProp(client, Prop_Send, "m_iAddonBits", 39);
	SetEntProp(client, Prop_Send, "m_isGoingToDie", 1);
	*/
	
	SetEntProp(client, Prop_Send, "m_clrRender", -1);
	SetEntProp(client, Prop_Send, "m_iAddonBits", 55);
	SetEntProp(client, Prop_Send, "m_isGoingToDie", 0);
	
	ChangeEdictState(client, 0);
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-18-2019 at 12:02.
Dragokas is offline
epzminion
AlliedModders Donor
Join Date: Jan 2011
Old 01-18-2019 , 12:49   Re: Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" !=
Reply With Quote #5

Quote:
Originally Posted by Dragokas View Post
Hi,
L4D1 game is incorrectly set black/white state according to "survivor_max_incapacitated_count" ConVar.
When you set that ConVar e.g. to "4"
Changes you make to survivor_max_incapacitated_count on the server aren't replicated on the clients, which will still have it at the default value of 2. Maybe that is causing the behavior you are seeing.
epzminion is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-18-2019 , 13:13   Re: Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" !=
Reply With Quote #6

thank you.
Looks like you are correct.
But it also, looks like it is not the only source of the problem.

Code:
public Action CmdTest(int client, int args)
{
	ConVar cvarMaxIncap = FindConVar("survivor_max_incapacitated_count");
	
	if (cvarMaxIncap != null)
	{
		if (cvarMaxIncap.Flags & FCVAR_REPLICATED == 0)
		{
			PrintToChat(client, "cvar had no FCVAR_REPLICATED flag: %i", cvarMaxIncap.Flags);
		
			cvarMaxIncap.Flags |= FCVAR_REPLICATED;
			
			PrintToChat(client, "cvar flags is now: %i", cvarMaxIncap.Flags);
		}
		
		cvarMaxIncap.SetInt(4, true, true);
		
		//just in case
		cvarMaxIncap.ReplicateToClient(client, "4");
	}
	else {
		PrintToChat(client, "cvar is not found");
	}

	return Plugin_Handled;
}
Quote:
cvar had no FCVAR_REPLICATED flag: 16388
cvar flags is now: 24580
SetConVar: Can't set server cvar survivor_max_incapacitated_count to 4, not marked as FCVAR_REPLICATED on client
SetConVar: Can't set server cvar survivor_max_incapacitated_count to 4, not marked as FCVAR_REPLICATED on client
Manual settings after server restart:

Quote:
] sm_cvar survivor_max_incapacitated_count 4

] survivor_max_incapacitated_count
"survivor_max_incapacitated_count" = "2"
game cheat
- How many times you can be incapacitated instead of killed between health kits.
] sm_cvar sv_cheats 1

] survivor_max_incapacitated_count 4
] survivor_max_incapacitated_count
"survivor_max_incapacitated_count" = "4" ( def. "2" )
game cheat
- How many times you can be incapacitated instead of killed between health kits.
Result = black/white after 2-nd incap/revive (as always)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
epzminion
AlliedModders Donor
Join Date: Jan 2011
Old 01-18-2019 , 20:52   Re: Left4dead incorrectly set black/white when "survivor_max_incapacitated_count" !=
Reply With Quote #7

Quote:
Originally Posted by Dragokas View Post
thank you.
Looks like you are correct.
But it also, looks like it is not the only source of the problem.

Result = black/white after 2-nd incap/revive (as always)
Just a thought but maybe you could work around the problem with something like the SendProxy Manager extension. It lets you modify the netprop values sent to all clients without actually changing them on the server. When a player's revive count is 1 to 3, you could report m_currentReviveCount as being 1 to clients, and when their revive count reaches 4, you could then report m_currentReviveCount as 2.
epzminion 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 23:08.


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