бесконечный цикл

Oki_Bern

Участник
Автор темы
169
6
Версия MoonLoader
Другое
Как сделать чтоб строчка "sampSendChat(text)" была не в бесконечном цикле
Lua:
require('lib.moonloader')
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
local clrs = sampGetPlayerColor(id)
local text = '/clist 0'


local cmd = false

function main()
    repeat wait(0) until isSampAvailable()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('cmd', function()
        cmd = not cmd
        sampAddChatMessage(
        cmd and "Включен" or "Выключен", -1)
    end)
    while true do wait(0)
        if cmd then
            wait(1500)
            if clrs ~= 16777215 and clrs ~= 2854722334 and clrs ~= 2855811128 then
                wait(1000)
                sampSendChat(text)
            end
        end
    end
end
 

VanoKLR

Известный
681
402
Как сделать чтоб строчка "sampSendChat(text)" была не в бесконечном цикле
Lua:
require('lib.moonloader')
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
local clrs = sampGetPlayerColor(id)
local text = '/clist 0'


local cmd = false

function main()
    repeat wait(0) until isSampAvailable()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('cmd', function()
        cmd = not cmd
        sampAddChatMessage(
        cmd and "Включен" or "Выключен", -1)
    end)
    while true do wait(0)
        if cmd then
            wait(1500)
            if clrs ~= 16777215 and clrs ~= 2854722334 and clrs ~= 2855811128 then
                wait(1000)
                sampSendChat(text)
            end
        end
    end
end
Lua:
require('lib.moonloader')
local clrs = sampGetPlayerColor(select(2,sampGetPlayerIdByCharHandle(PLAYER_PED)))
local text = '/clist 0'

local cmd = false

function main()
    repeat wait(0) until isSampAvailable()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('cmd', function()
        cmd = not cmd
        sampAddChatMessage(cmd and "Включен" or "Выключен", -1)
    end)
    while true do wait(0)
        if cmd then
            wait(1500)
            if clrs ~= 16777215 and clrs ~= 2854722334 and clrs ~= 2855811128 then
                wait(1000)
                sampSendChat(text)
                break
            end
        end
    end
end
????????
 

Oki_Bern

Участник
Автор темы
169
6
Lua:
require('lib.moonloader')
local clrs = sampGetPlayerColor(select(2,sampGetPlayerIdByCharHandle(PLAYER_PED)))
local text = '/clist 0'

local cmd = false

function main()
    repeat wait(0) until isSampAvailable()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('cmd', function()
        cmd = not cmd
        sampAddChatMessage(cmd and "Включен" or "Выключен", -1)
    end)
    while true do wait(0)
        if cmd then
            wait(1500)
            if clrs ~= 16777215 and clrs ~= 2854722334 and clrs ~= 2855811128 then
                wait(1000)
                sampSendChat(text)
                break
            end
        end
    end
end
????????
а можно сделать чтоб после этого скрипт работал без перезагрузки
 

Oki_Bern

Участник
Автор темы
169
6
А смысл тогда вытаскать sampSrndShat из потока?
я хотел сделать чтоб когда цвет ника было не белым, он менялся на белый по /clist 0, но после измены клиста бесконечно меняется потом даже когда клист уже белый
 

VanoKLR

Известный
681
402
Код:
require('lib.moonloader')


local cmd = false

function main()
    repeat wait(0) until isSampAvailable()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('cmd', function()
        cmd = not cmd
        sampAddChatMessage(cmd and "Включен" or "Выключен", -1)
    end)
    while true do wait(0)
        if cmd then
            wait(1500)
            local clrs = sampGetPlayerColor(select(2,sampGetPlayerIdByCharHandle(PLAYER_PED)))
            if clrs ~= 16777215 or clrs ~= 2854722334 or clrs ~= 2855811128 then
                wait(1000)
                sampSendChat('/clist 0')
            end
        end
    end
end
 
  • Нравится
Реакции: Oki_Bern