курсор

Lance Sterling

Потрачен
Автор темы
140
8
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
как сделать шо при открытии имгуи у меня был неактивный курсор

вот код
Lua:
if sampIsPlayerConnected(reconId) and recon.v and rState then--панель рекона <3
        local result, handle = sampGetCharHandleBySampPlayerId(reconId)
        wt2:run()
        if result then
            local x, y = ToScreen(552, 230)
            local w, h = ToScreen(638, 330)
            if imgui.IsMouseClicked(1) then
                imgui.ShowCursor = not imgui.ShowCursor
            end  
            local m, a = ToScreen(200, 410)
            imgui.SetNextWindowPos(imgui.ImVec2(m, a), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowSize(imgui.ImVec2(563, 55), imgui.Cond.FirstUseEver)
            imgui.Begin(u8"##DownPanel", _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoTitleBar)
            local isPed, pPed = sampGetCharHandleBySampPlayerId(reconId)
            local bet = imgui.ImVec2(70, 0)
            if imgui.Button(u8'<< BACK', bet) then
                if reconId == 0 then
                    sampSendChat('/re '..sampGetMaxPlayerId(false))
                    sampSendChat('/upd')
                    recon.v = true
                    imgui.Process = recon.v
                else
                    reconId = reconId - 1
                    if sampIsPlayerConnected(reconId) then
                        sampSendChat('/re '.. reconId)
                    else
                        reconId = reconId - 1
                        sampSendChat('/re '.. reconId)
                    end
                    sampSendChat('/upd')
                    recon.v = true
                    imgui.Process = recon.v
                end
            end imgui.SameLine()
            if imgui.Button(u8'/stats', bet) then
                sampSendChat('/stats '..reconId)
            end imgui.SameLine()
            if imgui.Button(u8'Вы тут?', bet) then
                sampSendChat('/b '..getNick(reconId)..', Вы тут? Ответ /n +')
            end imgui.SameLine()
            if imgui.Button(u8'/slap', bet) then
                sampSendChat('/slap '..reconId)
            end imgui.SameLine()
            if imgui.Button(u8'/freeze', bet) then
                sampSendChat('/freeze '..reconId)
            end imgui.SameLine()
            if imgui.Button(u8'/unfreeze', bet) then
                sampSendChat('/unfreeze '..reconId)
            end imgui.SameLine()
            if imgui.Button(u8'NEXT >>', bet) then
                if reconId == sampGetMaxPlayerId(false) then
                    sampSendChat('/re 0')
                    sampSendChat('/upd')
                    recon.v = true
                    imgui.Process = recon.v
                else
                    reconId = reconId + 1
                    if sampIsPlayerConnected(reconId) then
                        sampSendChat('/re '.. reconId)
                    else
                        reconId = reconId + 1
                        sampSendChat('/re '.. reconId)
                    end
                    sampSendChat('/upd')
                    recon.v = true
                    imgui.Process = recon.v
                end
            end
            if imgui.Button(u8'/goto', bet) then
                lua_thread.create(function()
                    gotoId = reconId
                    sampSendChat('/reoff')
                    recon.v = false
                    imgui.Process = recon.v
                    wait(500)
                    sampSendChat('/goto '..gotoId)
                end)
            end    imgui.SameLine()
            if imgui.Button(u8'Get IP', bet) then
                lua_thread.create(function()
                    sampSendChat('/getip '..reconId)
                end)
            end imgui.SameLine()
            if imgui.Button(u8'/gethere', bet) then
                lua_thread.create(function()
                    gethereId = reconId
                    sampSendChat('/reoff')
                    recon.v = false
                imgui.Process = recon.v
                    wait(1000)
                    sampSendChat('/gethere '..gethereId)
                end)
            end imgui.SameLine()
            if imgui.Button(u8'ХП', bet) then
                sampSendChat('/sethp '..reconId..' 100')
            end imgui.SameLine()
            if imgui.Button(u8'Чинить') then
                sampSendChat('/frem '..reconId)
                sampSendChat('/b Приятной игры на просторах Mordor Role Play :>')
                sampSendChat('/reoff')
                recon.v = false
                imgui.Process = recon.v
            end imgui.SameLine()
            if imgui.Button(u8'/spawn') then
                sampSendChat('/spawn '..reconId)
            end imgui.SameLine()
            if imgui.Button(u8'Написать') then
                sampSetChatInputEnabled(true)
                sampSetChatInputText('/ans '..reconId..' ')
            end imgui.SameLine()
            if imgui.Button(u8'/spoff') then
                sampSendChat('/spoff')
                recon.v = false
                imgui.Process = recon.v
                imgui.ShowCursor = false
            end
            imgui.End()
            imgui.SetNextWindowPos(imgui.ImVec2(x, y), imgui.Cond.FirstUseEver)
            imgui.SetNextWindowSize(imgui.ImVec2(w-x, 198), imgui.Cond.FirstUseEver)
            imgui.Begin(u8"Информация##reconInfo", _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoScrollWithMouse + imgui.WindowFlags.NoScrollbar + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoSavedSettings)
            local isPed, pPed = sampGetCharHandleBySampPlayerId(reconId)
            local score, ping = sampGetPlayerScore(reconId), sampGetPlayerPing(reconId)
            local health, armor, ammo = sampGetPlayerHealth(reconId), sampGetPlayerArmor(reconId), getAmmoRecon()
            if ammo == 0 then
                ammo = u8'Нет'
            else
                ammo = getAmmoRecon()
            end
            if armor == 0 then
                armor = u8'Нет'
            else
                armor = sampGetPlayerArmor(reconId)
            end
            if isPed and doesCharExist(pPed) then
                local model, interior = getCharModel(pPed), getCharActiveInterior(playerPed)
                imgui.Text(u8(getNick(reconId)..'['..reconId..']'))
                if imgui.IsItemClicked() then
                    setClipboardText(getNick(reconId))
                    sampAddChatMessage('[Admin Tools]: {FFFFFF}Ник игрока успешно скопирован в буфер обмена.',0x00BFFF)
                end
                imgui.Tooltip(u8"Скопировать")
                imgui.PushStyleVar(imgui.StyleVar.ItemSpacing, imgui.ImVec2(1.0, 2.5))
                imgui.Text(u8'Жизни » '..health)
                imgui.Text(u8'Броня » '..armor)
                imgui.Text(u8'Уровень » '..score)
                imgui.Text(u8'Пинг » '..ping)
                if isCharInAnyCar(pPed) then
                    imgui.Text(u8('Скорость » В машине'))
                elseif speed ~= nil then
                    imgui.Text(u8('Скорость » '..speed))
                end
                imgui.Text(u8'Скин » '..model)
                imgui.Text(u8"Патроны » "..ammo)
                if mobile ~= nil then
                    if mobile == 'Mobile' then
                        mobile = 'Mobile Client'
                    elseif mobile == 'yes' then
                        mobile = 'Mobile Client'
                    elseif mobile == 'PC' then
                        mobile = 'PC Client'
                    elseif mobile == 'YouTube' then
                        mobile = 'Unknown Client/YouTube'
                    end
                    imgui.Text(u8"Клиент » "..u8:decode(mobile))--клиент пользователя
                end
                imgui.PopStyleVar()
                local y = y + 196
                if isCharInAnyCar(pPed) then
                    local carHundle = storeCarCharIsInNoSave(pPed)
                    local carModel = getCarModel(carHundle)
                    local carHealth = getCarHealth(carHundle)
                    local carEngine = isCarEngineOn(carHundle)
                    if carEngine then
                        carEngine = u8'Включён'
                    else
                        carEngine = u8'Выключен'
                    end
                    imgui.SetNextWindowPos(imgui.ImVec2(x, y), imgui.Cond.FirstUseEver, imgui.ImVec2(0.0, 0.0))
                    imgui.SetNextWindowSize(imgui.ImVec2(w-x, 97), imgui.Cond.FirstUseEver)
                    imgui.Begin(u8"Информация о транспорте ##reconCarInfo", _, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoBringToFrontOnFocus + imgui.WindowFlags.NoSavedSettings)
                    imgui.PushStyleVar(imgui.StyleVar.ItemSpacing, imgui.ImVec2(1.0, 2.5))
                    imgui.Text(u8"Жизни » "..carHealth)
                    imgui.Text(u8"Модель » "..carModel)
                    if speed ~= nil then
                        imgui.Text(u8"Скорость » "..speed)
                    end
                    imgui.Text(u8"Двигатель » "..carEngine)
                    imgui.PopStyleVar()
                    imgui.End()
                end
            else
                imgui.Text(u8"По неизвестным причинам\nВы не можете следить за игроком.")
            end
            imgui.End()
        end
    end
 

Lance Sterling

Потрачен
Автор темы
140
8
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Выключенный? Чёрт знает, попробуй так:
Lua:
function OnDrawFrame()
    if переменная_окна.v then
        imgui.ShowCursor = false
        -- ...
    end
end
не я понимаю, но мне надо шоб он 1 раз скрыл при открытии и все, шоб его потом еще можно было включать и отключать

вот так
Код:
if imgui.IsMouseClicked(1) then
                imgui.ShowCursor = not imgui.ShowCursor
            end
 

Dmitriy Makarov

25.05.2021
Проверенный
2,478
1,113
не я понимаю, но мне надо шоб он 1 раз скрыл при открытии и все, шоб его потом еще можно было включать и отключать

вот так
Код:
if imgui.IsMouseClicked(1) then
                imgui.ShowCursor = not imgui.ShowCursor
            end
Через wasKeyPressed/isKeyJustPressed пробуй это делать. И можешь ещё пробовать с самповским курсором - showCursor(true/false).
Сначала попробуй на кнопку клавиатуры забиндить это. Кто знает, может мышка в шоке с того, что ты хочешь вырубить её курсор её же кнопкой. 🙁
 

Lance Sterling

Потрачен
Автор темы
140
8
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Через wasKeyPressed/isKeyJustPressed пробуй это делать. И можешь ещё пробовать с самповским курсором - showCursor(true/false).
Сначала попробуй на кнопку клавиатуры забиндить это. Кто знает, может мышка в шоке с того, что ты хочешь вырубить её курсор её же кнопкой. 🙁
не понел, мнее надо не это, оно вырубается, все ок, мнее надо просто что бы когда я запустил рекон оно скрыло мышку 1 раз и все
 

why ega

РП игрок
Модератор
2,539
2,233
не я понимаю, но мне надо шоб он 1 раз скрыл при открытии и все, шоб его потом еще можно было включать и отключать

вот так
Код:
if imgui.IsMouseClicked(1) then
                imgui.ShowCursor = not imgui.ShowCursor
            end
вырезал из своего кода, переменные заменишь на свои
Lua:
local spInfo = {
    cursor = false,
}
-- в рендере имгуи
player.HideCursor = spInfo.cursor

---------------------------------

function onWindowMessage(msg, wparam, lparam)
    if not isPauseMenuActive() then   
        if config.spWindow[0] then
            if msg == 0x0205 then -- если нажата ПКМ
                spInfo.cursor = true
            elseif msg == 513 then -- если нажата ЛКМ
                spInfo.cursor = false
            end
        end
    end
end
 
  • Нравится
Реакции: YarikVL