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

Solved [CSGO] auto bots kicker!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 03-15-2019 , 00:26   [CSGO] auto bots kicker!!
Reply With Quote #1

hi guys !!

i need one script for enable and disable auto bot kicker for comptitive mod server.

thank you guys

Last edited by Dr.Mohammad; 04-17-2019 at 16:51.
Dr.Mohammad is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 03-15-2019 , 15:16   Re: [CSGO] auto bots kicker!!
Reply With Quote #2

Hi there.

So I did the plugin as you asked here. There is the source code

I remember that the plugin creates a Config File on csgo/cfg/sourcemod/BotKick.cfg when server is restarted or on map change if plugin is uploaded to the server...
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Bot Kick",
    
author PLUGIN_AUTHOR,
    
description "Bot Kick",
    
version PLUGIN_VERSION,
    
url ""
};

ConVar g_enabled;

public 
void OnPluginStart()
{
    
HookEvent("round_start"EventRoundStartEventHookMode_PostNoCopy);
    
g_enabled CreateConVar("sm_enable_botkick""1""Enables bot kick on server start, values > 1 enables this feature");
    
AutoExecConfig(true"BotKick");
}

public 
Action EventRoundStart(Event eventchar[] namebool bDontBroadcast)
{
    
int Enabled GetConVarInt(g_enabled);
    if(
Enabled 1// check if plugin enabled
    
{
        
PrintToServer("bot_kick");
        return 
Plugin_Handled;
    }
    else if(
Enabled 1// check if plugin is disabled
    
{
        return 
Plugin_Handled;
    }
    return 
Plugin_Handled;

The source code as .sp and the plugin as .smx is attached.

Hope I could help and have a nice day
Attached Files
File Type: sp Get Plugin or Get Source (bot_kick.sp - 541 views - 957 Bytes)
File Type: smx bot_kick.smx (4.1 KB, 192 views)
__________________

Last edited by SpirT; 03-15-2019 at 15:16. Reason: Add info
SpirT is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 03-15-2019 , 15:28   Re: [CSGO] auto bots kicker!!
Reply With Quote #3

Quote:
Originally Posted by SpirT View Post
Hi there.

So I did the plugin as you asked here. There is the source code

I remember that the plugin creates a Config File on csgo/cfg/sourcemod/BotKick.cfg when server is restarted or on map change if plugin is uploaded to the server...
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Bot Kick",
    
author PLUGIN_AUTHOR,
    
description "Bot Kick",
    
version PLUGIN_VERSION,
    
url ""
};

ConVar g_enabled;

public 
void OnPluginStart()
{
    
HookEvent("round_start"EventRoundStartEventHookMode_PostNoCopy);
    
g_enabled CreateConVar("sm_enable_botkick""1""Enables bot kick on server start, values > 1 enables this feature");
    
AutoExecConfig(true"BotKick");
}

public 
Action EventRoundStart(Event eventchar[] namebool bDontBroadcast)
{
    
int Enabled GetConVarInt(g_enabled);
    if(
Enabled 1// check if plugin enabled
    
{
        
PrintToServer("bot_kick");
        return 
Plugin_Handled;
    }
    else if(
Enabled 1// check if plugin is disabled
    
{
        return 
Plugin_Handled;
    }
    return 
Plugin_Handled;

The source code as .sp and the plugin as .smx is attached.

Hope I could help and have a nice day
nice !! :XX
Dr.Mohammad is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 03-15-2019 , 16:37   Re: [CSGO] auto bots kicker!!
Reply With Quote #4

Quote:
Originally Posted by SpirT View Post
Hi there.

So I did the plugin as you asked here. There is the source code

I remember that the plugin creates a Config File on csgo/cfg/sourcemod/BotKick.cfg when server is restarted or on map change if plugin is uploaded to the server...
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "SpirT"
#define PLUGIN_VERSION "1.0"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Bot Kick",
    
author PLUGIN_AUTHOR,
    
description "Bot Kick",
    
version PLUGIN_VERSION,
    
url ""
};

ConVar g_enabled;

public 
void OnPluginStart()
{
    
HookEvent("round_start"EventRoundStartEventHookMode_PostNoCopy);
    
g_enabled CreateConVar("sm_enable_botkick""1""Enables bot kick on server start, values > 1 enables this feature");
    
AutoExecConfig(true"BotKick");
}

public 
Action EventRoundStart(Event eventchar[] namebool bDontBroadcast)
{
    
int Enabled GetConVarInt(g_enabled);
    if(
Enabled 1// check if plugin enabled
    
{
        
PrintToServer("bot_kick");
        return 
Plugin_Handled;
    }
    else if(
Enabled 1// check if plugin is disabled
    
{
        return 
Plugin_Handled;
    }
    return 
Plugin_Handled;

The source code as .sp and the plugin as .smx is attached.

Hope I could help and have a nice day

Enabled > 1???
Why??
Just do

PHP Code:
if (Enabled)
{
//...

Also what's the point of checking if plugin is disabled if you just ignore it.
Also you have to use ServerCommand instead of PrintToServer.

Plugin is okay, and I think it works, but you can do better)

Last edited by impossible_cc; 03-15-2019 at 16:45.
impossible_cc is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 03-15-2019 , 17:26   Re: [CSGO] auto bots kicker!!
Reply With Quote #5

Quote:
Originally Posted by impossible_cc View Post
Enabled > 1???
Why??
Just do

PHP Code:
if (Enabled)
{
//...

Also what's the point of checking if plugin is disabled if you just ignore it.
Also you have to use ServerCommand instead of PrintToServer.

Plugin is okay, and I think it works, but you can do better)
or even cleaner

PHP Code:
public void EventRoundStart(Event eventchar[] namebool bDontBroadcast) {
    if (!
Enabled) return;
    ...


Last edited by Mathias.; 03-15-2019 at 17:27.
Mathias. is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 03-15-2019 , 19:35   Re: [CSGO] auto bots kicker!!
Reply With Quote #6

Quote:
Originally Posted by impossible_cc View Post
Enabled > 1???
Why??
Just do

PHP Code:
if (Enabled)
{
//...

Also what's the point of checking if plugin is disabled if you just ignore it.
Also you have to use ServerCommand instead of PrintToServer.

Plugin is okay, and I think it works, but you can do better)
Thanks for your reply. Yes, it works as the way I done it, I tested it on my server...
__________________
SpirT is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 03-15-2019 , 21:55   Re: [CSGO] auto bots kicker!!
Reply With Quote #7

Quote:
Originally Posted by SpirT View Post
Thanks for your reply. Yes, it works as the way I done it, I tested it on my server...
It's work when the plugin get loaded, not on you event round_start. PrintToServer do not execute commands. The issue with competitive mode is even if you put bot_quota 0, bots will join and override the value if you keep switching teams when your the only player on the server.
you can add -nobots into your server command line and will enforce that no bots can be added.

Last edited by Mathias.; 03-15-2019 at 21:57.
Mathias. is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 03-16-2019 , 08:37   Re: [CSGO] auto bots kicker!!
Reply With Quote #8

Since the plugin SpirT posted absolutely does not work... I've made something that does in the most efficient way I could think of.
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hCVEnabled;

public 
void OnPluginStart()
{
    
g_hCVEnabled CreateConVar("sm_botkick_enabled""1""Enable this plugin? 1 = Enabled, 0 = Disabled");
    
g_hCVEnabled.AddChangeHook(ConVar_Changed);
    
HookEvent("round_start"Event_RoundStart);
}

public 
void ConVar_Changed(ConVar convar, const char[] oldValue, const char[] newValue)
{
    if(
g_hCVEnabled.BoolValueServerCommand("bot_quota 0");
    else 
ServerCommand("bot_quota 10");
}

public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if(
g_hCVEnabled.BoolValueServerCommand("bot_quota 0");
    else 
ServerCommand("bot_quota 10");

CliptonHeist is offline
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 03-16-2019 , 12:51   Re: [CSGO] auto bots kicker!!
Reply With Quote #9

Quote:
Originally Posted by CliptonHeist View Post
Since the plugin SpirT posted absolutely does not work... I've made something that does in the most efficient way I could think of.
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hCVEnabled;

public 
void OnPluginStart()
{
    
g_hCVEnabled CreateConVar("sm_botkick_enabled""1""Enable this plugin? 1 = Enabled, 0 = Disabled");
    
g_hCVEnabled.AddChangeHook(ConVar_Changed);
    
HookEvent("round_start"Event_RoundStart);
}

public 
void ConVar_Changed(ConVar convar, const char[] oldValue, const char[] newValue)
{
    if(
g_hCVEnabled.BoolValueServerCommand("bot_quota 0");
    else 
ServerCommand("bot_quota 10");
}

public 
void Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if(
g_hCVEnabled.BoolValueServerCommand("bot_quota 0");
    else 
ServerCommand("bot_quota 10");

So if I disable this plugin I get 10 bots always. Really?
bot_quota is convar so you can take this value as FindConVar("bot_quota").IntValue, store it and then, on ConVar_Changed restore it.
impossible_cc is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 03-16-2019 , 17:07   Re: [CSGO] auto bots kicker!!
Reply With Quote #10

Quote:
Originally Posted by impossible_cc View Post
So if I disable this plugin I get 10 bots always. Really?
bot_quota is convar so you can take this value as FindConVar("bot_quota").IntValue, store it and then, on ConVar_Changed restore it.
Well I was thinking about this and I wondered why doesn't OP just set the bot_quota themselves? It'd have the same effect as an auto bot kicker unless they just want bots to be removed when they join the server in which case you'd just need to check for bots at OnClientAuthorized and kick them. As usual unclear requirements have led to undesired results.
CliptonHeist 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 23:55.


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