Что означает sampSendDialogResponse(dialogId, 1, 0, 0)

Памперс

Участник
Автор темы
68
9
Версия MoonLoader
.027.0-preview
Что означает код sampSendDialogResponse(dialogId, 1, 0, 0) из луа arzcatcher
не понятно мне что означает 1, 0, 0 и откуда он их взял
фулл код:
script_name("ARZCatcher")
script_author("ANONIMazer")

events = require "samp.events"
local font = renderCreateFont("Arial", 8, 5)
local status = false

function main()
    repeat wait(0) until isSampAvailable()
    sampAddChatMessage("{FF0000}[AC]{FFFFFF} Скрипт запущен! {ffb400}Разработчик: {FFFFFF}ANONIMazer. || {ffb400}ВК: {FFFFFF}@pu1seanon", -1)
    sampRegisterChatCommand('ARZCatcher', function()
        status = not status
        if status then
            sampAddChatMessage("{FF0000}[AC]{FFFFFF} Скрипт включен...", -1)
        else
            sampAddChatMessage("{FF0000}[AC]{FFFFFF} Скрипт выключен...", -1)
        end
    end)
    while true do
        wait(0)
    end
end

function events.onShowDialog(dialogId)
    if dialogId == 3010 and status then
        sampSendDialogResponse(dialogId, 1, 0, 0)
        sampAddChatMessage("{FF0000}[AC]{FFFFFF} Вы поймали {ffb400}лавку!", -1)
    end
end

function events.onSetObjectMaterialText(ev, data)
    local Object = sampGetObjectHandleBySampId(ev)
    if doesObjectExist(Object) and getObjectModel(Object) == 18663 and string.find(data.text, "(.-) {30A332}Свободная!") then
        if get_distance(Object) and status then
            lua_thread.create(press_key)
        end
    end
end

function press_key()
    setGameKeyState(21, 256)
end

function get_distance(Object)
    local result, posX, posY, posZ = getObjectCoordinates(Object)
    if result then
        if doesObjectExist(Object) then
            local pPosX, pPosY, pPosZ = getCharCoordinates(PLAYER_PED)
            local distance = (math.abs(posX - pPosX)^2 + math.abs(posY - pPosY)^2)^0.5
            local posX, posY = convert3DCoordsToScreen(posX, posY, posZ)
            if round(distance, 2) <= 0.9 then
                return true
            end
        end
    end
    return false
end

function round(x, n)
    n = math.pow(10, n or 0)
    x = x * n
    if x >= 0 then x = math.floor(x + 0.5) else x = math.ceil(x - 0.5) end
    return x / n
end
 
Решение
Грубо говоря, эмулирует выбор/нажатие в диалоге.
sampSendDialogResponse(id, button, listitem, input) Wiki
Где id - ID диалога, которому посылается отправка;
button - номер выбираемой кнопки (0 - отмена, 1 - ок, которая слева)
listitem - номер выбранного пункта, начиная от 0.
input - отправляемый текст.

Hatiko

Известный
Проверенный
1,472
611
Грубо говоря, эмулирует выбор/нажатие в диалоге.
sampSendDialogResponse(id, button, listitem, input) Wiki
Где id - ID диалога, которому посылается отправка;
button - номер выбираемой кнопки (0 - отмена, 1 - ок, которая слева)
listitem - номер выбранного пункта, начиная от 0.
input - отправляемый текст.
 
  • Нравится
Реакции: Carl_Henderson и Tomato