.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   YaPB (http://forums.bots-united.com/forumdisplay.php?f=55)
-   -   [FIX] Better method for auto vacate. (http://forums.bots-united.com/showthread.php?t=10024)

wbyokomo 12-06-2016 12:32

[FIX] Better method for auto vacate.
 
I'm tired of auto vacate issue, it's not work as i want.

Here i attach a possible fix for this issue, but it was in pawn language, i hope you can convert to cpp language.

I have 0 knowledge about cpp.

Fix:
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Yapb Quota Fix"
#define VERSION "0.0.1"
#define AUTHOR "wbyokomo"

//lets say this is yb_quota cvar
#define MAX_BOT 9

new iMaxClients

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
iMaxClients get_maxplayers()
    
    
register_forward(FM_ClientDisconnect"OnClientDisconnectPost"1)
}

public 
client_putinserver(id)
{
    
UTIL_BotQuota()
}

//yes we need to use post
public OnClientDisconnectPost(id)
{
    
UTIL_BotQuota()
}

UTIL_BotQuota()
{
    new 
iBotiHuman
    iHuman 
UTIL_CountHumans()
    
iBot MAX_BOT iHuman
    
if(iBot)
    {
        
//here we set our bot count (iBot) correctly.
    
}
    else
    {
        
//human count >= 9, so we dont need bots anymore, kick them all.
    
}
}

UTIL_CountHumans()
{
    new 
idiCount=0
    
for(id=1;id<=iMaxClients;id++)
    {
        
//count only connected human, not a bot or hltv.
        
if(is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id))
        {
            
iCount++
        }
    }
    
    return 
iCount;


With this method:
  • 1 bot will leave if 1 human join.
  • 1 bot will join if 1 human leave.
Max bot is decided by yb_quota value.. easy right?

jeefo 22-06-2016 11:22

Re: [FIX] Better method for auto vacate.
 
Hi! Yup, i can't test quota working right, i have no server with real player.

Can you please test some beta versions and give some feedback?

jeefo 23-06-2016 11:33

Re: [FIX] Better method for auto vacate.
 
http://rgho.st/8wwTqXZwp first attempt


All times are GMT +2. The time now is 06:38.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.