Results 1 to 7 of 7

Thread: Add test clients

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    This is my old Addbots script.
    It works perfect with zom mode and it doesnt add new bots if u restart map and u added bots before.
    You can always add new bots to the game and it will add max 60 Bots.
    Also you can work with the bots with self.pers["bot"], just add at callbackPlayerConnect() if(!isDefined(self.pers["bot"])) self.pers["bot"] = false;

    Code:
    addTestClients()
    {	
    	if(!isDefined(level.botsConnected))
    		level.botsConnected = 0;
    		
    	setCvar("scr_testclients","0");
    	
    	ent = [];
    
    	wait 10; //Give server some time to initialize other scripts
    
    	for(;;)
    	{
    		if(getCvarInt("scr_testclients") > 0)
    			break;
    		
    		wait 1;
    	}
    	
    	if(level.botsConnected >= 60)
    		return; //Give some free player slots.
    
    	testclients = getCvarInt("scr_testclients");
    	for(i = 0; i < testclients; i++)
    	{
    		wait .3; //Lets give server some time to add the bots, if they get a welcome message it shouldnt lagg anymore
    		ent[i] = addtestclient();
    		ent[i] thread TestClient();
    		
    		level.botsConnected++;
    		//iprintln("DEBUG: Bots Connected: " + level.botsConnected);
    	}
    	
    	thread addTestClients();
    }
    
    TestClient()
    {
    	self.pers["bot"] = true;
    	
    	wait 3; //Give server some time to add the bot
    	
    	self notify("menuresponse", game["menu_team"], "autoassign");
    	wait 1;
    	
    	for(;;)
    	{
    		if(getCvar("g_gametype") == "zom")
    		{
    			switch(randomInt(23)) //Later chnange to level.alliesWeapon[randomInt(level.alliesWeapon.size)]
    			{
    				case 0:
    				case 1:
    						self notify("menuresponse", game["menu_weapon_allies"], "greasegun_mp");
    					break;
    				case 2:
    						self notify("menuresponse", game["menu_weapon_allies"], "m1carbine_mp");
    					break;
    
    				case 3:
    						self notify("menuresponse", game["menu_weapon_allies"], "m1garand_mp");
    					break;
    
    				case 4:
    						self notify("menuresponse", game["menu_weapon_allies"], "springfield_mp");
    					break;
    				
    				case 5:
    						self notify("menuresponse", game["menu_weapon_allies"], "thompson_mp");
    					break;
    
    				case 6:
    						self notify("menuresponse", game["menu_weapon_allies"], "bar_mp");
    					break;
    
    				case 7:
    						self notify("menuresponse", game["menu_weapon_allies"], "sten_mp");
    					break;
    				
    				case 8:
    						self notify("menuresponse", game["menu_weapon_allies"], "enfield_mp");
    					break;
    
    				case 9:
    						self notify("menuresponse", game["menu_weapon_allies"], "enfield_scope_mp");
    					break;
    
    				case 10:
    						self notify("menuresponse", game["menu_weapon_allies"], "bren_mp");
    					break;
    
    				case 11:
    						self notify("menuresponse", game["menu_weapon_allies"], "PPS42_mp");
    					break;
    
    				case 12:
    						self notify("menuresponse", game["menu_weapon_allies"], "mosin_nagant_mp");
    					break;
    
    				case 13:
    						self notify("menuresponse", game["menu_weapon_allies"], "SVT40_mp");
    					break;
    					
    				case 14:
    						self notify("menuresponse", game["menu_weapon_allies"], "mosin_nagant_sniper_mp");
    					break;
    					
    				case 15:
    						self notify("menuresponse", game["menu_weapon_allies"], "ppsh_mp");
    					break;
    					
    				case 16:
    						self notify("menuresponse", game["menu_weapon_allies"], "mp40_mp");
    					break;
    					
    				case 17:
    						self notify("menuresponse", game["menu_weapon_allies"], "kar98k_mp");
    					break;
    					
    				case 18:
    						self notify("menuresponse", game["menu_weapon_allies"], "g43_mp");
    					break;
    					
    				case 19:
    						self notify("menuresponse", game["menu_weapon_allies"], "kar98k_sniper_mp");
    					break;
    					
    				case 20:
    						self notify("menuresponse", game["menu_weapon_allies"], "mp44_mp");
    					break;
    					
    				case 21:
    						self notify("menuresponse", game["menu_weapon_allies"], "shotgun_mp");
    					break;
    					
    				case 22:
    						self notify("menuresponse", game["menu_weapon_allies"], "chainsaw_mp");
    					break;
    					
    				case 23:
    						self notify("menuresponse", game["menu_weapon_allies"], "flametrower_mp");
    					break;
    			}
    		}
    		else
    		{
    			if (self.pers["team"]=="allies")
    				self notify("menuresponse", game["menu_weapon_axis"], "springfield_mp");
    			else
    				self notify("menuresponse", game["menu_weapon_axis"], "kar98k_mp");
    		}
    		wait 1.5;
    	}
    }
    No ... No ... this is not possible .......

  2. The Following 4 Users Say Thank You to Earliboy For This Useful Post:

    EvoloZz (25th February 2013),Killer.Pro (18th February 2013),kung foo man (18th February 2013),Ni3ls (18th February 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •