Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

local aimbotList = {"OptimalAces821",""}

local function StringInTable(str, tbl)


for _, value in ipairs(tbl) do
if value == str then
return true
end
end
return false
end

Events.ProjectileLaunched(function(event)
if (event.shooter == nil) then
return
end
if (event.projectileType == "arrow") or (event.projectileType ==
"crossbow_arrow") or (event.projectileType == "tactical_crossbow_arrow") or
(event.projectileType == "headhunter_arrow") or (event.projectileType ==
"tactical_headhunter_arrow") then

local player = event.shooter:getPlayer()


if StringInTable(player.name, aimbotList) == true then
local target = nil
local targetDistance = 100000000

for i, enemy in PlayerService.getPlayers() do


if (not enemy:getEntity():isAlive()) then
continue
end

local enemyPosition = enemy:getEntity():getPosition()


local playerPosition = player:getEntity():getPosition()
local distance = (enemyPosition - playerPosition).magnitude

if (distance < targetDistance) and (StringInTable(enemy.name,


aimbotList) == false) and TeamService.getTeam(enemy) ~= TeamService.getTeam(player)
then
target = enemy
targetDistance = distance
end
end
if (event.projectileType == "arrow") then
CombatService.damage(target:getEntity(), 25)
elseif (event.projectileType == "crossbow_arrow") then
CombatService.damage(target:getEntity(), 35)
elseif (event.projectileType == "tactical_crossbow_arrow") then
CombatService.damage(target:getEntity(), 50)
elseif(event.projectileType == "tactical_headhunter_arrow") then
CombatService.damage(target:getEntity(), 60)
end
end
end
end)

You might also like