View Single Post
Visual77
Veteran Member
Join Date: Jan 2009
Old 07-14-2018 , 08:40   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #9

something like this:

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

ConVar g_hBoomerLimit;

public void OnPluginStart()
{
	HookEvent("tank_spawn", Event_TankSpawn);
	HookEvent("round_start", RoundStart);
        HookEvent("player_death", PlayerDeath);

	g_hBoomerLimit = FindConVar("z_boomer_limit");
}

public Action Event_TankSpawn(Event event, const char[] name, bool dontBroadcast)
{
	g_hBoomerLimit.SetBounds(ConVarBound_Upper, true, 0.0);
	g_hBoomerLimit.SetBounds(ConVarBound_Lower, true, 0.0);
	g_hBoomerLimit.SetInt(0);

	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && GetClientTeam(i) == 3 && IsPlayerAlive(i) && GetEntProp(i, Prop_Send, "m_zombieClass") == 2)
		{
			KickClient(i, "No boomer during tank spawn");
		}
	}
}

public Action PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid")); 
	if (client <= 0 || client > MaxClients || !IsClientInGame(client)) return;

	if (GetEntProp(client, Prop_Send, "m_zombieClass") == 8)
	{
		g_hBoomerLimit.SetBounds(ConVarBound_Upper, false);
		g_hBoomerLimit.SetBounds(ConVarBound_Lower, false);
		g_hBoomerLimit.SetInt(1);
	}
}


public Action RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	g_hBoomerLimit.SetBounds(ConVarBound_Upper, false);
	g_hBoomerLimit.SetBounds(ConVarBound_Lower, false);
	g_hBoomerLimit.SetInt(1);

}

Last edited by Visual77; 07-14-2018 at 14:41.
Visual77 is offline