local dis
local pos
local PropPlayers
local GetPosition
local Num = {}
for i = 0,32 do
Num[i] = 16000;
end
local function HowManyPropsAlive()
local CountPlayer={}
for k,v in next,team.GetPlayers(2) do --team.GetPlayers(2) are props
if(v:Alive()) then
table.insert(CountPlayer,v)
end
end
return #CountPlayer
end
local function CHECK(Prop)
PropPlayers = HowManyPropsAlive()
for j = 0,32 do
if(PropPlayers == 0) then Num[j] = 16000 return end
Num[j] = Prop[PropPlayers]
PropPlayers = PropPlayers - 1
end
return
end
local function main()
if (team.GetName(LocalPlayer():Team()) == "Hunters") then
local Prop = {}
for k,v in next,team.GetPlayers(2) do
pos = v:GetPos():ToScreen()
if v:Alive() and v != LocalPlayer() then
dis = math****und(v:GetPos():Distance(LocalPlayer():GetPos()),0)
table.insert(Prop,dis)
end
end
for k,v in next,team.GetPlayers(2) do
CHECK(Prop)
if math****und(math.min(Num[0],Num[1],Num[2],Num[3],Num[4],Num[5],Num[6],Num[7],Num[8],Num[9],Num[10],Num[11],Num[12],Num[13],Num[14],Num[15],Num[16],Num[17],Num[18],Num[19],Num[20],Num[21],Num[22],Num[23],Num[24],Num[25],Num[26],Num[27],Num[28],Num[29],Num[30],Num[31]) , 0 ) == math****und(v:GetPos():Distance(LocalPlayer():GetPos()),0) then
pos = v:GetPos()
if (input.IsKeyDown(KEY_F)) then
GetPosition = (Vector( pos.x,pos.y,pos.z+5) - LocalPlayer():GetShootPos()):Angle()
LocalPlayer():SetEyeAngles(GetPosition)
CHECK(Prop)
end
end
end
end
end
timer.Create( "ThisShouldBeLongToGetLessErrors", 0.001 , 0 , main)
-- You only ever need to call this once, LocalPlayer will never change in-game.
local me = LocalPlayer()
local PropAimbot = function(cmd)
-- Check if F is being pressed and you're on team "Hunters".
if (!input.IsButtonDown(KEY_F) or me:Team() ~= TEAM_HUNTERS) then return end
-- If we make this global it might produce errors.
local Target = nil
-- Cache LocalPlayer's position, we don't need to call it every iteration in the loop.
local MyPos, ShortestDistance = me:GetPos(), math.huge
-- Loop through players on team "Props".
for i, ply in ipairs(team.GetPlayers(TEAM_PROPS)) do
-- If the player isn't alive then ignore them
if !(ply:Alive()) then continue end
-- Get the distance between LocalPlayer's position and ply's position.
-- Use Vector:DistToSqr(OtherVector) for stuff like this, Vector:Distance(OtherVector) would be a waste of CPU cycles.
local Distance = MyPos:DistToSqr(ply:GetPos())
-- If Distance is smaller than ShortestDistance it means it's even shorter.
if (ShortestDistance > Distance) then
-- Make Target the player so we can use it later on.
Target = ply
-- Set ShortestDistance to the new shortest distance.
ShortestDistance = Distance
end
end
-- Target will be nil if the above loop doesn't find any targets and would throw errors.
if (Target) then
-- This would get the center of the target's model.
local vec = Target:GetPos() + Target:OBBCenter()
-- Get the angle pointing to the target.
local ang = (vec - me:GetShootPos()):Angle()
-- Finally, set your view angles to the above angle.
cmd:SetViewAngles(ang)
end
end
-- CreateMove is the most reliable hook to use for aimbots.
hook.Add("CreateMove", "Prophunt Aimbot", PropAimbot)
!(input.IsButtonDown(KEY_F) or me:Team() ~= TEAM_HUNTERS)
!input.IsButtonDown(KEY_F) or me:Team() ~= TEAM_HUNTERS
