Помогите разобраться

Статус
В этой теме нельзя размещать новые ответы.

ht-

Потрачен
Автор темы
52
4
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
Lua:
local sampev = require 'lib.samp.events'
local a = {'test1', 'test2', 'test3'}
local b = {'test4', 'test5', 'test6'}

function main()
            if not isSampLoaded() or not isSampfuncsLoaded() then return end
            while not isSampAvailable() do wait(100) end
            sampAddChatMessage('скрипт загружен')
            while true do
            wait(0)
            end
        end   

function sampev.onServerMessage(color, text)
    for _,v in pairs(a) do
        if text:find(v) then
            lua_thread.create(function()
            setVirtualKeyDown(18, true)
            wait(100)
            setVirtualKeyDown(18, false)
            wait(1000)
            sampSendDialogResponse(sampGetCurrentDialogId(), 1,2,nil)
            end)
        end
    end
end

function sampev.onServerMessage(color, text)
    for _,v in pairs(b) do
        if text:find(v) then
            lua_thread.create(function()
            setVirtualKeyDown(18, true)
            wait(100)
            setVirtualKeyDown(18, false)
            wait(1000)
            sampSendDialogResponse(sampGetCurrentDialogId(), 1,0,nil)
            end)
        end
    end
end

не понимаю почему test4', 'test5', 'test6 работают, а test1', 'test2', 'test3 не работают
 
  • Эм
Реакции: YarikVL
Решение
попробуй так
Lua:
local sampev = require 'lib.samp.events'
local a = {'test1', 'test2', 'test3'}
local b = {'test4', 'test5', 'test6'}

function main()
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage('скрипт загружен')
    wait(-1)
end   

function sampev.onServerMessage(color, text)
    for _,v in pairs(a) do
        if text:find(v) then
            lua_thread.create(function()
            setVirtualKeyDown(18, true)
            wait(100)
            setVirtualKeyDown(18, false)
            wait(1000)
            sampSendDialogResponse(sampGetCurrentDialogId(), 1,2,nil)
            end)
        end
    end
    for _,v in pairs(b) do
        if text:find(v) then
            lua_thread.create(function()...

MLycoris

На вид оружие массового семяизвержения
Проверенный
1,981
2,189
попробуй так
Lua:
local sampev = require 'lib.samp.events'
local a = {'test1', 'test2', 'test3'}
local b = {'test4', 'test5', 'test6'}

function main()
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage('скрипт загружен')
    wait(-1)
end   

function sampev.onServerMessage(color, text)
    for _,v in pairs(a) do
        if text:find(v) then
            lua_thread.create(function()
            setVirtualKeyDown(18, true)
            wait(100)
            setVirtualKeyDown(18, false)
            wait(1000)
            sampSendDialogResponse(sampGetCurrentDialogId(), 1,2,nil)
            end)
        end
    end
    for _,v in pairs(b) do
        if text:find(v) then
            lua_thread.create(function()
            setVirtualKeyDown(18, true)
            wait(100)
            setVirtualKeyDown(18, false)
            wait(1000)
            sampSendDialogResponse(sampGetCurrentDialogId(), 1,0,nil)
            end)
        end
    end
end
 
  • Нравится
  • Грустно
Реакции: qdIbp и ht-
Статус
В этой теме нельзя размещать новые ответы.