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

bot_quota control help CS/CZ bots


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ricky
Senior Member
Join Date: Jul 2005
Old 07-14-2017 , 16:04   bot_quota control help CS/CZ bots
Reply With Quote #1

Looking for a script that will control the bot_quota of cz bots/humans on either T or CT. For example, if bot_quota is set to 10, the number of players on both teams should total 10 at any given time. This excludes spectators and unassigned. There is this https://forums.alliedmods.net/showth...08253?p=808253 that works almost perfectly but it causes crashes sometimes right after a bot gets kicked and disconnects. Adding connected and team checks didn't help. Any help would be appreciated.

Last edited by Ricky; 07-14-2017 at 16:13.
Ricky is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-15-2017 , 04:50   Re: bot_quota control help CS/CZ bots
Reply With Quote #2

I'll check how it's done soon ( it has a cvar ), but do you have a steam counter strike or non steam counter strike?
eyal282 is offline
Ricky
Senior Member
Join Date: Jul 2005
Old 07-15-2017 , 16:20   Re: bot_quota control help CS/CZ bots
Reply With Quote #3

Currently running steam only, metamod 1.21-am, latest dev build amxx 1.8.3, windows. The crash happens when a real player joins team and a bot is kicked. For example, these are the last few logs before crash.

L 07/14/2017 - 113:52: "???<880><STEAM_0:1??????><>" joined team "TERRORIST"
L 07/14/2017 - 113:53: Server cvar "bot_quota" = "11"
L 07/14/2017 - 113:53: Kick: "Superbot<877><BOT><>" was kicked by "Console"
L 07/14/2017 - 113:53: "Superbot<877><BOT><TERRORIST>" disconnected

Last edited by Ricky; 07-15-2017 at 18:00.
Ricky is offline
Ricky
Senior Member
Join Date: Jul 2005
Old 07-18-2017 , 16:48   Re: bot_quota control help CS/CZ bots
Reply With Quote #4

Still trying to find a fix or replacement script for this function.

Code:
public check_players() {
	
	if(get_pcvar_num(g_bot_enabled)) {
		
		if(get_pcvar_num(g_bot_balance)) {
			
			new iPlayerNum
			
			for(new i = 1 ; i <= g_iMaxPlayers ; i++) {
				
				if(!is_user_bot(i)) {
					
					new team = get_user_team(i)
					if(team == 1 || team == 2)
						++iPlayerNum
				}
			}
			if(iPlayerNum <= get_pcvar_num(g_bot_max)) {
				
				set_pcvar_num(g_bot_quota, get_pcvar_num(g_bot_max) - iPlayerNum)
			}
			else if(iPlayerNum > get_pcvar_num(g_bot_max)) {
				
				if(get_pcvar_num(g_bot_quota) != 0) {
					
					set_pcvar_num(g_bot_quota, 0)
					
					for(new bi = 1 ; bi <= g_iMaxPlayers ; bi++) {
						
						if(is_user_bot(bi)){
							
							new userid = get_user_userid(bi)
							server_cmd("kick #%d", userid)
						}
					}
					return PLUGIN_HANDLED
				}
				return PLUGIN_HANDLED
			}
			check_balance()
		}
		else {
			if(get_pcvar_num(g_bot_max) < get_pcvar_num(g_bot_maxslots)) {
				
				set_pcvar_num(g_bot_quota, get_pcvar_num(g_bot_max))
				
				return PLUGIN_HANDLED
			}
		}
	}
	else {
		if(task_exists(TASK_CZBOT_MODE)) {
			
			remove_task(TASK_CZBOT_MODE)
		}
		set_pcvar_num(g_bot_quota, 0)
		
		for(new bi = 1 ; bi <= g_iMaxPlayers ; bi++) {
			
			if(is_user_bot(bi)){
				
				new userid = get_user_userid(bi)
				server_cmd("kick #%d", userid)
			}
		}
	}
	return PLUGIN_CONTINUE
}
Ricky is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 07-18-2017 , 18:17   Re: bot_quota control help CS/CZ bots
Reply With Quote #5

When do you call check_players?

Maybe doing a break after Kick the bot to stop the loop

Last edited by baneado; 07-18-2017 at 18:19.
baneado is offline
Ricky
Senior Member
Join Date: Jul 2005
Old 07-19-2017 , 00:44   Re: bot_quota control help CS/CZ bots
Reply With Quote #6

Quote:
Originally Posted by baneado View Post
When do you call check_players?

Maybe doing a break after Kick the bot to stop the loop
Code:
public plugin_cfg() {
	
	if(!get_pcvar_num(g_bot_enabled)) 
		return PLUGIN_HANDLED
	
	set_task(1.0, "check_players", TASK_CZBOT_MODE, _, _, "b")
	set_task(3.0, "map_loaded", TASK_CZBOT_SLOTS)
	
	return PLUGIN_CONTINUE
}
What line should I edit with the break code? Example?
Ricky is offline
Ricky
Senior Member
Join Date: Jul 2005
Old 07-31-2017 , 14:47   Re: bot_quota control help CS/CZ bots
Reply With Quote #7

Bump.
Ricky 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 16:37.


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