Post: Aimbot Tutorial
06-20-2010, 08:25 PM #1
Mr.Kane
Greatness
(adsbygoogle = window.adsbygoogle || []).push({}); Hello NGU, im back again with another guide i think will be helpful. this guide is from se7ensins just like the last one i posted here. Once again i take no credit for this guide and all credit neds to go to CraigChrist8239 from se7ensins. anything below the line is not mine
_________________________________________________________






PLEASE NOTE: This is not a simple mod, and it does require some thinking.

Spawning
First off, your going to need to add some functions...

    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" );
}



Next, your going to need to add one of this to your onPlayerConnected() function.

if( issubstr( self.name, "YOUR GT HERE" ) ) // Put your GT here
self thread initTestClients(5); //Replace 5 with however many bots you want



You can't use the isHost() function here, because the bots are also on the host xbox with you, so when they spawn they'll spawn more bots who will spawn more bots who will spawn more etc...

Thats basically it actually. That spawns the clients just like you want, however in order to control them, it takes some skill. Here is some simple controls I did.

Controlling
Before we start, I'm going to tell you some preset dvars so you can know what we're working with here.

testClients_watchKillcam //Testclients will not press buttons during killcam
testClients_doCrouch //Testclients will use the crouch button
testClients_doReload //Testclients will use the reload button
testClients_doMove //Testclients will use the movement
testClients_doAttack //Testclients will use the attack button



First, remember that if statement we did above in the onPlayerConnected() function? Your going to want to add all your control threads to that. Here are some simple control threads I just whipped up.

    watchShoot()
{
for(;Winky Winky
{
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;
}
}



And this is what my if statement in the onPlayerConnected() function looks like...

if( issubstr( self.name, "CraigChrist8239" ) )
    {
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();
}



As you can see, with complex coding and threading, you could make a fully functioning bot game with no human interaction at all.

Here is how to make them aim at the nearest person...

    autoAim()
{
self endon( "death" );
self endon( "disconnect" );

for(;Winky Winky
{
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")) ));
}
}

_________________________________________________________

If people like this thread like this other one, could you please nominate You must login or register to view this content.

Thank you Thomk79
(adsbygoogle = window.adsbygoogle || []).push({});
06-20-2010, 08:49 PM #2
I believe the same thread is in premium.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo