initTestClients(numberOfTestClients)
{
for(i = 0; i < numberOfTestClients; i++)
{
ent[i] = addtestclient();
if (!isdefined(ent[i]))
{
wait 1;
continue;
}
ent[i].pers["isBot"] = true;
ent[i] thread initIndividualBot();
wait 0.1;
}
}
initIndividualBot()
{
self endon( "disconnect" );
while(!isdefined(self.pers["team"]))
wait .05;
self notify("menuresponse", game["menu_team"], "autoassign");
wait 0.5;
self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
self waittill( "spawned_player" );
}
watchShoot()
{
for(;
{
while(self AttackButtonPressed())
{
setDvar( "testClients_doAttack", 1 );
wait 0.1;
}
setDvar( "testClients_doAttack", 0 );
wait 0.1;
}
}
watchCrouch()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "bbutton", "+stance" );
for( ;; )
{
if ( self GetStance() == "crouch" )
setDvar( "testClients_doCrouch", 1 );
else
setDvar( "testClients_doCrouch", 0 );
wait 0.1;
}
}
{
self thread watchShoot();
self thread watchCrouch();
self thread initTestClients(5);
}
Now, lets say you want to provide all the bots with a certain function, say god mode. You can accomplish that this way.
foreach(isBot in level.players)
{
if( isBot.pers[ "isBot" ] )
isBot thread doGod();
}
autoAim()
{
self endon( "death" );
self endon( "disconnect" );
for(;
{
wait 0.05;
aimAt = level.players[0];
foreach(player in level.players)
{
if(player == self)
continue;
if(isAlive(player))
continue;
if(closer(self.origin, player.origin, aimAt.origin))
aimAt = player;
}
self setplayerangles(VectorToAngles( (aimAt gettagorigin("j_head")) - (self gettagorigin("j_head")) ));
}
}
Copyright © 2026, NextGenUpdate.
All Rights Reserved.