```lua
local mem = require"memory"
local imgui = require"imgui"
local encoding = require"encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8
local font = renderCreateFont("Century Gothic", 9, 5)
local work = imgui.ImBool(false)
local renderOres = imgui.ImBool(false)
local infinityRun = imgui.ImBool(false)
local cj = imgui.ImBool(false)
local currentSkinID
function main()
    repeat
        wait(0)
    until isSampAvailable()

    wait(100)
    sampRegisterChatCommand("shachta", toggleMenu)
    while true do
        wait(0)
        handleRendering()
    end
end

function toggleMenu()
    work.v = not work.v
    imgui.Process = work.v
end

function handleRendering()
    if renderOres.v then
        for id = 0, 2048 do
            if sampIs3dTextDefined(id) then
                local text, _, x, y, z = sampGet3dTextInfoById(id)
                if text:find("добычи") and isPointOnScreen(x, y, z, 3.0) then drawOreDistance(x, y, z) end
            end
        end
    end
end

function drawOreDistance(x, y, z)
    local xp, yp, zp = getCharCoordinates(PLAYER_PED)
    local textScreenX, textScreenY = convert3DCoordsToScreen(x, y, z)
    local playerScreenX, playerScreenY = convert3DCoordsToScreen(xp, yp, zp)
    local distance = getDistanceBetweenCoords3d(x, y, z, xp, yp, zp)
    renderDrawLine(playerScreenX, playerScreenY, textScreenX, textScreenY, 2, 0xFF404241)
    renderFontDrawText(font, distance, textScreenX - 15, textScreenY + 6, -1)
    renderDrawPolygon(textScreenX, textScreenY, 10, 10, 10, 0, 0xFF404241)
end

function imgui.OnDrawFrame()
    if not work.v then return end
    setImguiStyles()
    imgui.SetNextWindowSize(imgui.ImVec2(217, 177), imgui.Cond.FirstUseEver)
    imgui.Begin("Ore's helper", work, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
    drawSettings()
    imgui.End()
end

function drawSettings()
    if imgui.BeginChild("Settings", imgui.ImVec2(200, 140), true) then
        imgui.Checkbox("Render Ores", renderOres)
        imgui.Checkbox("Infinity Run", infinityRun)
        manageInfinityRun()
        imgui.Checkbox("Skin CJ", cj)
        manageCJSkin()
    end

    imgui.EndChild()
end

function manageInfinityRun()
    mem.setint8(0xB7CEE4, infinityRun.v and 1 or 0)
end

function manageCJSkin()
    if cj.v and currentSkinID == nil then
        local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        currentSkinID = getCharModel(PLAYER_PED)
        changeCJModel(id, 74)
    elseif not cj.v and currentSkinID ~= nil then
        local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        changeCJModel(id, currentSkinID)
        currentSkinID = nil
    end
end

function changeCJModel(playerId, newModel)
    local bss = raknetNewBitStream()
    raknetBitStreamWriteInt32(bss, playerId)
    raknetBitStreamWriteInt32(bss, newModel)
    raknetEmulRpcReceiveBitStream(153, bss)
    raknetDeleteBitStream(bss)
end

function setImguiStyles()
    imgui.SwitchContext()
    local style = imgui.GetStyle()
    style.WindowPadding = imgui.ImVec2(9, 5)
    style.WindowRounding = 10
    style.ChildWindowRounding = 10
    style.FramePadding = imgui.ImVec2(5, 3)
    local colors = style.Colors
    local predefinedColors = {{imgui.Col.Text, {0.90, 0.90, 0.90, 1.00}}, {imgui.Col.WindowBg, {0.00, 0.00, 0.00, 1.00}},}
    for _, color in ipairs(predefinedColors) do
        local idx, rgba = color[1], color[2]
        colors[idx] = imgui.ImVec4(unpack(rgba))
    end
end
```
В коде есть проблема, когда я закрываю интерфейс, то курсор не пропадает.