Raised This Month: $32 Target: $400
 8% 

Need easy pluing to exec bot_kick when 4 players in server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 09-12-2018 , 15:09   Need easy pluing to exec bot_kick when 4 players in server
Reply With Quote #1

Hello

I need a plugin to kick_bot when 4 players are playing in server.

Because with bot_auto_vacate doesn't working with my cfg serv.

If someone has an idea, i take it
vegeta1241 is offline
generalmemer
Member
Join Date: Sep 2017
Old 09-17-2018 , 13:10   Re: Need easy pluing to exec bot_kick when 4 players in server
Reply With Quote #2

PHP Code:
#include <sourcemod> 

public void OnClientPutInServer(int iClient)
{
    if( 
GetClientCount(true) >= )
        
ServerCommand("bot_kick");

generalmemer is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 09-18-2018 , 11:50   Re: Need easy pluing to exec bot_kick when 4 players in server
Reply With Quote #3

Quote:
Originally Posted by generalmemer View Post
PHP Code:
#include <sourcemod> 

public void OnClientPutInServer(int iClient)
{
    if( 
GetClientCount(true) >= )
        
ServerCommand("bot_kick");

That will execute the command every single time a player joins if there are at least 4 players already. That will also count players that are bots.

Use this code instead:
PHP Code:
#include <sourcemod>

int g_iCount;

public 
void OnPluginStart()
{
    for (
int i 1<= MaxClientsi++)
        if (
IsClientInGame(i) && !IsFakeClient(i))
            
g_iCount++;

    if (
g_iCount >= 4)
        
ServerCommand("bot_kick");
}

public 
void OnClientPostAdminCheck(int client)
{
    if (!
IsFakeClient(client))
        
g_iCount++;

    if (
g_iCount == 4)
        
ServerCommand("bot_kick");
}

public 
void OnClientDisconnect(int client)
{
    if (!
IsFakeClient(client))
        
g_iCount--;


Last edited by ThatKidWhoGames; 09-18-2018 at 11:56.
ThatKidWhoGames 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 17:29.


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