помогите

Alexey Borov

Новичок
Автор темы
4
0
помогите скомпилировать скрипт (на imgui) в луа, и добавить авто активацию кому не сложно
Скрипт (imgui):
for id = 0, 2047 do
    if sampIs3dTextDefined(id) then
        local text, _, x, y, z, _, _, _, _ = sampGet3dTextInfoById(id)
        if string.match(text, "^{%x+}Открыть\n\n{%x+}H$") then
            if getDistanceBetweenCoords2d(pX, pY, x, y) <= 1 then
                sampSendChat("/opengate")
            end
        end
    end
end
 

qdIbp

Автор темы
Проверенный
1,383
1,139
Так что ли?
Lua:
local imgui = require('imgui')
local encoding = require('encoding')
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.ImBool(false)

function main()
    repeat wait(0) until isSampAvailable()

    while true do wait(0)
        imgui.Process = window.v
        for id = 0, 2048 do
            if sampIs3dTextDefined(id) then
                local pX, pY, pZ = getCharCoordinates(PLAYER_PED)
                local text, _, x, y, z, _, _, _, _ = sampGet3dTextInfoById(id)
                if string.match(text, "^{%x+}Открыть\n\n{%x+}H$") then
                    if getDistanceBetweenCoords2d(pX, pY, x, y) < 2 then
                        sampSendChat("/opengate")
                        window.v = true
                    end
                end
            end
        end
    end
end

function imgui.OnDrawFrame()
    if window.v then
        imgui.Begin('My window', window)
            imgui.Text(u8'Хуй знает зачем')
        imgui.End()
    end
end
 

Alexey Borov

Новичок
Автор темы
4
0
Так что ли?
Lua:
local imgui = require('imgui')
local encoding = require('encoding')
encoding.default = 'CP1251'
u8 = encoding.UTF8

local window = imgui.ImBool(false)

function main()
    repeat wait(0) until isSampAvailable()

    while true do wait(0)
        imgui.Process = window.v
        for id = 0, 2048 do
            if sampIs3dTextDefined(id) then
                local pX, pY, pZ = getCharCoordinates(PLAYER_PED)
                local text, _, x, y, z, _, _, _, _ = sampGet3dTextInfoById(id)
                if string.match(text, "^{%x+}Открыть\n\n{%x+}H$") then
                    if getDistanceBetweenCoords2d(pX, pY, x, y) < 2 then
                        sampSendChat("/opengate")
                        window.v = true
                    end
                end
            end
        end
    end
end

function imgui.OnDrawFrame()
    if window.v then
        imgui.Begin('My window', window)
            imgui.Text(u8'Хуй знает зачем')
        imgui.End()
    end
end
не так выразился, что-бы этот код в файле луа был, и с автоактивацией