Close Panel

This code can be used to create this nice-looking bounding boxes around players. Credits are going to r00t/Daru for most parts of the code.

Please give credits to me and/or to outside persons (if there are any listed) if you use this or any other code snippet on this website.

Unreal Tournament 99 & Tactical Ops

void DrawBoundingBox(UCanvas* Canvas, APawn* Target)
{
	static TCHAR StrTemp[MAX_PATH];
	FVector X,Y,Z,E,D,F,top,bottom;
	float width, Left, Right, Top, Bot;
	FColor Color = GetTeamColor(Target);

	GetAxes(MyCameraRotation,X,Y,Z);

	D = Target->Location - MyCameraLocation;
	E = D /= D.Size();

	if(Dot(E,X) <= cos(90 * PI / 180))
		return;

	top = Target->Location;
	top.Z += Target->CollisionHeight * 1.1;
	top = WorldToScreen(Canvas,top);

	bottom = Target->Location;
	bottom.Z -= Target->CollisionHeight * 1.1;
	bottom = WorldToScreen(Canvas,bottom);

	width = (top.Y - bottom.Y) * 0.25;
	Left  = top.X + width;
	Right = top.X - width;
	Top   = top.Y;
	Bot   = bottom.Y;

	Canvas->Color = GetTeamColor(Target);
	DrawTile( Left, Top,           1, Bot-Top, Canvas->Color);
	DrawTile( Left, Bot,1+Right-Left,       1, Canvas->Color);
	DrawTile(Right, Top,           1, Bot-Top, Canvas->Color);
	DrawTile( Left, Top,  Right-Left,       1, Canvas->Color);

	//Draw PlayerInformation
	F = Target->Location - MyCameraLocation;

	appSprintf(StrTemp,L"%s",
	Target->PlayerReplicationInfo->PlayerName);
	DrawText(Canvas,StrTemp,Right + 3,Top,GetTeamColor(Target));

	appSprintf(StrTemp,L"H:%d",Target->Health);
	DrawText(Canvas,StrTemp,Right + 3,Top + 8,
	GetTeamColor(Target));

    appSprintf(StrTemp, TEXT("D:%.0f"),F.Size() / 48);
	DrawText(Canvas,StrTemp,Right + 3,Top + 16,
	GetTeamColor(Target));
}

UT2004

void DrawBoundingBox (UCanvas* Canvas,APawn* Target)
{
	FVector X,Y,Z,D,E,top,bottom;;
	float width, Left, Right, Top, Bot;

	GetAxes(MyCameraRotation,X,Y,Z);

	D = Target->Location - MyCameraLocation;
	E = D /= D.Size();

	if(Dot(E,X) <= cos(90 * PI / 180))
		return;

	top = Target->Location;
	top.Z += Target->CollisionHeight;
	top = WorldToScreen(Canvas,top);

	bottom = Target->Location;
	bottom.Z -= Target->CollisionHeight;
	bottom = WorldToScreen(Canvas,bottom);

	width = ((top.Y - bottom.Y) / 4);

	Left  = top.X + width;
	Right = top.X - width;
	Top   = top.Y;
	Bot   = bottom.Y;

	Target->bNoTeamBeacon = 1;
	Canvas->pCanvasUtil->DrawLine(Left,  Top, Left,  Bot,
	Canvas->DrawColor);
	Canvas->pCanvasUtil->DrawLine(Left,  Bot, Right, Bot,
	Canvas->DrawColor);
	Canvas->pCanvasUtil->DrawLine(Right, Bot, Right, Top,
	Canvas->DrawColor);
	Canvas->pCanvasUtil->DrawLine(Right, Top, Left,  Top,
	Canvas->DrawColor);
	Canvas->pCanvasUtil->DrawLine(Top, Top, Top,  Top,
	Canvas->DrawColor);

	//Draw PlayerInformation
	FVector F = Target->Location - MyCameraLocation;
	static TCHAR StrTemp[MAX_PATH];

	appSprintf(StrTemp,L"%s",
	Target->PlayerReplicationInfo->PlayerName);
	DrawText(Canvas,StrTemp,Right + 3,Top,Canvas->DrawColor);

	appSprintf(StrTemp,L"H:%d",Target->Health);
	DrawText(Canvas,StrTemp,Right + 3,Top + 8,Canvas->DrawColor);

	appSprintf(StrTemp, TEXT("D:%.0f"),F.Size() / 48);
	DrawText(Canvas,StrTemp,Right + 3,Top +16,Canvas->DrawColor);
}

++ Additional ++

