improvements
This commit is contained in:
parent
ec800710f5
commit
4b069975e4
@ -1,25 +1,35 @@
|
|||||||
|
|
||||||
|
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 DrawTextFont = "BudgetLabel"
|
||||||
|
|
||||||
local plys = player.GetAll()
|
local plys = player.GetAll()
|
||||||
timer.Create("edshot_esp_findplys", 3, 0, function() plys = player.GetAll() end)
|
timer.Create("edshot_esp_findplys", 3, 0, function() plys = player.GetAll() end)
|
||||||
|
|
||||||
hook.Add("PostDrawHUD", "edshot_esp_PostDrawHUD", function()
|
hook.Add("PostDrawHUD", "edshot_esp_PostDrawHUD", function()
|
||||||
|
if ESP:GetBool() and ESPInfo:GetBool() then
|
||||||
for _, ply in pairs(plys) do
|
for _, ply in pairs(plys) do
|
||||||
if (not IsValid(ply)) or (ply == LocalPlayer()) then continue end
|
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)
|
local plyColor = Color(255, 255, 255)
|
||||||
if (not ply:Alive()) then plyColor = Color(255, 0, 0) end
|
if (not ply:Alive()) then plyColor = Color(255, 0, 0) end
|
||||||
|
|
||||||
local plyPosition = ply:GetPos():ToScreen()
|
|
||||||
draw.DrawText(ply:GetName(), DrawTextFont, plyPosition.x, plyPosition.y, plyColor)
|
draw.DrawText(ply:GetName(), DrawTextFont, plyPosition.x, plyPosition.y, plyColor)
|
||||||
draw.DrawText(ply:Health(), DrawTextFont, plyPosition.x, plyPosition.y + 15, 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(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)
|
draw.DrawText(math.Round(LocalPlayer():GetPos():Distance(ply:GetPos()), 0), DrawTextFont, plyPosition.x + 60, plyPosition.y + 15, plyColor)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hook.Add("PostDrawOpaqueRenderables", "edshot_esp_PostDrawOpaqueRenderables", function(bDrawingDepth, bDrawingSkybox, isDraw3DSkybox)
|
hook.Add("PostDrawOpaqueRenderables", "edshot_esp_PostDrawOpaqueRenderables", function(bDrawingDepth, bDrawingSkybox, isDraw3DSkybox)
|
||||||
|
if ESP:GetBool() and ESPBox:GetBool() then
|
||||||
for _, ply in pairs(plys) do
|
for _, ply in pairs(plys) do
|
||||||
if (not IsValid(ply)) or (ply == LocalPlayer()) then continue end
|
if (not IsValid(ply)) or (ply == LocalPlayer()) then continue end
|
||||||
|
|
||||||
@ -28,4 +38,16 @@ hook.Add("PostDrawOpaqueRenderables", "edshot_esp_PostDrawOpaqueRenderables", fu
|
|||||||
|
|
||||||
render.DrawWireframeBox(ply:GetPos(), ply:GetAngles(), ply:OBBMins(), ply:OBBMaxs(), plyColor)
|
render.DrawWireframeBox(ply:GetPos(), ply:GetAngles(), ply:OBBMins(), ply:OBBMaxs(), plyColor)
|
||||||
end
|
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)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user