Lua Aim Prediction
Is there a way to have accurate aimbot using GLua?
for k,v in pairs (ents.FindByClass(aimClass)) do
if v ~= LP and !v:IsDormant() and v:IsValid() and v:Health() > 0 then
if aimClass == "player" then
aimPredTarget = ( v:GetVelocity() * ( (engine.TickInterval()) ))
aimPredPlayer = ( LP:GetVelocity() * ( (engine.TickInterval()) ))
else
aimPredTarget = ( v:GetVelocity() * ( (engine.TickInterval()) ))
aimPredPlayer = ( LP:GetVelocity() * ( (engine.TickInterval()) ))
end
local targetBone = ENT["GetHitBoxBone"](v,0,0)
local min,max = ENT["GetHitBoxBounds"](v,0,0)
local _Matrix = ENT["GetBoneMatrix"](v, targetBone);
if !_Matrix then return end
_Matrix = VM["ToTable"](_Matrix)
local TargetPos = (Transform(min, _Matrix) + Transform(max,_Matrix))* 0.5
local TargetAimPos = (TargetPos-aimPredTarget-aimPredPlayer)
local rc = util.TraceLine(
{
start = LP:GetShootPos(),
endpos = TargetPos,
filter = {LP}
}
)
if v:Health() > 0 and rc.Entity == v and (LP:GetActiveWeapon():GetNextPrimaryFire() - CurTime()) < 0.01 then
pCmd:SetViewAngles( (TargetAimPos - (LP:GetShootPos()) ):Angle())
pCmd:SetViewAngles( pCmd:GetViewAngles() - LP:GetViewPunchAngles() )
--FixMovement(pCmd)
end
if canFire(v, TargetPos) and (LP:GetActiveWeapon():GetNextPrimaryFire() - CurTime()) < 0.01 then
pCmd:SetButtons(bit.bor(pCmd:GetButtons(), 1))
else
end
end
end