-
Автор темы
- #1
Просто пример рендера логов, и ремува их после определенного времени
Код:
local font = g_Render:InitFont("Verdana", 12)
local hitlogs = {}
cheat.RegisterCallback("registered_shot", function(shot)
local text
local name = g_EntityList:GetClientEntity(shot.target_index):GetPlayer():GetName()
local damage = shot.damage
if shot.reason == 0 then
text = string.format("Hit %s for %s", name, damage)
else
text = string.format("Missed shot in %s", name)
end
table.insert(hitlogs, {text = text, time = g_GlobalVars.realtime})
end)
cheat.RegisterCallback("draw", function()
local x, y = 5, 5
for i, hitlog in ipairs(hitlogs) do
g_Render:Text(hitlog.text, Vector2.new(x, y), Color.new(1, 1, 1), 12, font, true)
y = y + 15
if hitlog.time + 5 < g_GlobalVars.realtime then table.remove(hitlogs, i) end
end
end)