Помогите с луа

Mikeyka

Новичок
Автор темы
1
0
Неинформативное название темы
Версия MoonLoader
Другое
Код:
local encoding = require('encoding')
encoding.default = 'CP1251'
local u8 = encoding.UTF8

local bot_token =
local chat_id =
local last_id = 0

function main()
    while not isSampAvailable() do wait(2000) end
    wait(5000)
    
    while true do
        lua_thread.create(function()
            local https = require('ssl.https')
            local url = 'https://api.telegram.org/bot'..bot_token..'/getUpdates?offset='..(last_id + 1)
            
            pcall(function()
                local result = https.request(url)
                local data = decodeJson(result)
                if data and data.ok and data.result then
                    for _, update in ipairs(data.result) do
                        if update.update_id > last_id then
                            last_id = update.update_id
                            if update.message and update.message.text and tostring(update.message.from.id) == chat_id then
                                sampSendChat(u8:decode(update.message.text))
                            end
                        end
                    end
                end
            end)
        end)
        
        wait(5000) -- Проверка каждые 10 секунд
    end
end
как пофиксить небольшой подлаг в игре когда идет проверка тг на наличие сообщения
 

chromiusj

модерирую шмодерирую
Модератор
5,975
4,295
ну или отсюда вытащи на крайний случай