sampSendDialogResponse

Marv22

Участник
Автор темы
38
1
Версия MoonLoader
.027.0-preview
На окне 9469 зависает, не вписывает туда текст из переменной ' promocode ' , без return false работает но не останавливается. Не знаю в чем причина

Lua:
local vkeys = require 'vkeys'
local hook = require 'lib.samp.events'

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(100) end

    while true do
        wait(0)

        if isKeyDown(vkeys.VK_Q) and isKeyJustPressed(vkeys.VK_R) and not sampIsChatInputActive() then
            sampSendChat('/mm')
            servername = sampGetCurrentServerName()

            if string.match(servername, 'Scottdale') then
                promocode = 'Steve'
        --        print(promocode)
        --        wait(1000)
            end

         end
    end
end

function hook.onShowDialog(id, style, title, button1, button2, text)
    if string.match(text, 'Не использован') then
        if id == 722 then
            sampSendDialogResponse(722, 1, 11, '')
            return false
        end
        if id == 9469 then
            sampSendDialogResponse(9469, 1, 0, promocode)
            return false
        end
        if id == 9476 then
            sampSendDialogResponse(9476, 1, 0, '')
            return false
        end
    end
end
 

Marv22

Участник
Автор темы
38
1
в local засунь
и попробуй wait небольшой добавить перед отправкой
Безуспешно

Lua:
local vkeys = require 'vkeys'
local hook = require 'lib.samp.events'

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(100) end

    while true do
        wait(0)

        if isKeyDown(vkeys.VK_Q) and isKeyJustPressed(vkeys.VK_R) and not sampIsChatInputActive() then
            sampSendChat('/mm')
            servername = sampGetCurrentServerName()

            if string.match(servername, 'Scottdale') then
            local    promocode = 'Steve'
                print(promocode)
            end

         end
    end
end

function hook.onShowDialog(id, style, title, button1, button2, text)
    if string.match(text, 'Не использован') then
        if id == 722 then
            sampSendDialogResponse(722, 1, 11, '')
            return false
        end
        if id == 9469 then
            wait(100)
      sampSendDialogResponse(9469, 1, 0, promocode)
      return false
    end
        if id == 9476 then
            sampSendDialogResponse(9476, 1, 0, '')
            return false
        end
    end
end
 

atizoff

приобретаю кашель за деньги
Проверенный
1,295
1,178

Carrentine

Потрачен
569
460
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
делает переменную/то что ты возвёл глобальным, короче ты можешь где угодно его использовать

используешь wait не в lua_thread.create
ЛУА крутой язык
создаем ЛОКАЛЬНУЮ переменную получаем ГЛОБАЛЬНУЮ
 
  • Влюблен
Реакции: atizoff

Marv22

Участник
Автор темы
38
1
делает переменную/то что ты возвёл глобальным, короче ты можешь где угодно его использовать

используешь wait не в lua_thread.create
гага я уже понял, но у меня без патока не выдало ошибку
Lua:
local vkeys = require 'vkeys'
local hook = require 'lib.samp.events'

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
  while not isSampAvailable() do wait(100) end

    while true do
        wait(0)

        if isKeyDown(vkeys.VK_Q) and isKeyJustPressed(vkeys.VK_R) and not sampIsChatInputActive() then
            sampSendChat('/mm')
            servername = sampGetCurrentServerName()

            if string.match(servername, 'Scottdale') then
                local    promocode = 'Steve'
                print(promocode)
            end

         end
    end
end

function hook.onShowDialog(id, style, title, button1, button2, text)
    if string.match(text, 'Не использован') then
        if id == 722 then
            sampSendDialogResponse(722, 1, 11, '')
            return false
        end
        wait(1000)
        if id == 9469 then
            lua_thread.create(function()
                wait(100)
                sampSendDialogResponse(9469, 1, 0, promocode)
            end)
            return false
        end
        if id == 9476 then
            sampSendDialogResponse(9476, 1, 0, '')
            return false
        end
    end
end
Все ещё не решил проблему
 
Последнее редактирование: