Advertisement
martintokio

Untitled

Sep 1st, 2022 (edited)
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. function getPlayersAround(radius, ...)
  2.     local t = {...}
  3.     local players = {}
  4.     if type(radius) == "table" then
  5.         range, multiFloor = radius[1], radius[2]
  6.     else
  7.         range, multiFloor = radius, false
  8.     end
  9.     local spectators = Self.GetSpectators()
  10.     for i = 1, #spectators do
  11.         local creature = spectators[i]
  12.         if creature:isPlayer() and creature:DistanceFromSelf() <= range then
  13.             if not table.contains(t, creature:Name()) then
  14.                 table.insert(players, creature)
  15.             end
  16.         end
  17.     end
  18.     return players
  19. end
  20. function playersAround(radius, ...)
  21.     if getPlayersAround(radius, ...) then
  22.         return #getPlayersAround(radius, ...)
  23.     else
  24.         return 0
  25.     end
  26. end
  27.  
  28. while true do
  29.     if not XenoBot.IsPaused() then
  30.     if playersAround(8) > 0 then
  31.         setTargetingEnabled(false)
  32.         Self.StopAttack() -- Cancel attack
  33.     else
  34.         setTargetingEnabled(true)
  35.     end
  36. end
  37. end
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement