Raised This Month: $27 Target: $400
 6% 

[CSGO] Plugin edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sajmooooon
Senior Member
Join Date: Nov 2018
Location: Slovakia
Old 04-07-2020 , 10:32   [CSGO] Plugin edit
Reply With Quote #1

Can someone edit this plugin that will works only if CT<T and it will block B site ? Thanks.
Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <cstrike>

int g_Site;

public void OnPluginStart()
{        
    HookEvent("round_freeze_end", Event_RoundFreezeEnd); 
}

public void OnMapStart()
{
    g_Site = FindEntityByClassname(-1, "func_bomb_target"); // Find site A
}

public void OnConfigsExecuted()
{
    ConVar cvar = FindConVar("mp_join_grace_time");
    
    if (cvar)
    {
        cvar.IntValue = 0;
    }
}

public void Event_RoundFreezeEnd(Event event, const char[] name, bool dontBroadcast)
{
    int num = GetAliveCT(), ent = g_Site;
    
    if (num)
    {
        if (num < 5)
        {        
            while ((ent = FindEntityByClassname(ent, "func_bomb_target")) != -1)
            {
                AcceptEntityInput(ent, "Disable");
            }
            
            return;
        }
    }
    
    while ((ent = FindEntityByClassname(ent, "func_bomb_target")) != -1) 
    {
        AcceptEntityInput(ent, "Enable");
    }
}

int GetAliveCT()
{
    int num;
    
    for (int i = 1; i <= MaxClients; i++)
    {
        if (IsClientInGame(i))
        {
            if (GetClientTeam(i) != CS_TEAM_CT) continue;
            if (IsPlayerAlive(i)) num++;
        }
    }
    
    return num;
}
Sajmooooon is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 04-07-2020 , 12:12   Re: [CSGO] Plugin edit
Reply With Quote #2

You have to get the 2nd func_bomb_target entity on your map since it's depending on which one was created first in hammer editor.
__________________
zipcore 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 01:12.


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