Raised This Month: $ Target: $400
 0% 

bot_quota control help CS/CZ bots


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:11.


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