imgui = require 'imgui'
ev = require 'samp.events'
encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local test_ws = imgui.ImBool(false)
local nick_name = imgui.ImBuffer(256)
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('test',function() test_ws.v = not test_ws.v end)
while true do wait(0) imgui.Process = test_ws.v end
end
function imgui.OnDrawFrame()
local x, y = getScreenResolution()
imgui.LockPlayer = true
imgui.SetNextWindowPos(imgui.ImVec2(x/2, y/2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(900, 500), imgui.Cond.FirstUseEver)
imgui.Begin(u8('Test'), test_ws)
imgui.Text(u8('Ник игрока: '))
imgui.SameLine()
imgui.InputText('##NickPlayer', nick_name)
if imgui.Button(u8("Отправить /sms")) then
local result = sampIsPlayerConnected(nick_name)
if not result then
sampSendChat('/offsms '..nick_name..' 1')
else
sampSendChat('/sms '..nick_name..' 22')
end
end
imgui.End()
end