plytalent

19/1/2022

Jan 19th, 2022 (edited)
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.04 KB | None | 0 0
  1. -- compatibility Layer --
  2. rconsoleinfo = rconsoleinfo or function() end
  3. -- SYN X ONLY IF NOT HAVE COMPATIBILITY LAYER --
  4. local protective_call_wrapper = function(real)
  5.     if type(real) == "function" then
  6.         local fake = function(...)
  7.             local args = {...}
  8.             local s,e_res = pcall(function()
  9.                 return {real(unpack(args))}
  10.             end)
  11.             if not s then
  12.                 rconsoleinfo("ERROR: "..tostring(e_res)) -- EXTERNAL CONSOLE
  13.             else
  14.                 return unpack(e_res)
  15.             end
  16.         end
  17.         return fake
  18.     end
  19.     return real
  20. end
  21.  
  22. local MS_Bind = Instance.new("BindableEvent")
  23. local RS = game:GetService("RunService")
  24. local PathfindingService = game:GetService("PathfindingService")
  25.  
  26. local path = PathfindingService:CreatePath({
  27.     AgentRadius = 3,
  28.     AgentHeight = 6,
  29.     AgentCanJump = false,
  30.     Costs = {
  31.         Water = 20
  32.     }
  33. })
  34. local localplayer = game:GetService("Players").LocalPlayer
  35. local Render3DFPS = 0
  36. local Render3DTick = tick()
  37. local lasttick = tick()
  38. local timing = lasttick - tick()
  39. local options = {
  40.     enabled          = true,
  41.     character_render = true,
  42.     pathfind         = false
  43. }
  44. local players = {}
  45. local players_characters = {}
  46. local gcolor = Color3.fromHSV(tick() * 128 % 255/255, 1, 1)
  47.  
  48. create3Dboxin2DScreen = protective_call_wrapper(create3Dboxin2DScreen)
  49. getboundingpoint = protective_call_wrapper(getboundingpoint)
  50. listworldpoint_to_viewpoint = protective_call_wrapper(listworldpoint_to_viewpoint)
  51. render_part_throught_wall = protective_call_wrapper(render_part_throught_wall)
  52. createrectangle = protective_call_wrapper(createrectangle)
  53. worldpoint_to_viewpoint = protective_call_wrapper(worldpoint_to_viewpoint)
  54. synTextLabel = protective_call_wrapper(synTextLabel)
  55. high_speed = protective_call_wrapper(high_speed)
  56. all_in_fov = protective_call_wrapper(all_in_fov)
  57. Lerp = protective_call_wrapper(Lerp)
  58.  
  59. spawn(protective_call_wrapper(function()
  60.     while true do
  61.         rconsoleclear()
  62.         printconsole(string.format("1) enabled:\t%s\n2) character render:\t%s\n3) pathfinding\t%s\n",tostring(options.enabled),tostring(options.character_render),tostring(options.pathfind)),0xff,0xff,0xff)
  63.         local cmd_input = rconsoleinput():split(" ")
  64.         if cmd_input[1] == "1" then
  65.             options.enabled = not options.enabled
  66.         elseif cmd_input[1] == "2" then
  67.             options.character_render = not options.character_render
  68.         elseif cmd_input[1] == "3" then
  69.             options.pathfind = not options.pathfind
  70.         end
  71.         wait()
  72.     end
  73. end))
  74.  
  75. local playeradded = game:GetService("Players").PlayerAdded:Connect(protective_call_wrapper(function(plr)
  76.     players[plr.Name] = synTextLabel()
  77.     players_characters[plr.Name] = {}
  78. end))
  79.  
  80. local playerremoving = game:GetService("Players").PlayerRemoving:Connect(protective_call_wrapper(function(plr)
  81.     if players[plr.Name] then
  82.         players[plr.Name].Visible = false
  83.         spawn(function()
  84.             while true do
  85.                 wait()
  86.                 local s, _ = pcall(function()
  87.                     players[plr.Name]:remove()
  88.                 end)
  89.                 if s then
  90.                     break
  91.                 end
  92.             end
  93.         end)
  94.     end
  95.     if players_characters[plr.Name] then
  96.         for partname, faces in pairs(players_characters[plr.Name]) do
  97.             for facename, drawingobject in pairs(faces) do
  98.                 spawn(function()
  99.                     local drawingobject = drawingobject
  100.                     drawingobject.Visible = false
  101.                     while true do
  102.                         wait()
  103.                         local s, _ = pcall(function()
  104.                             drawingobject:remove()
  105.                         end)
  106.                         if s then
  107.                             break
  108.                         end
  109.                     end
  110.                 end)
  111.             end
  112.         end
  113.     end
  114. end))
  115.  
  116. function all_in_fov(list)
  117.     for _,boolean in pairs(list) do
  118.         if not boolean[1] then
  119.             return false
  120.         end
  121.     end
  122.     return true
  123. end
  124. function high_speed()
  125.     timing = tick() - lasttick
  126.     if timing >= 1/1000 then
  127.         lasttick = tick()
  128.         MS_Bind:Fire(timing)
  129.     end
  130. end
  131.  
  132. function listworldpoint_to_viewpoint(poslist)
  133.     local newarray = {}
  134.     for i,pos in pairs(poslist) do
  135.         newarray[i] = {worldpoint_to_viewpoint(pos)}
  136.     end
  137.     return newarray
  138. end
  139.  
  140. function Lerp(a,b,t) -- a = current_value, b = target_value, t = percent max_value = 1
  141.     return a * (1-t) + b * t
  142. end
  143.  
  144. function synTextLabel()
  145.     local TextLabel = Drawing.new("Text")
  146.     TextLabel.Text = "Place"
  147.     TextLabel.Size = 24
  148.     TextLabel.Center = true
  149.     TextLabel.Outline = true
  150.     TextLabel.Color = Color3.new(255/255, 0/255, 0/255)
  151.     TextLabel.OutlineColor = Color3.new(0, 0, 0)
  152.     return TextLabel
  153. end
  154.  
  155. function worldpoint_to_viewpoint(pos)
  156.     local pos, in_fov = workspace.CurrentCamera:WorldToViewportPoint(pos.p)
  157.     return in_fov, Vector2.new(pos.X,pos.Y)
  158. end
  159.  
  160. function getboundingpoint(part)
  161.     local pos = part.CFrame
  162.     local Dfc = part.Size/2
  163.     local partmesh = part:FindFirstChildOfClass("SpecialMesh")
  164.     if partmesh then
  165.         Dfc = partmesh.Scale/2
  166.     end
  167.     local bounding3D = {
  168.         pos*CFrame.new(Dfc.X,  Dfc.Y, Dfc.Z),   -- 1, 1, 1 1
  169.         pos*CFrame.new(Dfc.X, Dfc.Y, -Dfc.Z),   -- 1, 1, 0 2
  170.  
  171.         pos*CFrame.new(-Dfc.X, Dfc.Y, -Dfc.Z),  -- 0, 1, 0 3
  172.         pos*CFrame.new(-Dfc.X,  Dfc.Y, Dfc.Z),  -- 0, 1, 1 4
  173.  
  174.         pos*CFrame.new(-Dfc.X,-Dfc.Y, Dfc.Z),   -- 0, 0, 1 5
  175.         pos*CFrame.new(-Dfc.X, -Dfc.Y, -Dfc.Z), -- 0, 0, 0 6
  176.  
  177.         pos*CFrame.new(Dfc.X, -Dfc.Y, -Dfc.Z),  -- 1, 0, 0 7
  178.         pos*CFrame.new(Dfc.X, -Dfc.Y, Dfc.Z)    -- 1, 0, 1 8
  179.     }
  180.     return bounding3D
  181. end
  182.  
  183. function createrectangle(properties)
  184.     local rectangle = Drawing.new("Quad")
  185.     local defaultproperties = {
  186.         Visible = false,
  187.         Thickness = 0.5,
  188.         PointA = Vector2.new(0,0,0),
  189.         PointB = Vector2.new(0,0,0),
  190.         PointC = Vector2.new(0,0,0),
  191.         PointD = Vector2.new(0,0,0),
  192.         Color = Color3.new(1,1,1),
  193.         Filled = true
  194.     }
  195.     for property,value in pairs(defaultproperties)do
  196.         if properties[property] then
  197.             value = properties[property]
  198.         end
  199.         local success, err = pcall(function()
  200.             rectangle[property] = value
  201.         end)
  202.     end
  203.     return rectangle
  204. end
  205. function update3Dboxin2DScreen(faces,visible,pos1,pos2,pos3,pos4,pos5,pos6,pos7,pos8)
  206.     if #faces < 1 then
  207.         rconsoleinfo("Faces Length = 0")
  208.         return
  209.     end
  210.  
  211.     local facesproperty ={
  212.         {
  213.             PointA = pos6,
  214.             PointB = pos2,
  215.             PointC = pos1,
  216.             PointD = pos5,
  217.             Visible = visible,
  218.             Color = gcolor
  219.         },
  220.         {
  221.             PointA = pos3,
  222.             PointB = pos7,
  223.             PointC = pos8,
  224.             PointD = pos4,
  225.             Visible = visible,
  226.             Color = gcolor
  227.         },
  228.         {
  229.             PointA = pos4,
  230.             PointB = pos1,
  231.             PointC = pos8,
  232.             PointD = pos5,
  233.             Visible = visible,
  234.             Color = gcolor
  235.         },
  236.         {
  237.             PointA = pos3,
  238.             PointB = pos2,
  239.             PointC = pos7,
  240.             PointD = pos6,
  241.             Visible = visible,
  242.             Color = gcolor
  243.         }
  244.     }
  245.     for face, properties in pairs(facesproperty)do
  246.         for property, value in pairs(properties)do
  247.             protective_call_wrapper(function()
  248.                 faces[face][property] =  value
  249.             end)()
  250.         end
  251.     end
  252. end
  253.  
  254. function create3Dboxin2DScreen(pos1,pos2,pos3,pos4,pos5,pos6,pos7,pos8)
  255.     local mainproperty ={
  256.         PointA = pos6,
  257.         PointB = pos2,
  258.         PointC = pos1,
  259.         PointD = pos5,
  260.     }
  261.     --mainproperty.Color = Color3.new(1,0,0)
  262.     local box1 = createrectangle(mainproperty)
  263.  
  264.     mainproperty.PointA, mainproperty.PointB, mainproperty.PointC, mainproperty.PointD = pos3, pos7, pos8, pos4
  265.     --mainproperty.Color = Color3.new(1,1,0)
  266.     local box2 = createrectangle(mainproperty)
  267.  
  268.     mainproperty.PointA, mainproperty.PointB, mainproperty.PointC, mainproperty.PointD = pos4, pos1, pos8, pos5
  269.     --mainproperty.Color = Color3.new(0,1,0)
  270.     local box3 = createrectangle(mainproperty)
  271.  
  272.     mainproperty.PointA, mainproperty.PointB, mainproperty.PointC, mainproperty.PointD = pos3, pos2, pos7, pos6
  273.     --mainproperty.Color = Color3.new(0,1,1)
  274.     local box4 = createrectangle(mainproperty)
  275.  
  276.     return box1, box2, box3, box4
  277. end
  278.  
  279. function create_part_render_throught_wall(part)
  280.     if part.Name ~= "HumanoidRootPart" then
  281.         local faces = {}
  282.         local connerpositions = getboundingpoint(part)
  283.         local resultfrom3D_to_2D = listworldpoint_to_viewpoint(connerpositions)
  284.         local in_fov = all_in_fov(resultfrom3D_to_2D)
  285.         faces[1], faces[2], faces[3], faces[4] = create3Dboxin2DScreen(
  286.             resultfrom3D_to_2D[1][2],
  287.             resultfrom3D_to_2D[2][2],
  288.             resultfrom3D_to_2D[3][2],
  289.             resultfrom3D_to_2D[4][2],
  290.             resultfrom3D_to_2D[5][2],
  291.             resultfrom3D_to_2D[6][2],
  292.             resultfrom3D_to_2D[7][2],
  293.             resultfrom3D_to_2D[8][2]
  294.         )
  295.         return faces
  296.     end
  297. end
  298.  
  299. protective_call_wrapper(function()
  300.     for i=300,400 do
  301.         RS:BindToRenderStep("Custom_Event_Speed",i,high_speed)
  302.     end
  303. end)()
  304.  
  305. local lastcolorchange = tick()
  306. RS:BindToRenderStep("RainbowColor", 300, protective_call_wrapper(function()
  307.     if tick() - lastcolorchange >= 1/1000 then
  308.         lastcolorchange = tick()
  309.         gcolor = Color3.fromHSV((tick()/2) * 128 % 255/255, 1, 1)
  310.     end
  311. end))
  312.  
  313. protective_call_wrapper(function()
  314.     for _, plr in pairs(game:GetService("Players"):GetPlayers()) do
  315.         if plr ~= localplayer then
  316.             players[plr.Name] = synTextLabel()
  317.             players[plr.Name].ZIndex = 1
  318.             players_characters[plr.Name] = {}
  319.         end
  320.     end
  321. end)()
  322.  
  323. RS.RenderStepped:Connect(function(delta)
  324.     Render3DFPS = 1/delta
  325. end)
  326.  
  327. MS_Bind.Event:Connect(protective_call_wrapper(function()
  328.     if tick() - Render3DTick > 1/50 and Render3DFPS > 50 then
  329.         Render3DTick = tick()
  330.         for playername, characterparts in pairs(players_characters) do
  331.             local player = game:GetService("Players"):FindFirstChild(playername)
  332.             if player then
  333.                 if player.Character and localplayer.Character then
  334.                     for _,part in pairs(player.Character:GetChildren()) do
  335.                         if part:IsA("BasePart") then
  336.                             local ptw = players_characters[playername][part.Name]
  337.                             if not ptw then
  338.                                 players_characters[playername][part.Name] = create_part_render_throught_wall(part)
  339.                                 ptw = players_characters[playername][part.Name]
  340.                             else
  341.                                 local connerpositions = getboundingpoint(part)
  342.                                 local resultfrom3D_to_2D = listworldpoint_to_viewpoint(connerpositions)
  343.                                 local in_fov = all_in_fov(resultfrom3D_to_2D)
  344.                                 local local_character_pos = localplayer.Character.HumanoidRootPart.CFrame
  345.                                 if localplayer.Character.PrimaryPart then
  346.                                     local_character_pos = localplayer.Character:GetPrimaryPartCFrame()
  347.                                 end
  348.                                 local character_pos = player.Character.HumanoidRootPart.CFrame
  349.                                 if player.Character.PrimaryPart then
  350.                                     character_pos = player.Character:GetPrimaryPartCFrame()
  351.                                 end
  352.                                 local dist = (local_character_pos.p - character_pos.p).Magnitude
  353.                                 if dist > 2048 then
  354.                                     in_fov = false
  355.                                 end
  356.                                 if #resultfrom3D_to_2D>0 then
  357.                                     update3Dboxin2DScreen(unpack({
  358.                                         ptw,
  359.                                         in_fov and options.character_render,
  360.                                         resultfrom3D_to_2D[1][2],
  361.                                         resultfrom3D_to_2D[2][2],
  362.                                         resultfrom3D_to_2D[3][2],
  363.                                         resultfrom3D_to_2D[4][2],
  364.                                         resultfrom3D_to_2D[5][2],
  365.                                         resultfrom3D_to_2D[6][2],
  366.                                         resultfrom3D_to_2D[7][2],
  367.                                         resultfrom3D_to_2D[8][2]
  368.                                     }))
  369.                                 end
  370.                             end
  371.                         end
  372.                     end
  373.                 end
  374.             end
  375.         end
  376.     end
  377. end))
  378.  
  379. MS_Bind.Event:Connect(protective_call_wrapper(function()
  380.     for playername,TextLabel in pairs(players) do
  381.         local player = game:GetService("Players"):FindFirstChild(playername)
  382.         if player then
  383.             if not TextLabel then
  384.                 players[playername] = synTextLabel()
  385.                 TextLabel = players[playername]
  386.             end
  387.             if player.Character and localplayer.Character then
  388.                 if player.Character.PrimaryPart and localplayer.Character.PrimaryPart then
  389.                     local local_character_pos = localplayer.Character:GetPrimaryPartCFrame()
  390.                     local character_pos = player.Character:GetPrimaryPartCFrame()
  391.                     local dist = (local_character_pos.p - character_pos.p).Magnitude
  392.                     local in_fov, sc_pos = worldpoint_to_viewpoint(character_pos)
  393.                     local health = 1
  394.                     local maxhealth = 1
  395.                     local strformat = {}
  396.                     in_fov = in_fov and options.enabled
  397.                     if dist > 25000 then
  398.                         in_fov = false
  399.                     end
  400.                     if game.GameId == 1650291138 then
  401.                         maxhealth = player["MaxHealth"].Value
  402.                         maxstamina = player["MaxStamina"].Value
  403.                         maxhunger = player["MaxHunger"].Value
  404.                         maxbreathing = 100
  405.                         health = player["Health"].Value
  406.                         stamina = player["Stamina"].Value
  407.                         hunger = player["Hunger"].Value
  408.                         breathing = player["Breathing"].Value
  409.                         strformat = {"%s(%s)\nHealth: %.2f%%(%.2f/%.2f)\nstamina: %.2f(%.2f/%.2f)\nbreathing: %.2f\ndistance: %.2f", playername, player.DisplayName, (health/maxhealth)*100, health, maxhealth, (stamina/maxstamina)*100, stamina, maxstamina, (breathing/maxbreathing)*100, dist}
  410.                     elseif game.PlaceId == 6032399813 or game.PlaceId == 5735553160 then
  411.                         local hum = player.Character:FindFirstChildOfClass("Humanoid")
  412.                         local tool = nil
  413.                         if hum then
  414.                             health = hum.Health
  415.                             maxhealth = hum.MaxHealth
  416.                             tool = "None"
  417.                             local toolinstance = player.Character:FindFirstChildOfClass("Tool")
  418.                             if toolinstance then
  419.                                 tool = toolinstance.Name
  420.                                 if tool == "Weapon" and toolinstance:FindFirstChild("Weapon") then
  421.                                     tool = toolinstance.Weapon.Value
  422.                                 end
  423.                             end
  424.                         end
  425.                         strformat = {"%s %s(%s)\nHealth: %.2f%%(%.2f/%.2f)\ntool: %s\ndistance: %.2f", player.leaderstats.FirstName.Value, player.leaderstats.LastName.Value, playername, (health/maxhealth)*100, health, maxhealth, tool, dist}
  426.                     else
  427.                         local hum = player.Character:FindFirstChildOfClass("Humanoid")
  428.                         if hum then
  429.                             health = hum.Health
  430.                             maxhealth = hum.MaxHealth
  431.                             strformat = {"%s(%s)\nhealth: %.2f%%(%.2f/%.2f)\ndistance: %.2f", player.DisplayName, playername, (health/maxhealth)*100, health, maxhealth, dist}
  432.                         end
  433.                     end
  434.                     if in_fov then
  435.                         TextLabel.Size = Lerp(24,1,dist/25000)
  436.                         TextLabel.Position = sc_pos
  437.                         TextLabel.Color = gcolor
  438.                         TextLabel.Text = string.format(unpack(strformat))
  439.                     end
  440.                     TextLabel.Visible = in_fov
  441.                 end
  442.             end
  443.         end
  444.     end
  445. end))
Add Comment
Please, Sign In to add comment