- 17
- 1
Привет, крашит скриптик 1. Код ниже
Lua code:
function checklvls()
botM = {}
mn = {}
for i = 0, sampGetMaxPlayerId(false) do
if sampIsPlayerConnected(i) then
if sampGetPlayerScore(i) <= bot_punish.settings.LvlsRange and sampGetPlayerScore(i) > 0 then
botM[#botM + 1] = sampGetPlayerNickname(i)
check = true
end
end
end
for k,v in pairs(botM) do
sampSendChat('/cl '..v)
end
if #botM == #mn then
findbot = false
end
end
set = {
botFind = new.bool(false)
}
local botFinder = imgui.OnFrame(
function() return set.botFind[0] end,
function(player)
local wSize = imgui.GetWindowSize()
local column_max_len = wSize.x - (imgui.GetStyle().WindowPadding.x * 2)
imgui.SetNextWindowPos(imgui.ImVec2(sizeX / 2, sizeY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(500, 400))
imgui.Begin(u8'Поиск ботов##botFind', set.botFind, imgui.WindowFlags.NoTitleBar + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
if imgui.Button(u8'Поиск ботов', imgui.ImVec2(200, 50)) then
checklvls()
findbot = true
end
if #mn > 0 then
imgui.Text(u8('Идёт поиск ботов.. Проверено '..#mn..' из '..#botM..'!'))
end
if #mn > 0 and #mn == #botM then
show = true
findot = false
end
if show == true then
for k,v in pairs(mn) do
array = decodeJson(v)
for nick, cl in pairs(array) do
imgui.Text(u8(cl))
imgui.SameLine(column_max_len/3)
imgui.Text(u8('| '..nick))
imgui.SameLine(column_max_len - 10)
if CloseButton('##Removeplayer'..k, 15, 5) then
table.remove(mn, k)
end
end
end
end
end
)
function sampev.onServerMessage(color, text)
if findbot == true then
if text:find('.*PC Launcher') then
for k, v in pairs(botM) do
if text:find('Игрок (%S*)%[(%d*)%]') then
nick = text:match('Игрок (%S*)%[%d*%]')
if nick == v then
cl = 'Launcher'
mn[#mn+1] = encodeJson({[nick] = cl})
end
end
end
return false
end
if text:find('.*неофициального клиента.*нет voice') then
for k, v in pairs(botM) do
if text:find('Игрок (%S*)%[(%d*)%]') then
nick = text:match('Игрок (%S*)%[%d*%]')
if nick == v then
cl = 'Client'
mn[#mn+1] = encodeJson({[nick] = cl})
end
end
end
return false
end
if text:find('.*Mobile Launcher') then
for k, v in pairs(botM) do
if text:find('Игрок (%S*)%[(%d*)%]') then
nick = text:match('Игрок (%S*)%[%d*%]')
if nick == v then
cl = 'Mobile'
mn[#mn+1] = encodeJson({[nick] = cl})
end
end
end
end
if text:find('Игрок не в сети') then
mn[#mn+1] = encodeJson({['OFF'] = 'OFF'})
return false
end
end
end