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

[L4D2] No Boomer When Tank Spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hoanganh81097
Senior Member
Join Date: Apr 2016
Old 07-10-2018 , 14:29   [L4D2] No Boomer When Tank Spawn
Reply With Quote #1

Anyone can make plugin when tank spawn, no more boomer spawn ? (COOP)
Thank you

Last edited by hoanganh81097; 07-10-2018 at 14:29.
hoanganh81097 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 07-10-2018 , 16:59   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #2

Try this. Not tested though.

Code:
#include <sourcemod>

new Handle:g_hBoomerLimit;


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

	g_hBoomerLimit = FindConVar("z_boomer_limit");

}


public Event_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	SetConVarInt(g_hBoomerLimit, 0);
}

public PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	if (client <= 0 || client > MaxClients) return;
	new class = GetEntProp(client, Prop_Send, "m_zombieClass");
	if (class == 8) {
		SetConVarInt(g_hBoomerLimit, 1);
	}
}


public RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
	SetConVarInt(g_hBoomerLimit, 1);
}

Last edited by midnight9; 07-13-2018 at 16:40.
midnight9 is offline
hoanganh81097
Senior Member
Join Date: Apr 2016
Old 07-13-2018 , 14:31   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #3

not working
hoanganh81097 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 07-13-2018 , 16:42   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #4

Quote:
Originally Posted by hoanganh81097 View Post
not working
What exactly is not working? Btw can u recompile the code please. I've actually made a mistake and HookEvent("player_death", PlayerDeath); was missing. Ooops
midnight9 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 07-14-2018 , 06:02   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #5

Maybe a boomer spawned before the tank.

Code:
public Event_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	SetConVarInt(g_hBoomerLimit, 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, "releasing boomers"); //or forceplayersuicide. it has to be one that don't spread vomit into survivors.
		}
	}
}

Last edited by Visual77; 07-14-2018 at 06:04.
Visual77 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 07-14-2018 , 07:22   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #6

Quote:
Originally Posted by Visual77 View Post
Maybe a boomer spawned before the tank.

Code:
public Event_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	SetConVarInt(g_hBoomerLimit, 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, "releasing boomers"); //or forceplayersuicide. it has to be one that don't spread vomit into survivors.
		}
	}
}
That crossed my mind after i replied. I've tested the plugin for few minutes on coop and not a single boomer spawned while tank was alive.
midnight9 is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 07-14-2018 , 08:00   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #7

What about director variables (dvars > Cvars) they will be ignored if a vscript trigger or what ever else changes them will cause boomers to spawn!

https://developer.valvesoftware.com/...rector_Scripts
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
hoanganh81097
Senior Member
Join Date: Apr 2016
Old 07-14-2018 , 08:01   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #8

Quote:
Originally Posted by Lux View Post
What about director variables (dvars > Cvars) they will be ignored if a vscript trigger or what ever else changes them will cause boomers to spawn!

https://developer.valvesoftware.com/...rector_Scripts
i dont know how to use it
hoanganh81097 is offline
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
hoanganh81097
Senior Member
Join Date: Apr 2016
Old 07-14-2018 , 08:52   Re: [L4D2] No Boomer When Tank Spawn
Reply With Quote #10

Quote:
Originally Posted by midnight9 View Post
What exactly is not working? Btw can u recompile the code please. I've actually made a mistake and HookEvent("player_death", PlayerDeath); was missing. Ooops
Thank you so much, its work. But i used l4d_superversus.smx. So z_boomer_limit change 1 again .
hoanganh81097 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 21:33.


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