чекер

Lance_Sterling

Известный
Автор темы
802
284
Версия MoonLoader
.026-beta
игру крашит через энное количество времени чо делать, уже все перепробовал
(к слову это мой первый чекер для админов так что не бейте пж)
Lua:
check = lua_thread.create_suspended(function()
        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()
                                for _, v in ipairs(checkerFriends) do
                                    wait(0)
                                    if v:gsub('%[%d+%]', '') == checker[k].NICK then
                                        return
                                    end
                                end
                                wait(10)
                                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)
    
    
--сам фрейм с чекером
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 and not sampIsChatInputActive() 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'Игроки онлайн:')
            lua_thread.create(function()
                check:run()
                wait(3000)
            end)
            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 sampGetPlayerIdByNickname(v:gsub('%[%d+%]', '')) == -1 then
                    table.remove(checkerFriends, k)
                end
            end
        end
    end
)

--переменные все выше
local show_checker = new.bool(mainIni.settings.show_checker)
local MOVE_CHECKER = false
local checkerPos = {
    imgui.ImVec2(mainIni.checker.posX, mainIni.checker.posY)
}
local checkerFriends = {}
 

Vespan

loneliness
Проверенный
2,105
1,639
Lua:
check = lua_thread.create_suspended(function()
        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()
                                for _, v in ipairs(checkerFriends) do
                                    wait(0)
                                    if v:gsub('%[%d+%]', '') == checker[k].NICK then
                                        return
                                    end
                                end
                                wait(10)
                                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)
потому что поток в потоке создан ( из-за этого у меня игра крашилась )
сделай один поток и все
 

Lance_Sterling

Известный
Автор темы
802
284
Lua:
check = lua_thread.create_suspended(function()
        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()
                                for _, v in ipairs(checkerFriends) do
                                    wait(0)
                                    if v:gsub('%[%d+%]', '') == checker[k].NICK then
                                        return
                                    end
                                end
                                wait(10)
                                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)
потому что поток в потоке создан ( из-за этого у меня игра крашилась )
сделай один поток и все
так не получится, мне надо чекать есть ли уже данный ник в таблице или нет, если не задать там поток то не работать будет

Lua:
check = lua_thread.create_suspended(function()
        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()
                                for _, v in ipairs(checkerFriends) do
                                    wait(0)
                                    if v:gsub('%[%d+%]', '') == checker[k].NICK then
                                        return
                                    end
                                end
                                wait(10)
                                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)
потому что поток в потоке создан ( из-за этого у меня игра крашилась )
сделай один поток и все
кароч я сделал чтото типо этого(почемуто щас не крашит хотя раньше скрипт крашился)
но кароче всплыло вот это говно
1679739279777.png

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 and not sampIsChatInputActive() 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()
                                    for _, v in ipairs(checkerFriends) do
                                        wait(0)
                                        if v:gsub('%[%d+%]', '') == checker[k].NICK then
                                            return
                                        end
                                    end
                                    wait(10)
                                    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
            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 sampGetPlayerIdByNickname(v:gsub('%[%d+%]', '')) == -1 then
                    table.remove(checkerFriends, k)
                end
            end
        end
    end
)
 
Последнее редактирование: