хочу сделать так чтобы мой скрипт отправлял диалог только один раз

Adam_Snappe

Участник
Автор темы
39
2
Вообщем, хочу сделать так чтобы мой скрипт отправлял диалог только один раз, а потом ставил челика в игнор на 10 минут, чтобы ему не отправляло диалог, сам скрипт прикрепил ниже, кто сделает - спасибо , вам огромное !
 

Вложения

  • rheal (3).lua
    1.2 KB · Просмотры: 3

Rei

Известный
Друг
1,632
1,701
Код:
script_name('Версия 0.1')
script_author('Автор Yamato_Menendez')
script_description('rfam')

local act = false
local ignored = {}

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(2000) end
    sampAddChatMessage('Автор скрипта Yamato_Menendez', 0x73b461)
    sampAddChatMessage('Активация скрипта /rheal', 0x73b461)
    sampRegisterChatCommand('rheal', function()
        act = not act
        sampAddChatMessage(act and "[RFAM] {FFFFFF}Скрипт {73b461}включен" or "[RFAM] {FFFFFF}Скрипт {dc4747}выключен", 0x73b461)
    end)
    while true do
        wait(0)
        if act then
            wait(2300)
            for _, v in pairs(getAllChars()) do
                local mx, my, mz = getCharCoordinates(PLAYER_PED)
                local x, y, z = getCharCoordinates(v)
                local result, id = sampGetPlayerIdByCharHandle(v)
                local distance = getDistanceBetweenCoords3d(mx, my, mz, x, y, z)
                if result and v ~= PLAYER_PED and distance < 5.0 and (not ignored[id] or os.time() - ignored[id] > 600) then
                    ignored[id] = os.time()
                    sampSendChat('/heal '.. id)
                end
            end
        end
    end
end