View Single Post
Balimbanana
Member
Join Date: Jan 2017
Old 06-09-2020 , 21:15   Re: Client index 0 is invalid
Reply With Quote #6

It is from a take damage hook (by the error message).
From what I have gathered, this generally happens if you are running a listen-server SourceMod, where the host is client 0, but the actual player entity is at 1. You could change it to:
Code:
if(test)
{
	if (client == 0)
	{
		if (IsValidEntity(client+1)) client++;
		else return Plugin_Continue;
	}
	if(GetClientTeam(client) == 2)
	{
		if(GetClientTeam(attacker) == GetClientTeam(client) && IsFreezed[client] && !IsFreezed[attacker])
		{
			SetEntityMoveType(client, MOVETYPE_WALK);
			SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
			SetEntityRenderColor(client, 255, 255, 255, 255);
			IsFreezed[client] = false;
			--FreezeCount;
		} 
		else if(GetClientTeam(attacker) != GetClientTeam(client) && !IsFreezed[client])
		{
			SetEntityMoveType(client, MOVETYPE_NONE);
			SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 0.0);
			SetEntityRenderColor(client, 0, 0, 255, 255);
			IsFreezed[client] = true;
			++FreezeCount;
		}
	}
}
Also, I haven't seen the ++ or -- before the variable before, but I suppose if it works, then ok.

Last edited by Balimbanana; 06-10-2020 at 02:20.
Balimbanana is offline