Не получается сделать активацию и деактивацию

Walkerbe

Новичок
Автор темы
7
0
Форматирование
Версия MoonLoader
.027.0-preview
Lua:
script_name("KiborgG")
script_author("Aramdillo-CLD")
script_description('Kiborg Soft Private')

require 'lib.moonloader'
local memory = require 'memory'

function main()
    while not isSampLoaded and not isSampfuncsLoaded do wait(0) end
    while not isSampAvailable do wait(0) end

    wait(5000)

    while true do
        wait(0)
        if not isCharDead(playerPed) then
            extra_ws(true)
        else
            extra_ws(false)
        end
    end
end

function extra_ws(active)
    if active then
        if not patch_cameraRestore then
            extraws1 = memory.read(0x5109AC, 1, true)
            extraws2 = memory.read(0x5109C5, 1, true)
            extraws3 = memory.read(0x5231A6, 1, true)
            extraws4 = memory.read(0x52322D, 1, true)
            extraws5 = memory.read(0x5233BA, 1, true)
        end
        memory.write(0x5109AC, 235, 1, true)
        memory.write(0x5109C5, 235, 1, true)
        memory.write(0x5231A6, 235, 1, true)
        memory.write(0x52322D, 235, 1, true)
        memory.write(0x5233BA, 235, 1, true)
    elseif extraws1 ~= nil then
        memory.write(0x5109AC, patch_cameraRestore1, 1, true)
        memory.write(0x5109C5, patch_cameraRestore2, 1, true)
        memory.write(0x5231A6, patch_cameraRestore3, 1, true)
        memory.write(0x52322D, patch_cameraRestore4, 1, true)
        memory.write(0x5233BA, patch_cameraRestore5, 1, true)
        extraws1 = nil
    end
end
куда здесь вставить активацию и деактивацию, уже много раз перепробовал игра не читает код. Помогите позязя. Хотелось бы активацию на клавишу 6 а деактивацию на 7.
 
Последнее редактирование модератором:

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,771
11,214
Lua:
script_name("KiborgG")
script_author("Aramdillo-CLD")
script_description('Kiborg Soft Private')

require 'lib.moonloader'
local memory = require 'memory'
local disable_on_death = false

function main()
    while not isSampLoaded and not isSampfuncsLoaded do wait(0) end
    while not isSampAvailable do wait(0) end

    wait(5000)

    while true do
        wait(0)
        
        if wasKeyPressed(54) and not sampIsChatInputActive() and not sampIsDialogActive() then
            extra_ws(true)
            disable_on_death = true
        end
        if wasKeyPressed(55) and not sampIsChatInputActive() and not sampIsDialogActive() then
            extra_ws(false)
            disable_on_death = false
        end

        if disable_on_death then
            if not isCharDead(playerPed) then
                extra_ws(true)
            else
                extra_ws(false)
            end
        end
    end
end

function extra_ws(active)
    if active then
        if not patch_cameraRestore then
            extraws1 = memory.read(0x5109AC, 1, true)
            extraws2 = memory.read(0x5109C5, 1, true)
            extraws3 = memory.read(0x5231A6, 1, true)
            extraws4 = memory.read(0x52322D, 1, true)
            extraws5 = memory.read(0x5233BA, 1, true)
        end
        memory.write(0x5109AC, 235, 1, true)
        memory.write(0x5109C5, 235, 1, true)
        memory.write(0x5231A6, 235, 1, true)
        memory.write(0x52322D, 235, 1, true)
        memory.write(0x5233BA, 235, 1, true)
    elseif extraws1 ~= nil then
        memory.write(0x5109AC, patch_cameraRestore1, 1, true)
        memory.write(0x5109C5, patch_cameraRestore2, 1, true)
        memory.write(0x5231A6, patch_cameraRestore3, 1, true)
        memory.write(0x52322D, patch_cameraRestore4, 1, true)
        memory.write(0x5233BA, patch_cameraRestore5, 1, true)
        extraws1 = nil
    end
end
 
  • Нравится
Реакции: Walkerbe

Walkerbe

Новичок
Автор темы
7
0
Lua:
script_name("KiborgG")
script_author("Aramdillo-CLD")
script_description('Kiborg Soft Private')

require 'lib.moonloader'
local memory = require 'memory'
local disable_on_death = false

function main()
    while not isSampLoaded and not isSampfuncsLoaded do wait(0) end
    while not isSampAvailable do wait(0) end

    wait(5000)

    while true do
        wait(0)
       
        if wasKeyPressed(54) and not sampIsChatInputActive() and not sampIsDialogActive() then
            extra_ws(true)
            disable_on_death = true
        end
        if wasKeyPressed(55) and not sampIsChatInputActive() and not sampIsDialogActive() then
            extra_ws(false)
            disable_on_death = false
        end

        if disable_on_death then
            if not isCharDead(playerPed) then
                extra_ws(true)
            else
                extra_ws(false)
            end
        end
    end
end

function extra_ws(active)
    if active then
        if not patch_cameraRestore then
            extraws1 = memory.read(0x5109AC, 1, true)
            extraws2 = memory.read(0x5109C5, 1, true)
            extraws3 = memory.read(0x5231A6, 1, true)
            extraws4 = memory.read(0x52322D, 1, true)
            extraws5 = memory.read(0x5233BA, 1, true)
        end
        memory.write(0x5109AC, 235, 1, true)
        memory.write(0x5109C5, 235, 1, true)
        memory.write(0x5231A6, 235, 1, true)
        memory.write(0x52322D, 235, 1, true)
        memory.write(0x5233BA, 235, 1, true)
    elseif extraws1 ~= nil then
        memory.write(0x5109AC, patch_cameraRestore1, 1, true)
        memory.write(0x5109C5, patch_cameraRestore2, 1, true)
        memory.write(0x5231A6, patch_cameraRestore3, 1, true)
        memory.write(0x52322D, patch_cameraRestore4, 1, true)
        memory.write(0x5233BA, patch_cameraRestore5, 1, true)
        extraws1 = nil
    end
end
почему при деактивации с камерой какая-то дичь творится, можешь исправить?
 

AnWu

Guardian of Order
Всефорумный модератор
4,685
5,165
почему при деактивации с камерой какая-то дичь творится, можешь исправить?
Ты выдернул код кусками откуда-то и хочешь чтобы оно работало? Переменных cameraRestore попросту нигде не объявлено
 

Walkerbe

Новичок
Автор темы
7
0
Ок. Откуда переменные patch_cameraRestore(1-5)
https://www.blast.hk/threads/47360/ держи
1608540183404.png
а что значит закомментить?
 
Последнее редактирование:

Walkerbe

Новичок
Автор темы
7
0
в начале строки поставить -- (два тире)
слушай, мне модер дал пред.,а где можно узнать как сделать такой же формат какой надо, ибо как сам видишь по профилю я новичок?
 

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,771
11,214
слушай, мне модер дал пред.,а где можно узнать как сделать такой же формат какой надо, ибо как сам видишь по профилю я новичок?
Если ты про форматирование кода, то:
1.
1608542687247.png



2.

1608542719074.png
 
  • Нравится
Реакции: Walkerbe и AnWu