[Help] Cheat Menu

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
?
Screenshot_1.png

Lua:
-- Libraries
require "lib.moonloader"
local imgui = require 'mimgui' -- https://www.blast.hk/threads/66959/ | https://github.com/THE-FYP/mimgui
local ffi = require 'ffi'

-- Variables
local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof
local window = new.bool(false)
local cheat_1 = new.bool(false)
local cheat_2 = new.bool(false)
local cheat_3 = new.bool(false)

imgui.OnInitialize(function()
    imgui.GetIO().IniFilename = nil
end)

function main()
    if not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("mimgui", function() window[0] = not window[0] end) -- command /mimgui
    wait(-1)
end

local newFrame = imgui.OnFrame(function() return window[0] end, function(player)
    local sizeX, sizeY = getScreenResolution()
    imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
    imgui.SetNextWindowSize(imgui.ImVec2(300, 200), imgui.Cond.FirstUseEver)
    imgui.Begin("Cheat menu", window)
    imgui.Checkbox("Cheat 1", cheat_1)
    imgui.Checkbox("Cheat 2", cheat_2)
    imgui.Checkbox("Cheat 3", cheat_3)
    imgui.End()
end)