steps:
1. create a createmove hook so you can modify your local view angles and buttons (so you can shoot etc)
Code:
local function Aimbot( cmd )
end
hook.Add( "CreateMove", "aim butt", Aimbot )
2. loop through all the players and find a target, skipping players who are unsuitable (also grab our local entity cause we'll need it)
Code:
local function Aimbot( cmd )
local lp = LocalPlayer()
for k, v in pairs( player.GetAll() ) do
if not ( v:Alive() ) or ( v == lp ) or ( v:IsDormant() ) then continue end
end
end
hook.Add( "CreateMove", "aim butt", Aimbot )
3. find our aim position and call a function which does math for us to convert it into a angle (lookup "Math Behind the Hack #1 - Coding a Better Aimbot - Stop using CalcAngle" for good explanation and a better definition) and then set our angles to that
Code:
local function Aimbot( cmd )
local lp = LocalPlayer()
for k, v in pairs( player.GetAll() ) do
if not ( v:Alive() ) or ( v == lp ) or ( v:IsDormant() ) then continue end
local pos = ( v:GetPos() + v:OBBCenter() )
local ang = ( pos - lp:GetShootPos() ):Angle()
cmd:SetViewAngles( ang )
end
end
hook.Add( "CreateMove", "aim butt", Aimbot )
doesn't include vischeck or autofire or anything fancy, figure that out on your own
aim pos is middle of their bounding box
untested