Помогите не работает скрипт

v.belov

Новичок
Автор темы
9
0
function main()
repeat wait(0) until isSampAvailable()
wait(2000)
sampRegisterChatCommand("dialog", dialog)
sampAddChatMessage("Loaded", -1)
while true do
wait(0)
end
end
function dialog()
sampShowDialog(1337,'{FF5656}Заголовок','{FFFFFF}Приветствую тебя.\nКак дела?','Приветствую','Досвидания',0)
lua_thread.create(checker)
end
function checker()
while sampIsDialogActive()
wait(0)
local result, button, list, input = sampHasDialogRespond(1337)
if result and button == 1
sampAddChatMessage('Как дела',-1)
elseif result and button == 0 then
sampAddChatMessage('Я на тебя обиделся, уходи!',-1)
end
end
end

 
  • Грустно
Реакции: MrRazrab

VanoKLR

Известный
958
589
Не then а do

Без задержки игра просто зависнет или крашнет. Нужна минимальная хотя бы

function main()
repeat wait(0) until isSampAvailable()
wait(2000)
sampRegisterChatCommand("dialog", dialog)
sampAddChatMessage("Loaded", -1)
while true do
wait(0)
end
end
function dialog()
sampShowDialog(1337,'{FF5656}Заголовок','{FFFFFF}Приветствую тебя.\nКак дела?','Приветствую','Досвидания',0)
lua_thread.create(checker)
end
function checker()
while sampIsDialogActive()
wait(0)
local result, button, list, input = sampHasDialogRespond(1337)
if result and button == 1
sampAddChatMessage('Как дела',-1)
elseif result and button == 0 then
sampAddChatMessage('Я на тебя обиделся, уходи!',-1)
end
end
end

На 20 строчке в конце поставь then
 

IlyaFontonov

Активный
213
57
Работающий код:
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("dialog", dialog) -- yes
    while true do
        wait(0)
        local result, button, list, input = sampHasDialogRespond(1337)

        if result then
            if button == 1 then
                sampAddChatMessage('Как дела',-1)
            elseif button == 0 then
                    sampAddChatMessage('Я на тебя обиделся, уходи!',-1)
            end
        end
    end
end

function dialog()
    sampShowDialog(1337,'{FF5656}Заголовок','{FFFFFF}Приветствую тебя.\nКак дела?','Приветствую','Досвидания',0)
end
 
  • Нравится
Реакции: v.belov

v.belov

Новичок
Автор темы
9
0
Работающий код:
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("dialog", dialog) -- yes
    while true do
        wait(0)
        local result, button, list, input = sampHasDialogRespond(1337)

        if result then
            if button == 1 then
                sampAddChatMessage('Как дела',-1)
            elseif button == 0 then
                    sampAddChatMessage('Я на тебя обиделся, уходи!',-1)
            end
        end
    end
end

function dialog()
    sampShowDialog(1337,'{FF5656}Заголовок','{FFFFFF}Приветствую тебя.\nКак дела?','Приветствую','Досвидания',0)
end
Нужна еще хэлпа, как сделать в этом коде что бы типа нажал клавишу R заюзалась анимка и нажлось F
 

v.belov

Новичок
Автор темы
9
0
Нужна еще хэлпа, как сделать в этом коде что бы типа нажал клавишу R заюзалась анимка и нажлось F

1:
require 'lib.moonloader'

function main() end
    while not isSampAvailable() do wait(0) end
    sampAddChatMessage('Script loaded',FF5656)
    wait(-1)
    while true do
        wait(0)
        if wasKeyPressed(VK_R) then
            sampAddChatMessage('/anim 9')
            if wasKeyPressed(VK_F) then
        end
    end
end
 

IlyaFontonov

Активный
213
57
Lua:
local key = require 'vkeys'

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('sanim', anim)


    sampAddChatMessage('Script loaded',FF5656)


    while true do
        wait(0)

        if anim then
            if wasKeyPressed(key.VK_R) then
                sampSendChat('/anim 9')
                setVirtualKeyDown(VK_F, true)
                wait(50)
                setVirtualKeyDown(VK_F, false)
            end
        end
    end
end

function anim()
    anim = not anim
    if not anim then
        sampAddChatMessage('anim off', -1)
    elseif anim then
        sampAddChatMessage('anim on', -1)
    end
end
 
  • Эм
Реакции: MLycoris

v.belov

Новичок
Автор темы
9
0
Lua:
local key = require 'vkeys'

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('sanim', anim)


    sampAddChatMessage('Script loaded',FF5656)


    while true do
        wait(0)

        if anim then
            if wasKeyPressed(key.VK_R) then
                sampSendChat('/anim 9')
                setVirtualKeyDown(VK_F, true)
                wait(50)
                setVirtualKeyDown(VK_F, false)
            end
        end
    end
end

function anim()
    anim = not anim
    if not anim then
        sampAddChatMessage('anim off', -1)
    elseif anim then
        sampAddChatMessage('anim on', -1)
    end
end
Не прожимается F ну то есть нету сбива
 

Porn Hub

Известный
309
86
Lua:
local key = require 'vkeys'

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('sanim', anim)


    sampAddChatMessage('Script loaded',FF5656)


    while true do
        wait(0)

        if anim then
            if wasKeyPressed(key.VK_R) then
                sampSendChat('/anim 9')
                wait(0)
                setGameKeyState(15, 255)
            end
        end
    end
end

function anim()
    anim = not anim
    if not anim then
        sampAddChatMessage('anim off', -1)
    elseif anim then
        sampAddChatMessage('anim on', -1)
    end
end

Сука, я уже три раза удалял свой ответ, нихера в теме не понял, тебе сейчас что нужно ? То что я скинул ?

или что у тебя не работает, или куда тебе добавить сбив

Кароче походу тебе нужно так, к твоему этому коду с диалогом

Lua:
local key = require 'vkeys'

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("dialog", dialog) -- yes
    while true do
        wait(0)
        local result, button, list, input = sampHasDialogRespond(1337)

        if result then
            if button == 1 then
                sampAddChatMessage('Как дела',-1)
            elseif button == 0 then
                    sampAddChatMessage('Я на тебя обиделся, уходи!',-1)
            end
        end

        if anim then
            if wasKeyPressed(key.VK_R) then
                sampSendChat('/anim 9')
                wait(0)
                setGameKeyState(15, 255)
            end
        end
    end
end

function anim()
    anim = not anim
    if not anim then
        sampAddChatMessage('anim off', -1)
    elseif anim then
        sampAddChatMessage('anim on', -1)
    end
end

function dialog()
    sampShowDialog(1337,'{FF5656}Заголовок','{FFFFFF}Приветствую тебя.\nКак дела?','Приветствую','Досвидания',0)
end
 
Последнее редактирование: