scld

팬텀포스 esp

Sep 18th, 2021 (edited)
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.89 KB | None | 0 0
  1. local client = {}; do
  2.     -- Tables
  3.     client.esp = {}
  4.    
  5.     -- Modules
  6.     for i,v in pairs(getgc(true)) do
  7.         if (type(v) == "table") then
  8.             if (rawget(v, "getplayerhealth")) then
  9.                 client.hud = v
  10.             elseif (rawget(v, "getplayerhit")) then
  11.                 client.replication = v
  12.             end
  13.         end
  14.     end
  15.  
  16.     client.chartable = debug.getupvalue(client.replication.getbodyparts, 1)
  17. end
  18.  
  19. client.esp.Options = {
  20.     Enable = true,
  21.     TeamCheck = true,
  22.     TeamColor = false,
  23.     VisibleOnly = false,
  24.     Color = Color3.fromRGB(255, 0, 255),
  25.     Name = true,
  26.     Box = true,
  27.     Health = false,
  28.     Distance = false,
  29.     Tracer = false
  30. }
  31.  
  32. client.esp.Services = setmetatable({}, {
  33.     __index = function(Self, Index)
  34.         local GetService = game.GetService
  35.         local Service = GetService(game, Index)
  36.  
  37.         if Service then
  38.             Self[Index] = Service
  39.         end
  40.  
  41.         return Service
  42.     end
  43. })
  44.  
  45. local function GetDrawingObjects()
  46.     return {
  47.         Name = Drawing.new("Text"),
  48.         Box = Drawing.new("Quad"),
  49.         Tracer = Drawing.new("Line"),
  50.     }
  51. end
  52.  
  53. local function CreateEsp(Player)
  54.     local Objects = GetDrawingObjects()
  55.     local Character = client.chartable[Player].head.Parent
  56.     local Head = Character.Head
  57.     local HeadPosition = Head.Position
  58.     local Head2dPosition, OnScreen = workspace.CurrentCamera:WorldToScreenPoint(HeadPosition)
  59.     local Origin = workspace.CurrentCamera.CFrame.p
  60.     local HeadPos = Head.Position
  61.     local IgnoreList = { Character, client.esp.Services.Players.LocalPlayer.Character, workspace.CurrentCamera, workspace.Ignore }
  62.     local PlayerRay = Ray.new(Origin, HeadPos - Origin)
  63.     local Hit = workspace:FindPartOnRayWithIgnoreList(PlayerRay, IgnoreList)
  64.  
  65.     local function Create()
  66.         if (OnScreen) then
  67.             local Name = ""
  68.             local Health = ""
  69.             local Distance = ""
  70.    
  71.             if (client.esp.Options.Name) then
  72.                 Name = Player.Name
  73.             end
  74.    
  75.             if (client.esp.Options.Health) then
  76.                 local Characters = debug.getupvalue(client.replication.getplayerhit, 1)
  77.                 Health = " [ " .. client.hud:getplayerhealth(Characters[Character]) .. "% ]"
  78.             end
  79.    
  80.             if (client.esp.Options.Distance) then
  81.                 Distance = " [ " .. math.round((HeadPosition - workspace.CurrentCamera.CFrame.p).Magnitude) .. " studs ]"
  82.             end
  83.    
  84.             Objects.Name.Visible = true
  85.             Objects.Name.Transparency = 1
  86.             Objects.Name.Text = string.format("%s%s%s", Name, Health, Distance)
  87.             Objects.Name.Size = 18
  88.             Objects.Name.Center = true
  89.             Objects.Name.Outline = true
  90.             Objects.Name.OutlineColor = Color3.fromRGB(0, 0, 0)
  91.             Objects.Name.Position = Vector2.new(Head2dPosition.X, Head2dPosition.Y)
  92.    
  93.             if (client.esp.Options.TeamColor) then
  94.                 Objects.Name.Color = Player.Team.TeamColor.Color
  95.             else
  96.                 Objects.Name.Color = Color3.fromRGB(255, 255, 255)
  97.             end
  98.    
  99.             if (client.esp.Options.Box) then
  100.                 local Part = Character.HumanoidRootPart
  101.                 local Size = Part.Size * Vector3.new(1, 1.5)
  102.                 local Sizes = {
  103.                     TopRight = (Part.CFrame * CFrame.new(-Size.X, -Size.Y, 0)).Position,
  104.                     BottomRight = (Part.CFrame * CFrame.new(-Size.X, Size.Y, 0)).Position,
  105.                     TopLeft = (Part.CFrame * CFrame.new(Size.X, -Size.Y, 0)).Position,
  106.                     BottomLeft = (Part.CFrame * CFrame.new(Size.X, Size.Y, 0)).Position,
  107.                 }
  108.    
  109.                 local TL, OnScreenTL = workspace.CurrentCamera:WorldToScreenPoint(Sizes.TopLeft)
  110.                 local TR, OnScreenTR = workspace.CurrentCamera:WorldToScreenPoint(Sizes.TopRight)
  111.                 local BL, OnScreenBL = workspace.CurrentCamera:WorldToScreenPoint(Sizes.BottomLeft)
  112.                 local BR, OnScreenBR = workspace.CurrentCamera:WorldToScreenPoint(Sizes.BottomRight)
  113.    
  114.                 if (OnScreenTL and OnScreenTR and OnScreenBL and OnScreenBR) then
  115.                     Objects.Box.Visible = true
  116.                     Objects.Box.Transparency = 1
  117.                     Objects.Box.Thickness = 2
  118.                     Objects.Box.Filled = false
  119.                     Objects.Box.PointA = Vector2.new(TL.X, TL.Y + 36)
  120.                     Objects.Box.PointB = Vector2.new(TR.X, TR.Y + 36)
  121.                     Objects.Box.PointC = Vector2.new(BR.X, BR.Y + 36)
  122.                     Objects.Box.PointD = Vector2.new(BL.X, BL.Y + 36)
  123.    
  124.                     if (client.esp.Options.TeamColor) then
  125.                         Objects.Box.Color = Player.Team.TeamColor.Color
  126.                     else
  127.                         Objects.Box.Color = client.esp.Options.Color
  128.                     end
  129.                 end
  130.             end
  131.    
  132.             if (client.esp.Options.Tracer) then
  133.                 local CharTorso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
  134.                 local Torso, OnScreen = workspace.CurrentCamera:WorldToScreenPoint(CharTorso.Position)
  135.    
  136.                 if (OnScreen) then
  137.                     Objects.Tracer.Visible = true
  138.                     Objects.Tracer.Transparency = 1
  139.                     Objects.Tracer.Thickness = 2
  140.                     Objects.Tracer.From = Vector2.new(workspace.CurrentCamera.ViewportSize.X / 2, workspace.CurrentCamera.ViewportSize.Y / 2)
  141.                     Objects.Tracer.To = Vector2.new(Torso.X, Torso.Y + 36)
  142.    
  143.                     if (client.esp.Options.TeamColor) then
  144.                         Objects.Tracer.Color = Player.Team.TeamColor.Color
  145.                     else
  146.                         Objects.Tracer.Color = client.esp.Options.Color
  147.                     end
  148.                 end
  149.             end
  150.         end
  151.     end
  152.  
  153.     if (client.esp.Options.VisibleOnly) then
  154.         if (Hit == nil) then
  155.             Create()
  156.         end
  157.     else
  158.         Create()
  159.     end
  160.  
  161.     client.esp.Services.RunService.Heartbeat:Wait()
  162.     client.esp.Services.RunService.Heartbeat:Wait()
  163.  
  164.     Objects.Name:Remove()
  165.     Objects.Box:Remove()
  166.     Objects.Tracer:Remove()
  167. end
  168.  
  169. client.esp.Services.RunService.RenderStepped:Connect(function()
  170.     local LocalPlayer = client.esp.Services.Players.LocalPlayer
  171.  
  172.     for i,v in pairs(client.esp.Services.Players:GetPlayers()) do
  173.         if (v and client.chartable[v] and v.Name ~= LocalPlayer.Name) then
  174.             if (client.esp.Options.Enable) then
  175.                 if (client.esp.Options.TeamCheck) then
  176.                     if (v.Team ~= LocalPlayer.Team) then
  177.                         CreateEsp(v)
  178.                     end
  179.                 else
  180.                     CreateEsp(v)
  181.                 end
  182.             end
  183.         end
  184.     end
  185. end)
Add Comment
Please, Sign In to add comment