Фриз

Shepard

Активный
Автор темы
457
88
Версия MoonLoader
Другое
Зависает на секунду, после отправки текста в телеграм
Lua:
requests = require('requests')

local imgui = require "imgui"

local key = require "vkeys"

local sampev = require 'samp.events'

local encoding = require "encoding"

encoding.default = "CP1251"

u8 = encoding.UTF8



require 'lib.moonloader'







local popitka = 0



function urlencode(str)

   if (str) then

      str = string.gsub (str, "\n", "\r\n")

      str = string.gsub (str, "([^%w ])",

         function (c) return string.format ("%%%02X", string.byte(c)) end)

      str = string.gsub (str, " ", "+")

   end

   return str

end



function main()

    while not isSampAvailable() do wait(100) end

    sampAddChatMessage("- Крутяк", -1)

    while true do

        wait(0)

    end

end


function sampev.onShowDialog(id, style, title, button1, button2, text)

    sampAddChatMessage(id, -1)

end




function admmessage(arg)

    msg = urlencode(u8:encode(arg, 'CP1251'))

    requests.get("https://api.telegram.org/bot1623137:AAGzHs-J9DRATDtIUikUqU5W_mW_9YvkCmM/sendMessage?chat_id=-587978562&text=".. msg)

end
можно как-то убрать фриз? ( Api неправильный) ))