fov aimbot
ay im new to lua coding and im just wondering how your supposed to make a aimbot with a fov.
local IgnoreTeam = true
function GetPos(ply)
return ply:GetAttachment(ply:LookupAttachment("forward")).Pos
end
function CheckVisible(ply)
local trc = {
start = LocalPlayer():GetShootPos(),
endpos = GetPos(ply),
filter = {ply,LocalPlayer()},
mask = MASK_SHOT
}
local trace = util.TraceLine(trc)
return trace.Fraction == 1
end
function GetPlayer(fov)
local ply = LocalPlayer()
for k,v in next, player.GetAll() do
if !v then continue end
if v == ply then continue end
if !v:IsPlayer() then continue end
if IgnoreTeam and (ply:Team() == v:Team()) then continue end
if v:InVehicle() then continue end
if !CheckVisible(v) then continue end
if v:Team() == TEAM_SPECTATOR then continue end
if 0 >= v:Health() then continue end
if !v:Alive() then continue end
local mang = ply:EyeAngles()
local tang = (v:GetPos() - ply:GetShootPos()):Angle()
if (math.AngleDifference(mang.x, tang.x) + math.AngleDifference(mang.y, tang.y)) > fov then continue end
return v
end
return nil
end