local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
do
window = imgui.ImBool(false)
Reason = {imgui.ImBool(false), imgui.ImBool(false), imgui.ImBool(false), imgui.ImBool(false)}
penaltyInt = {imgui.ImInt(5), imgui.ImInt(10), imgui.ImInt(20), imgui.ImInt(420)}
penaltyStr = {imgui.ImBuffer('Мат', 50), imgui.ImBuffer('Оскорбление', 50), imgui.ImBuffer('Флуд', 50), imgui.ImBuffer('Лох', 50)}
Otv = imgui.ImBuffer('', 256)
penalty = imgui.ImInt(0)
end
function imgui.OnDrawFrame()
local sw, sh = getScreenResolution()
local btn_size = imgui.ImVec2(-0.1, 0)
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(500, 420), imgui.Cond.FirstUseEver) -- размер окна
imgui.Begin(u8'Выдать наказание: '..sampGetPlayerNickname(ID)..' ['..ID..']', window)
for i = 1, #penaltyStr do
if penaltyStr[i].v ~= nil and penaltyInt[i].v ~= nil and Reason[i].v ~= nil then -- чтобы только скрипт крашнуло, если че
if imgui.Checkbox(u8(penaltyStr[i].v)..' ['..penaltyInt[i].v..']', Reason[i]) then
if Reason[i].v then
penalty.v = penalty.v + penaltyInt[i].v
if #Otv.v == 0 then Otv.v = penaltyStr[i].v..'.'
else Otv.v = penaltyStr[i].v..' '..Otv.v end
else
penalty.v = penalty.v - penaltyInt[i].v
Otv.v = string.gsub(Otv.v, penaltyStr[i].v, '')
end
end
end
end
imgui.Text(u8'Наказание: '..u8(Otv.v))
if imgui.Button(u8'Выдать наказание. Время:'..penalty.v) then
sampSendChat('/mute '..ID..' '..penalty.v..' '..Otv.v)
for i = 1, #Reason do
Reason[i].v = false
end
Otv.v = ''
penalty.v = 0
end
imgui.End()
end
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand('menu', function(param)
if param:match('%d+') then
if sampIsPlayerConnected(param) then
ID = param
sampAddChatMessage(param, -1)
window.v = not window.v
end
end
end)
while true do wait(0)
imgui.Process = window.v
end
end