Добавление Airbrake на checkbox

aondec

Участник
Автор темы
47
3
Версия MoonLoader
Другое
Хочу добавить аирбрейк с определённой скоростью на чекбокс.
Чтобы при включении работал аирбрейк и не работал при отключении.
Ктото знает функцию для подключения?
CheckBox:
if imgui.Checkbox(u8'AirBrake', airbrake) then
sampAddChatMessage('-', -1)
end
 
  • Эм
Реакции: MLycoris

aondec

Участник
Автор темы
47
3
в function main() есть цикл while true do wait(0) end, он и называется бесконечным циклом
Можно я тебе весь код скину, а ты добавишь пж?

в function main() есть цикл while true do wait(0) end, он и называется бесконечным циклом
У меня нету даже беск. цикла просто
 

fokichevskiy

Известный
354
158
Lua:
RPC = {[71] = 'RemovePlayerFromVehicle'}
local imgui = require 'mimgui'
local ffi = require 'ffi'
local vkeys = require 'vkeys'
local lmemory, memory = pcall(require, 'memory')
local encoding = require 'encoding'
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local speed = math.floor(getCharSpeed(1))

encoding.default = 'CP1251'         --[[Указываем кодировку по умолчанию. Обратите внимание,
                                        что она должна совпадать с кодировкой вашего скрипта.]]
local u8 = encoding.UTF8            -- И создаём короткий псевдоним для кодировщика UTF-8

local wm = require 'windows.message'
local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof

local renderWindow, freezePlayer, removeCursor = new.bool(), new.bool(), new.bool()
local inputField = new.char[256](--[[Здесь также следует кодировать информацию!]])
local sizeX, sizeY = getScreenResolution()
local checkboxone = new.bool()
local noeject = new.bool()
local waterdrive = new.bool()
local autoengine = new.bool()
local airbrake = new.bool()

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

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(player)
        imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(300, 350), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"SampersikCheat", renderWindow)
        imgui.Text("SACheat 0.1")
        imgui.Text(string.format("Current render mode: %s", renderWindow[0]))
        imgui.ProgressBar(speed/100,imgui.ImVec2(100,24),'Speed: '..speed)
        if imgui.InputText(u8"", inputField, sizeof(inputField)) then
            print(u8:decode(str(inputField)))
        end
        if imgui.Button(u8"Очистить поле") then
            imgui.StrCopy(inputField, '')
        end
        if imgui.Button(u8'Очистить чат') then
            sampRegisterChatCommand('ch', function() cc() end)
        end
        if imgui.Checkbox(u8'Заморозить игрока', freezePlayer) then
            player.LockPlayer = freezePlayer[0]
        end
        if imgui.Checkbox(u8'NoEjectVehicle', noeject) then
            sampSendChat('/njc')
        end
        if imgui.Checkbox(u8'Godmode', checkboxone) then
            sampAddChatMessage('Godmode on/off', -1)
        end
        if imgui.Checkbox(u8'AutoEngine', autoengine) then
            sampAddChatMessage('-', -1)
        end
        if imgui.Checkbox(u8'AirBrake', airbrake) then
            sampAddChatMessage('-', -1)
        end
        if imgui.Checkbox(u8'WaterDrive', waterdrive) then
        end
        if imgui.Checkbox(u8'Скрыть курсор', removeCursor) then
            player.HideCursor = removeCursor[0]
        end
        if player.HideCursor then
            imgui.Text(u8'Курсор скрыт')
        end
        imgui.End()
    end
)

function onReceiveRpc(id, bitStream)
    if noeject then
        if RPC[id] then
            return false
        end
    end
end

function onReceiveRpc(rpcId)
    if noeject[0] and rpcId == 71 then return false end
end

function AutoEngine(PLAYER_PED)
    if autoengine then
       if bool and isCharInAnyCar(PLAYER_PED) then
          setCarEngineOn(storeCarCharIsInNoSave(PLAYER_PED), true)
       end
    end
end


function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(u8"SampersikCheat load", 0xFFFFFF)   
    sampRegisterChatCommand('njc', function() enabled = not enabled end)
    addEventHandler('onWindowMessage', function(msg, wparam, lparam)
        if not isSampLoaded() or not isSampfuncsLoaded() then return end
            while not isSampAvailable() do wait(1000) end
        if msg == wm.WM_KEYDOWN or msg == wm.WM_SYSKEYDOWN then
            if wparam == vkeys.VK_H then
                renderWindow[0] = not renderWindow[0]
            end
        end
    end)
    while true do
        wait(0)
        if airbrake[0] then
            -- your code
        end
    end
end