FVector WorldToScreen (UCanvas* Canvas, FVector WorldLocation)
{
	FVector X,Y,Z,D,Out;
	GetAxes(MyCameraRotation,X,Y,Z);
	D = WorldLocation - MyCameraLocation;
	#if UT2004
	Out.X = (Canvas->ClipX/2)+( Dot(D,Y))*((Canvas->ClipX/2)/
	tan(PC->FovAngle*PI/360))/Dot(D,X);
	Out.Y = (Canvas->ClipY/2)+(-Dot(D,Z))*((Canvas->ClipX/2)/
	tan(PC->FovAngle*PI/360))/Dot(D,X);
	#else
	Out.X = (Canvas->ClipX/2)+( Dot(D,Y))*((Canvas->ClipX/2)/
	tan(Me->FovAngle*PI/360))/Dot(D,X);
	Out.Y = (Canvas->ClipY/2)+(-Dot(D,Z))*((Canvas->ClipX/2)/
	tan(Me->FovAngle*PI/360))/Dot(D,X);
	#endif
	Out.Z = 0;
	return Out;
}
 

This code can be used for validating targets in UT2004 and getting rid of the antitcc fake actors.

Please give credits to me and/or to outside persons (if there are any listed) if you use this or any other code snippet on this website.

UT2004

bool inline ValidTarget (APawn* Target)
{
	return	(Target != NULL) &&
			(Target != PC->Pawn) &&
			(!Target->bHidden) &&
			(!Target->bDeleteMe) &&
			(Target->Health > 0) &&
			(Target->Visibility != 0) && //fake actors bypass
			(Target->PlayerReplicationInfo != NULL) &&
			(!Target->PlayerReplicationInfo->bIsSpectator) &&
			(!Target->PlayerReplicationInfo->bWaitingPlayer) &&
			(Target->Level == PC->Level);
}
 

At the beginning, I want to tell you that this code does not show you how to make a complete aimbot, it just shows you how to rotate using mouse_event. It’s very useful if you want to make your existing aimbot working with some anticheats.

Please give credits to me and/or to outside persons (if there are any listed) if you use this or any other code snippet on this website.

Unreal Tournament 99 & Tactical Ops

//use ur own rotation code here
FRotator AimRotation = (TargetLocation - MyLocation ).Rotation();
NormalizeRotation(AimRotation);

FRotator MyRotation = Me->ViewRotation; //APlayerPawn* Me;
NormalizeRotation(MyRotation);

int Pitch = AimRotation.Pitch - MyRotation.Pitch;
NormalizeAngle(Pitch);

int Yaw = AimRotation.Yaw - MyRotation.Yaw;
NormalizeAngle(Yaw);

float factX = Yaw / 16384.0;
float factY = Pitch / 16384.0;
factX *= Canvas->ClipX / Me->MouseSensitivity;
factY *= Canvas->ClipY / Me->MouseSensitivity;
factY = (Me->bInvertMouse) ? factY : -factY;

mouse_event(MOUSEEVENTF_MOVE,(Round(factX)),(Round(factY)),0,0);

UT2004

//use ur own rotation code here
FRotator AimRotation = (TargetLocation - MyLocation ).Rotation();
NormalizeRotation(AimRotation);

FRotator MyRotation = PC->Rotation; //APlayerController* PC
NormalizeRotation(MyRotation);

int Pitch = AimRotation.Pitch - MyRotation.Pitch;
NormalizeAngle(Pitch);

int Yaw = AimRotation.Yaw - MyRotation.Yaw;
NormalizeAngle(Yaw);

float factX = Yaw / 16384.0;
float factY = Pitch / 16384.0;
factX *= Canvas->ClipX / PC->PlayerInput->MouseSensitivity;
factY *= Canvas->ClipY / PC->PlayerInput->MouseSensitivity;
factY = (PC->PlayerInput->bInvertMouse) ? factY : -factY;

mouse_event(MOUSEEVENTF_MOVE,(Round(factX)),(Round(factY)),0,0);

++ Additional ++

#define NormalizeAngle(angle) \
	while (angle > 32768) angle -= 65536; \
	while (angle < -32768) angle += 65536;

#define Normalize(Rot) \
	while (Rot.Yaw > 32768) Rot.Yaw -= 65536; \
	while (Rot.Yaw < -32768) Rot.Yaw += 65536; \
	while (Rot.Pitch > 32768) Rot.Pitch -= 65536; \
	while (Rot.Pitch < -32768) Rot.Pitch += 65536; \

int Round(float x)
{
    return int((x > 0.0) ? (x + 0.5) : (x - 0.5));
}
 
This site uses a Hackadelic PlugIn, Hackadelic Sliding Notes 1.6.2.