AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [L4D2] No Boomer When Tank Spawn (https://forums.alliedmods.net/showthread.php?t=309022)

hoanganh81097 07-10-2018 14:29

[L4D2] No Boomer When Tank Spawn
 
Anyone can make plugin when tank spawn, no more boomer spawn ? (COOP)
Thank you :D

midnight9 07-10-2018 16:59

Re: [L4D2] No Boomer When Tank Spawn
 
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);
}


hoanganh81097 07-13-2018 14:31

Re: [L4D2] No Boomer When Tank Spawn
 
not working :(

midnight9 07-13-2018 16:42

Re: [L4D2] No Boomer When Tank Spawn
 
Quote:

Originally Posted by hoanganh81097 (Post 2603364)
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 :down:

Visual77 07-14-2018 06:02

Re: [L4D2] No Boomer When Tank Spawn
 
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.
                }
        }
}


midnight9 07-14-2018 07:22

Re: [L4D2] No Boomer When Tank Spawn
 
Quote:

Originally Posted by Visual77 (Post 2603471)
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.

Lux 07-14-2018 08:00

Re: [L4D2] No Boomer When Tank Spawn
 
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

hoanganh81097 07-14-2018 08:01

Re: [L4D2] No Boomer When Tank Spawn
 
Quote:

Originally Posted by Lux (Post 2603505)
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

Visual77 07-14-2018 08:40

Re: [L4D2] No Boomer When Tank Spawn
 
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);

}


hoanganh81097 07-14-2018 08:52

Re: [L4D2] No Boomer When Tank Spawn
 
Quote:

Originally Posted by midnight9 (Post 2603383)
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 :down:

Thank you so much, its work. But i used l4d_superversus.smx. So z_boomer_limit change 1 again .


All times are GMT -4. The time now is 20:04.

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