-
Автор темы
- #1
Код:
local function global()
local function color(r, g, b, a)
if a == nil then a = 255 end
return Color.new(r / 255, g / 255, b / 255, a / 255)
end
local function render_conteiner(x, y, w, h, name, line_color, box_alpha, font_size, font)
local name_size = g_Render:CalcTextSize(name, font_size, font)
local line_col = line_color:GetColor()
g_Render:BoxFilled(Vector2.new(x, y), Vector2.new(x + w, y - 2), Color.new(line_col:r(), line_col:g(), line_col:b()))
g_Render:BoxFilled(Vector2.new(x, y), Vector2.new(x + w, y + h), color(17, 17, 17, box_alpha:GetInt()))
g_Render:Text(name, Vector2.new(x + w / 2 - name_size.x / 2, y + 2), color(280, 280, 280), font_size, font, true)
end
local screen = g_EngineClient:GetScreenSize()
local font_size = 12
local font = g_Render:InitFont("Verdana", font_size)
local adaprive = {menu.ColorEdit("General", "Line color", color(150, 150, 255)), menu.SliderInt("General", "Box alpha", 150, 0, 255)}
local key = {menu.SliderInt("General", "keybinds x", 300, 1, screen.x), menu.SliderInt("General", "keybinds y", 10, 1, screen.y)}
key[1]:SetVisible(false)
key[2]:SetVisible(false)
local drag = false
local width = 0
local function keybinds()
local x, y = key[1]:GetInt(), key[2]:GetInt()
local max_width = 0
local add_y = 0
local function render_binds(binds)
if not binds:IsActive() then return end
local bind_name = binds:GetName()
local bind_state = binds:GetValue()
local bind_state_size = g_Render:CalcTextSize(bind_state, font_size, font)
local bind_name_size = g_Render:CalcTextSize(bind_name, font_size, font)
g_Render:Text(bind_name, Vector2.new(x, y + 20 + add_y), color(280, 280, 280), font_size, font, true)
g_Render:Text(bind_state, Vector2.new(x + (width - bind_state_size.x), y + 20 + add_y), color(280, 280, 280), font_size, font, true)
add_y = add_y + 16
local bind_width = bind_state_size.x + bind_name_size.x + 10
if bind_width > 80 then
if bind_width > max_width then
max_width = bind_width
end
end
end
local binds = cheat.GetBinds()
for i = 1, #binds do
render_binds(binds[i])
end
width = math.max(80, max_width)
if cheat.IsMenuVisible() or (#binds > 0) then
render_conteiner(x, y, width, 16, "keybinds", adaprive[1], adaprive[2], font_size, font)
local mouse = cheat.GetMousePos()
if cheat.IsKeyDown(1) then
if mouse.x >= x and mouse.y >= y and mouse.x <= x + width and mouse.y <= y + 18 or drag then
if not drag then
drag = true
else
key[1]:SetInt(mouse.x - math.floor(width / 2))
key[2]:SetInt(mouse.y - 8)
end
end
else
drag = false
end
end
end
cheat.RegisterCallback("draw", function()
keybinds()
end)
end
global()
Последнее редактирование: