- 992
- 354
- Версия MoonLoader
- .026-beta
есть ли способ оптимизировать данный код?
если есть, пж дайте обьяснения и чо как где
если кто не понял это чекер
@chapo
если есть, пж дайте обьяснения и чо как где
если кто не понял это чекер
Lua:
local checkerFrame = imgui.OnFrame(
function() return not isGamePaused() and not isPauseMenuActive() end,
function(player)
player.HideCursor = true
local dl = imgui.GetBackgroundDrawList()
if mainIni.settings.show_checker and sampGetGamestate() == 3 then
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[1].x - 1, checkerPos[1].y - 20 + 1), 0xFF000000, u8'Игроки онлайн:')
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[1].x + 1, checkerPos[1].y - 20 - 1), 0xFF000000, u8'Игроки онлайн:')
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[1].x - 1, checkerPos[1].y - 20 - 1), 0xFF000000, u8'Игроки онлайн:')
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[1].x + 1, checkerPos[1].y - 20 + 1), 0xFF000000, u8'Игроки онлайн:')
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[1].x, checkerPos[1].y - 20), 0xFFFF8C00, u8'Игроки онлайн:')
for i = 0, sampGetMaxPlayerId(false) do
if sampIsPlayerConnected(i) then
for k, _ in ipairs(checker) do
if checker[k] then
if checker[k].NICK == sampGetPlayerNickname(i) then
lua_thread.create(function()
wait(1000)
local result = true
for _, v in ipairs(checkerFriends) do
wait(0)
if v and checker[k] then
if v:gsub('%[%d+%]', '') == checker[k].NICK then
result = false
end
end
end
if result and checker[k] then
table.insert(checkerPos, imgui.ImVec2(checkerPos[#checkerPos].x, checkerPos[#checkerPos].y + 20))
table.insert(checkerFriends, checker[k].NICK..'['..i..']')
end
end)
end
end
end
end
end
if not MOVE_CHECKER then
for k, v in ipairs(checkerFriends) do
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[k].x - 1, checkerPos[k].y + 1), 0xFF000000, v)
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[k].x + 1, checkerPos[k].y - 1), 0xFF000000, v)
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[k].x - 1, checkerPos[k].y - 1), 0xFF000000, v)
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[k].x + 1, checkerPos[k].y + 1), 0xFF000000, v)
dl:AddTextFontPtr(Font[20], 20, imgui.ImVec2(checkerPos[k].x, checkerPos[k].y), 0xFFFFFFFF, v)
if sampGetPlayerNickname(v:match('.+%[(%d+)%]')) ~= v:gsub('%[%d+%]', '') then
table.remove(checkerFriends, k)
end
if sampGetPlayerIdByNickname(v:gsub('%[%d+%]', '')) == -1 then
table.remove(checkerFriends, k)
end
end
end
end
end
)
@chapo
Последнее редактирование: