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(PLUGIN, VERSION, AUTHOR)
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 iBot, iHuman
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 id, iCount=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?