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

[CS:S] Bot announce blocker


Post New Thread Reply   
 
Thread Tools Display Modes
Author
RacingRat
New Member
Join Date: Dec 2020
Location: Brussels, BE
Plugin ID:
7436
Plugin Version:
1.1
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    This plugin blocks bot join and disconnect chat messages.
    Old 12-30-2020 , 12:20   [CS:S] Bot announce blocker
    Reply With Quote #1

    Some plugins already have this included but I wanted a standalone version.

    There are no variables, just put the .smx file into your plugin folder and bot names will not be announced anymore.

    Restart your server after adding the plugin.

    V1.1: fixed event loop (oopsie).

    Code:
    #include <sourcemod>
    #include <sdktools>
    #include <sdkhooks>
    
    #pragma semicolon 1
    
    #define PLUGIN_VERSION "1.1"
    #define PLUGIN_DESCRIPTION "Blocks bot announce messages."
    
    public Plugin:myinfo =
                 {
                     name = "Bot announce blocker",
                     author = "RacingRat",
                     description = PLUGIN_DESCRIPTION,
                     version = PLUGIN_VERSION,
                     url = ""
                }
    
    new bool:playerConnectFire = true;
    new bool:playerConnectClientFire = true;
    new bool:playerDisconnectFire = true;
    
    public OnPluginStart()
    {
        HookEvent("player_connect", PlayerConnect, EventHookMode_Pre);
        HookEvent("player_connect_client", PlayerConnectClient, EventHookMode_Pre);
        HookEvent("player_disconnect", PlayerDisconnect, EventHookMode_Pre);
    }
    
    public OnPluginEnd()
    {
        UnhookEvent("player_connect", PlayerConnect, EventHookMode_Pre);
        UnhookEvent("player_connect_client", PlayerConnectClient, EventHookMode_Pre);
        UnhookEvent("player_disconnect", PlayerDisconnect, EventHookMode_Pre);
    }
    
    public Action:PlayerConnect(Handle:event, const String:name[], bool:dontBroadcast)
    {
        if (playerConnectFire && GetEventInt(event, "bot") == 1)
        {
            decl String:clientName[33], String:networkID[22], String:address[32];
            GetEventString(event, "name", clientName, sizeof(clientName));
            GetEventString(event, "networkid", networkID, sizeof(networkID));
            GetEventString(event, "address", address, sizeof(address));
    
            new Handle:newEvent = CreateEvent("player_connect", true);
            SetEventString(newEvent, "name", clientName);
            SetEventInt(newEvent, "index", GetEventInt(event, "index"));
            SetEventInt(newEvent, "userid", GetEventInt(event, "userid"));
            SetEventString(newEvent, "networkid", networkID);
            SetEventString(newEvent, "address", address);
    
            playerConnectFire = false;
            FireEvent(newEvent, true);
            playerConnectFire = true;
    
            return Plugin_Handled;
        }
    
        return Plugin_Continue;
    }
    
    public Action:PlayerConnectClient(Handle:event, const String:name[], bool:dontBroadcast)
    {
        if (playerConnectClientFire && GetEventInt(event, "bot") == 1)
        {
            decl String:clientName[33], String:networkID[22];
            GetEventString(event, "name", clientName, sizeof(clientName));
            GetEventString(event, "networkid", networkID, sizeof(networkID));
    
            new Handle:newEvent = CreateEvent("player_connect_client", true);
            SetEventString(newEvent, "name", clientName);
            SetEventInt(newEvent, "index", GetEventInt(event, "index"));
            SetEventInt(newEvent, "userid", GetEventInt(event, "userid"));
            SetEventString(newEvent, "networkid", networkID);
    
            playerConnectClientFire = false:
            FireEvent(newEvent, true);
            playerConnectClientFire = true;
    
            return Plugin_Handled;
        }
    
        return Plugin_Continue;
    }
    
    public Action:PlayerDisconnect(Handle:event, const String:name[], bool:dontBroadcast)
    {
        if (playerDisconnectFire && GetEventInt(event, "bot") == 1)
        {
            decl String:clientName[33], String:networkID[22];
            GetEventString(event, "name", clientName, sizeof(clientName));
            GetEventString(event, "networkid", networkID, sizeof(networkID));
    
            new Handle:newEvent = CreateEvent("player_connect_client", true);
            SetEventString(newEvent, "name", clientName);
            SetEventInt(newEvent, "index", GetEventInt(event, "index"));
            SetEventInt(newEvent, "userid", GetEventInt(event, "userid"));
            SetEventString(newEvent, "networkid", networkID);
    
            playerDisconnectFire = false;
            FireEvent(newEvent, true);
            playerDisconnectFire = true;
    
            return Plugin_Handled;
        }
    
        return Plugin_Continue;
    }
    botannounceblocker.smx

    botannounceblocker.sp

    Last edited by RacingRat; 12-30-2020 at 13:05. Reason: Added source code in post
    RacingRat is offline
    Reply



    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 22:15.


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