Помощь со скриптом | Arizona rp

Sklaets

Активный
Автор темы
222
35
хотел добавить в скрипт что бы двери сами открывались но не получилось

Lua:
script_name('[NGTeam] - Insurance Helper')
script_author('NGTeam')

require "lib.moonloader"
local sampev = require 'lib.samp.events'

local onoff = false

function sampev.onShowTextDraw(id, data)
    if id == 52 and onoff == true then
        lua_thread.create(function()
            sampSendClickTextdraw(52)
            wait(1000)
            sampSendClickTextdraw(53)
            wait(1000)
            sampSendClickTextdraw(54)           
        end)
    end   
end


function sampev.onShowDialog(dialogId, dialogStyle, dialogTitle, okButtonText, cancelButtonText, dialogText)
    if onoff == true then
        if dialogId == 15111 then       
            local xz = dialogText
                if xz ~= ''  then
                    xz = xz:gsub('\n', '')
                    if xz ~= '' then
                        xz = xz:match('Введите ник клиента:%{......%}(.+)')
                        if xz ~= '' then
                        sampSendDialogResponse(15111, 1, 0, xz)
                        lua_thread.create(function()
                            wait(200)
                            sampCloseCurrentDialogWithButton(0)
                        end)
                    end
                end
            end
        end
    end
    
    if onoff == true then
        if dialogId == 15112 then
            local xz = dialogText
                if xz ~= ''  then
                    xz = xz:gsub('\n', '')
                    if xz ~= '' then
                        xz = xz:match('Укажите тип имущества:%{......%}(.+)')
                        if xz ~= '' then
                        sampSendDialogResponse(15112, 1, 0, xz)
                        lua_thread.create(function()
                            wait(200)
                            sampCloseCurrentDialogWithButton(0)
                        end)
                    end
                end
            end
        end
    end
    
    if onoff == true then
        if dialogId == 15113 then
            local xz = dialogText
                if xz ~= ''  then
                    xz = xz:gsub('\n', '')
                    if xz ~= '' then
                        xz = xz:match('Укажите номер заявки:%{......%}(.+)')
                        if xz ~= '' then
                        sampSendDialogResponse(15113, 1, 0, xz)
                        lua_thread.create(function()
                            wait(200)
                            sampCloseCurrentDialogWithButton(0)
                        end)
                    end
                end
            end
        end   
    end
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then
        return
    end

    while not isSampAvailable() do
        wait(0)
        
    end
    
    sampRegisterChatCommand('ston', function()
        onoff = not onoff
        sampAddChatMessage(onoff and "{FFA500}[NGTeam] - {ffffff}Activated" or "{FFA500}[NGTeam] - {ffffff}Deactivated", -1)
    end)
    
    sampAddChatMessage("{FFA500}[NGTeam] {ffffff}Insurance Helper - Loaded!",-1)
    sampAddChatMessage("{FFA500}[NGTeam] {ffffff}Version - 0.1",-1)

    while true do
        wait(0)   
                if sampTextdrawIsExists(254) and sampTextdrawIsExists(256) then
            setVirtualKeyDown(0x4E, true)
            wait(0)
            setVirtualKeyDown(0x4E, false)
            wait(0)
            setVirtualKeyDown(0x59, true)
            wait(0)
            setVirtualKeyDown(0x59, false)         
        end       
    end
end
Это код без дверей (сверху)

Lua:
script_name('[NGTeam] - Insurance Helper')
script_author('NGTeam')

require "lib.moonloader"
local sampev = require 'lib.samp.events'

local onoff = false

function sampev.onShowTextDraw(id, data)
    if id == 52 and onoff == true then
        lua_thread.create(function()
            sampSendClickTextdraw(52)
            wait(1000)
            sampSendClickTextdraw(53)
            wait(1000)
            sampSendClickTextdraw(54)           
        end)
    end   
end


function sampev.onShowDialog(dialogId, dialogStyle, dialogTitle, okButtonText, cancelButtonText, dialogText)
    if onoff == true then
        if dialogId == 15111 then       
            local xz = dialogText
                if xz ~= ''  then
                    xz = xz:gsub('\n', '')
                    if xz ~= '' then
                        xz = xz:match('Введите ник клиента:%{......%}(.+)')
                        if xz ~= '' then
                        sampSendDialogResponse(15111, 1, 0, xz)
                        lua_thread.create(function()
                            wait(200)
                            sampCloseCurrentDialogWithButton(0)
                        end)
                    end
                end
            end
        end
    end
    
    if onoff == true then
        if dialogId == 15112 then
            local xz = dialogText
                if xz ~= ''  then
                    xz = xz:gsub('\n', '')
                    if xz ~= '' then
                        xz = xz:match('Укажите тип имущества:%{......%}(.+)')
                        if xz ~= '' then
                        sampSendDialogResponse(15112, 1, 0, xz)
                        lua_thread.create(function()
                            wait(200)
                            sampCloseCurrentDialogWithButton(0)
                        end)
                    end
                end
            end
        end
    end
    
    if onoff == true then
        if dialogId == 15113 then
            local xz = dialogText
                if xz ~= ''  then
                    xz = xz:gsub('\n', '')
                    if xz ~= '' then
                        xz = xz:match('Укажите номер заявки:%{......%}(.+)')
                        if xz ~= '' then
                        sampSendDialogResponse(15113, 1, 0, xz)
                        lua_thread.create(function()
                            wait(200)
                            sampCloseCurrentDialogWithButton(0)
                        end)
                    end
                end
            end
        end   
    end
end

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then
        return
    end

    while not isSampAvailable() do
        wait(0)
        
    end
    
    sampRegisterChatCommand('ston', function()
        onoff = not onoff
        sampAddChatMessage(onoff and "{FFA500}[NGTeam] - {ffffff}Activated" or "{FFA500}[NGTeam] - {ffffff}Deactivated", -1)
    end)
    
    sampAddChatMessage("{FFA500}[NGTeam] {ffffff}Insurance Helper - Loaded!",-1)
    sampAddChatMessage("{FFA500}[NGTeam] {ffffff}Version - 0.1",-1)

    while true do
        wait(0)   
                if sampTextdrawIsExists(254) and sampTextdrawIsExists(256) then
            setVirtualKeyDown(0x4E, true)
            wait(0)
            setVirtualKeyDown(0x4E, false)
            wait(0)
            setVirtualKeyDown(0x59, true)
            wait(0)
            setVirtualKeyDown(0x59, false)         
        end
            if settings.autodoor[0] and getActiveInterior() ~= 0 then --THX COSMO
               if opengate_timer == nil or (os.clock() - opengate_timer) >= 0.5 then
                 local pX, pY, pZ = getCharCoordinates(PLAYER_PED)
                   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")
                                opengate_timer = os.clock()
                            end
                        end
                    end
                end
            end
    end
end

А это с вдерьми (сверху)

help