function cc()
    memory.fill(sampGetChatInfoPtr() + 306, 0x0, 25200)
    memory.write(sampGetChatInfoPtr() + 306, 25562, 4, 0x0)
    memory.write(sampGetChatInfoPtr() + 0x63DA, 1, 1)
end
 

aondec

Участник
Автор темы
47
3
Lua:
RPC = {[71] = 'RemovePlayerFromVehicle'}
local imgui = require 'mimgui'
local ffi = require 'ffi'
local vkeys = require 'vkeys'
local lmemory, memory = pcall(require, 'memory')
local encoding = require 'encoding'
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local speed = math.floor(getCharSpeed(1))

encoding.default = 'CP1251'         --[[Указываем кодировку по умолчанию. Обратите внимание,
                                        что она должна совпадать с кодировкой вашего скрипта.]]
local u8 = encoding.UTF8            -- И создаём короткий псевдоним для кодировщика UTF-8

local wm = require 'windows.message'
local new, str, sizeof = imgui.new, ffi.string, ffi.sizeof

local renderWindow, freezePlayer, removeCursor = new.bool(), new.bool(), new.bool()
local inputField = new.char[256](--[[Здесь также следует кодировать информацию!]])
local sizeX, sizeY = getScreenResolution()
local checkboxone = new.bool()
local noeject = new.bool()
local waterdrive = new.bool()
local autoengine = new.bool()
local airbrake = new.bool()

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

local newFrame = imgui.OnFrame(
    function() return renderWindow[0] end,
    function(player)
        imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.SetNextWindowSize(imgui.ImVec2(300, 350), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"SampersikCheat", renderWindow)
        imgui.Text("SACheat 0.1")
        imgui.Text(string.format("Current render mode: %s", renderWindow[0]))
        imgui.ProgressBar(speed/100,imgui.ImVec2(100,24),'Speed: '..speed)
        if imgui.InputText(u8"", inputField, sizeof(inputField)) then
            print(u8:decode(str(inputField)))
        end
        if imgui.Button(u8"Очистить поле") then
            imgui.StrCopy(inputField, '')
        end
        if imgui.Button(u8'Очистить чат') then
            sampRegisterChatCommand('ch', function() cc() end)
        end
        if imgui.Checkbox(u8'Заморозить игрока', freezePlayer) then
            player.LockPlayer = freezePlayer[0]
        end
        if imgui.Checkbox(u8'NoEjectVehicle', noeject) then
            sampSendChat('/njc')
        end
        if imgui.Checkbox(u8'Godmode', checkboxone) then
            sampAddChatMessage('Godmode on/off', -1)
        end
        if imgui.Checkbox(u8'AutoEngine', autoengine) then
            sampAddChatMessage('-', -1)
        end
        if imgui.Checkbox(u8'AirBrake', airbrake) then
            sampAddChatMessage('-', -1)
        end
        if imgui.Checkbox(u8'WaterDrive', waterdrive) then
        end
        if imgui.Checkbox(u8'Скрыть курсор', removeCursor) then
            player.HideCursor = removeCursor[0]
        end
        if player.HideCursor then
            imgui.Text(u8'Курсор скрыт')
        end
        imgui.End()
    end
)

function onReceiveRpc(id, bitStream)
    if noeject then
        if RPC[id] then
            return false
        end
    end
end

function onReceiveRpc(rpcId)
    if noeject[0] and rpcId == 71 then return false end
end

function AutoEngine(PLAYER_PED)
    if autoengine then
       if bool and isCharInAnyCar(PLAYER_PED) then
          setCarEngineOn(storeCarCharIsInNoSave(PLAYER_PED), true)
       end
    end
end


function main()
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage(u8"SampersikCheat load", 0xFFFFFF)  
    sampRegisterChatCommand('njc', function() enabled = not enabled end)
    addEventHandler('onWindowMessage', function(msg, wparam, lparam)
        if not isSampLoaded() or not isSampfuncsLoaded() then return end
            while not isSampAvailable() do wait(1000) end
        if msg == wm.WM_KEYDOWN or msg == wm.WM_SYSKEYDOWN then
            if wparam == vkeys.VK_H then
                renderWindow[0] = not renderWindow[0]
            end
        end
    end)
    while true do
        wait(0)
        if airbrake[0] then
            -- your code
        end
    end
end

function cc()
    memory.fill(sampGetChatInfoPtr() + 306, 0x0, 25200)
    memory.write(sampGetChatInfoPtr() + 306, 25562, 4, 0x0)
    memory.write(sampGetChatInfoPtr() + 0x63DA, 1, 1)
end
А как он должен работать?