mirror of
https://github.com/sr229/metastruct-experiments.git
synced 2024-09-20 06:30:36 +00:00
Added ESP chips
This commit is contained in:
parent
c36470057e
commit
7bc232bb56
2 changed files with 91 additions and 0 deletions
39
starfallex/esp.lua
Normal file
39
starfallex/esp.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
--@name Not very accurate ESP-ish
|
||||||
|
--@author Minori
|
||||||
|
--@shared
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
chip():setNoDraw(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
if player() == owner() then
|
||||||
|
enableHud(owner(), true)
|
||||||
|
hook.add("postdrawhud", "ent_tracker", function()
|
||||||
|
for i, v in ipairs(find.allPlayers()) do
|
||||||
|
if v ~= owner() then
|
||||||
|
-- draw a rectangle is to where the player is relative to screen space
|
||||||
|
local pos = v:obbCenterW():toScreen()
|
||||||
|
-- caclulate distance between self and ent
|
||||||
|
local dist = v:getPos():getDistance(owner():getPos()) - 27
|
||||||
|
|
||||||
|
if v:isAlive() then
|
||||||
|
render.setColor(Color(230, 230, 0))
|
||||||
|
render.drawText((pos.x), (pos.y - 30), string.format("HP: %i AP: %i DIST: %i", v:getHealth(), v:getArmor(), dist), 0)
|
||||||
|
else
|
||||||
|
render.setColor(Color(255, 50, 0))
|
||||||
|
render.drawText((pos.x), (pos.y - 30), string.format("[DEAD] DIST: %i", dist), 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- FIXME: using getName() causes EasyChat to error out which errors out the SF
|
||||||
|
-- so we're only using the SteamID for now
|
||||||
|
render.drawText(pos.x, (pos.y - 45), v:getName(), 0)
|
||||||
|
render.drawRectFast(pos.x, pos.y, 10, 15)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
52
starfallex/esp_coroutine.lua
Normal file
52
starfallex/esp_coroutine.lua
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
--@name Not very accurate ESP-ish (Coroutine edition)
|
||||||
|
--@author Minori
|
||||||
|
--@shared
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
chip():setNoDraw(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function displayAllPlys()
|
||||||
|
local plys = find.allPlayers()
|
||||||
|
|
||||||
|
if not plys then
|
||||||
|
coroutine.yield()
|
||||||
|
else
|
||||||
|
for _, v in ipairs(plys) do
|
||||||
|
if v ~= owner() then
|
||||||
|
-- draw a rectangle is to where the player is relative to screen space
|
||||||
|
local pos = v:obbCenterW():toScreen()
|
||||||
|
-- caclulate distance between self and ent
|
||||||
|
local dist = v:getPos():getDistance(owner():getPos()) - 27
|
||||||
|
|
||||||
|
if v:isAlive() then
|
||||||
|
render.setColor(Color(230, 230, 0))
|
||||||
|
render.drawText((pos.x), (pos.y - 30),
|
||||||
|
string.format("HP: %i AP: %i DIST: %i", v:getHealth(), v:getArmor(), dist), 0)
|
||||||
|
else
|
||||||
|
render.setColor(Color(255, 50, 0))
|
||||||
|
render.drawText((pos.x), (pos.y - 30), string.format("[DEAD] DIST: %i", dist), 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- FIXME: using getName() causes EasyChat to error out which errors out the SF
|
||||||
|
-- so we're only using the SteamID for now
|
||||||
|
render.drawText(pos.x, (pos.y - 45), v:getName(), 0)
|
||||||
|
render.drawRectFast(pos.x, pos.y, 10, 15)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
coroutine.yield()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
if player() == owner() then
|
||||||
|
enableHud(owner(), true)
|
||||||
|
hook.add("postdrawhud", "ent_tracker", function()
|
||||||
|
local plyco = coroutine.create(displayAllPlys)
|
||||||
|
coroutine.resume(plyco)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue