require "lib.moonloader"
require "lib.sampfuncs"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local waits = 1000 -- задержка между сообщениями в миллисекундах
local activate = false
local window = imgui.ImBool(false)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("szone", function() window.v = not window.v end)
while true do
wait(0)
imgui.Process = window.v
if not window.v then
imgui.ShowCursor = false
end
if activate == true then
for k, v in ipairs(getAllChars()) do
local res, id = sampGetPlayerIdByCharHandle(v)
if res then
if sampIsPlayerConnected(id) then
sampSendChat("/sms "..id)
wait(waits)
end
end
activate = false
end
end
end
end
function imgui.OnDrawFrame()
if window.v then
imgui.GetStyle().WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
imgui.GetStyle().ButtonTextAlign = imgui.ImVec2(0.5, 0.5)
imgui.ShowCursor = true
imgui.SetNextWindowPos(imgui.ImVec2(imgui.GetIO().DisplaySize.x / 2, imgui.GetIO().DisplaySize.y / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(300, 57), imgui.Cond.FirstUseEver)
if imgui.Begin(u8'Игроки в зоне стрима', window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse) then
imgui.SameLine(40)
if imgui.Button(u8"Отправить СМС всем в зоне стрима") then
activate = true
end
end
imgui.End()
end
end