Не регистрируется команда

Botovod1488

Участник
Автор темы
35
8
Версия MoonLoader
.027.0-preview
В чем проблема?

Lua:
require "lib.moonloader"
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("ah", cmd_help)
    sampAddChatMessage("work", 0x3152f5)
end

function cmd_help(arg)
    sampShowDialog(1, "текст", "Ок", "Закрыть", 0)
end
 

Dmitriy Makarov

25.05.2021
Проверенный
2,513
1,140
Так попробуй.
Lua:
require "lib.moonloader"
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("ah", cmd_help)
    sampAddChatMessage("work", 0x3152f5)
    wait(-1)
end

function cmd_help(arg)
    sampShowDialog(1, "Заголовок", "Текст", "Ок", "Закрыть", 0)
end
 
  • Нравится
Реакции: Botovod1488

Sidney31

Известный
1,116
383
Нужно регать команду перед бесконечным циклом.
Lua:
require "lib.moonloader"

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    sampRegisterChatCommand("ah", cmd_help)
    sampAddChatMessage("work", 0x3152f5)
    while not isSampAvailable() do
        wait(100)
    end
end

function cmd_help(arg)
    sampShowDialog(1, "текст", "Ок", "Закрыть", 0)
end
 

Botovod1488

Участник
Автор темы
35
8
Нужно регать команду перед бесконечным циклом.
Lua:
require "lib.moonloader"

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    sampRegisterChatCommand("ah", cmd_help)
    sampAddChatMessage("work", 0x3152f5)
    while not isSampAvailable() do
        wait(100)
    end
end

function cmd_help(arg)
    sampShowDialog(1, "текст", "Ок", "Закрыть", 0)
end
не пашет
 

Sidney31

Известный
1,116
383
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand("ah", cmd_help)
    sampAddChatMessage("work", 0x3152f5)
    while true do
        wait(0)
    end
end
function cmd_help(arg)
    sampShowDialog(1, "текст", "Ок", "Закрыть", 0)
end

Если не заработает, то открой сампфункс (на тильду/ё) и кинь скрин