Noctural

BIG Paintball Source

Feb 5th, 2023 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.06 KB | None | 0 0
  1. shared.fov = shared.fov or 400
  2.  
  3. repeat task.wait() until game:IsLoaded()
  4. if not hookmetamethod then game.Players.LocalPlayer:Kick('your exploit is not supported') end
  5.  
  6. local players = game:GetService('Players')
  7. local RunService = game:GetService('RunService')
  8. local Teams = game:GetService('Teams')
  9. local user_input_service = game:GetService('UserInputService')
  10. local workspace = game:GetService('Workspace')
  11.  
  12. local camera = workspace.CurrentCamera
  13. local wtvp = camera.WorldToViewportPoint
  14. local localplayer = players.LocalPlayer
  15.  
  16. local function indexExists(object, index)
  17.     local _, value = pcall(function() return object[index] end)
  18.     return value
  19. end
  20.  
  21. local function get_character(player) return indexExists(player, 'Character') end
  22.  
  23. local function get_mouse_location() return user_input_service:GetMouseLocation() end
  24.  
  25. local function is_alive(player) return player.Character and player.Character:FindFirstChild('Humanoid') and player.Character:FindFirstChild('Humanoid').Health > 0 end
  26. local function is_team(player) return #Teams:GetChildren() > 0 and player.Team == localplayer.Team end
  27.  
  28. local function getClosestPlayerToCursor(fov)
  29.  
  30.     local maxDistance = fov or math.huge
  31.  
  32.     local closestPlayer = nil
  33.     local closestPlayerDistance = math.huge
  34.  
  35.     for _, player in pairs(players:GetPlayers()) do
  36.  
  37.         if player ~= localplayer and not is_team(player) and get_character(player) and is_alive(player) then
  38.             local pos, on_screen = wtvp(camera, get_character(player).Head.Position)
  39.  
  40.             if not on_screen then continue end
  41.  
  42.             local distance = (get_mouse_location() - Vector2.new(pos.X, pos.Y)).magnitude
  43.  
  44.             if distance <= maxDistance and distance < closestPlayerDistance then
  45.                 closestPlayer = player
  46.                 closestPlayerDistance = distance
  47.             end
  48.         end
  49.     end
  50.  
  51.     return closestPlayer
  52. end
  53.  
  54. local circle = Drawing.new('Circle')
  55. circle.Thickness = 2
  56. circle.NumSides = 12
  57. circle.Radius = shared.fov or 400
  58. circle.Filled = false
  59. circle.Transparency = 1
  60. circle.Color = Color3.new(1, 0, 0.384313)
  61. circle.Visible = true
  62. local target = nil
  63. RunService.Heartbeat:Connect(function(deltaTime)
  64.     task.wait(deltaTime ^ 2)
  65.     target = getClosestPlayerToCursor(shared.fov)
  66.     circle.Position = get_mouse_location()
  67. end)
  68.  
  69. local OldNamecall
  70. OldNamecall = hookmetamethod(workspace, '__namecall', newcclosure(function(...)
  71.     local args = { ... }
  72.     local method = string.lower(getnamecallmethod())
  73.     local caller = getcallingscript()
  74.     if method == 'findpartonraywithwhitelist' and tostring(caller) == 'First Person Controller' then
  75.  
  76.         local HitPart = target and target.Character and target.Character.Head or nil
  77.         if HitPart then
  78.             local Origin = HitPart.Position + Vector3.new(0, 5, 0)
  79.             local Direction = (HitPart.Position - Origin)
  80.             args[2] = Ray.new(Origin, Direction)
  81.  
  82.             return OldNamecall(unpack(args))
  83.         else
  84.             return OldNamecall(...)
  85.         end
  86.     end
  87.     return OldNamecall(...)
  88. end))
Advertisement
Add Comment
Please, Sign In to add comment