Untitled conversation
- User
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 - Assistant
Чтобы курсор исчезал после закрытия интерфейса, вам нужно сделать небольшие изменения в функции
toggleMenu. Вам необходимо скрыть курсор, когда меню закрыто, и показать его, когда меню открыто. Вот как можно это реализовать:- В функции
toggleMenu, добавьте вызовshowCursorс аргументомwork.v. - Функцию
showCursorнужно создать, которая будет включать или отключать курсор.
Вот как вы можете внести изменения в код:
function toggleMenu() work.v = not work.v imgui.Process = work.v showCursor(work.v) -- Изменение курсора в зависимости от состояния меню end function showCursor(show) if show then setCursorVisible(true) -- Показываем курсор else setCursorVisible(false) -- Скрываем курсор end endОбратите внимание, что функция
setCursorVisible— это вымышленная функция, она должна существовать в вашем окружении или в API, которое вы используете. Если такой функции нет, вам нужно использовать соответствующий метод от вашего API для управления видимостью курсора.Таким образом, при открытии интерфейса курсор будет видим, а при закрытии — скрыт. Это должно решить вашу проблему.
- В функции