local ESP = CreateConVar("cl_esp", 1, {FCVAR_ARCHIVE}, "Toggle all ESP functionality", 0, 1) local ESPBox = CreateConVar("cl_esp_box", 1, {FCVAR_ARCHIVE}, "Toggle ESP Wireframe", 0, 1) local ESPInfo = CreateConVar("cl_esp_info", 1, {FCVAR_ARCHIVE}, "Toggle ESP player information", 0, 1) local DrawTextFont = "BudgetLabel" local plys = player.GetAll() timer.Create("edshot_esp_findplys", 3, 0, function() plys = player.GetAll() end) hook.Add("PostDrawHUD", "edshot_esp_PostDrawHUD", function() if ESP:GetBool() and ESPInfo:GetBool() then for _, ply in pairs(plys) do if (not IsValid(ply)) or (ply == LocalPlayer()) then continue end local plyPosition = ply:GetPos() + ply:OBBCenter() plyPosition = plyPosition:ToScreen() if not plyPosition.visible then continue end local plyColor = Color(255, 255, 255) if (not ply:Alive()) then plyColor = Color(255, 0, 0) end draw.DrawText(ply:GetName(), DrawTextFont, plyPosition.x, plyPosition.y, plyColor) draw.DrawText(ply:Health(), DrawTextFont, plyPosition.x, plyPosition.y + 15, plyColor) draw.DrawText(ply:Armor(), DrawTextFont, plyPosition.x + 30, plyPosition.y + 15, plyColor) draw.DrawText(math.Round(LocalPlayer():GetPos():Distance(ply:GetPos()), 0), DrawTextFont, plyPosition.x + 60, plyPosition.y + 15, plyColor) end end end) hook.Add("PostDrawOpaqueRenderables", "edshot_esp_PostDrawOpaqueRenderables", function(bDrawingDepth, bDrawingSkybox, isDraw3DSkybox) if ESP:GetBool() and ESPBox:GetBool() then for _, ply in pairs(plys) do if (not IsValid(ply)) or (ply == LocalPlayer()) then continue end local plyColor = Color(0, 255, 0) if (not ply:Alive()) then plyColor = Color(255, 0, 0) end render.DrawWireframeBox(ply:GetPos(), ply:GetAngles(), ply:OBBMins(), ply:OBBMaxs(), plyColor) end end end) function ESPConfig(CPanel) CPanel:AddControl("Header", {Description = "Configure the ESP."}) CPanel:AddControl("Checkbox", {Label = "Toggle ESP", Command = "cl_esp", min = 0, max = 1, Type = "int"}) CPanel:AddControl("Checkbox", {Label = "Toggle ESP Wireframe", Command = "cl_esp_box", min = 0, max = 1, Type = "int"}) CPanel:AddControl("Checkbox", {Label = "Toggle ESP Information", Command = "cl_esp_info", min = 0, max = 1, Type = "int"}) end hook.Add("PopulateToolMenu", "edshot_esp_config", function() spawnmenu.AddToolMenuOption("Options", "Player", "edshot_esp_config", "ESP", "", "", ESPConfig) end)