LUA скрипт [Source | NL] Auto-Disconnect | Derank

Олдфаг
Статус
Оффлайн
Регистрация
28 Дек 2018
Сообщения
2,585
Реакции[?]
1,437
Поинты[?]
1K
- Для чего?
- Для людей которые полным пати понижают себе звание. Скрипт автоматически выходит и заходит в игру, чтобы не делать это руками.

Пожалуйста, авторизуйтесь для просмотра ссылки.
Код:
-- by @elleqt from yougame
-- url: https://yougame.biz/threads/160211
local functions_to_delay = {}
local current_time = GlobalVars.realtime
local function call_delay(fn, arguments, time)
    current_time = GlobalVars.realtime
    if fn == nil or time == nil then
        if #functions_to_delay < 1 then return false end
        for i = 1, #functions_to_delay do
            if functions_to_delay[i] ~= nil and current_time > functions_to_delay[i].time_to_delay then
                if functions_to_delay[i].params ~= nil then
                    functions_to_delay[i].funct(functions_to_delay[i].params)
                else
                    functions_to_delay[i].funct()
                end
                table.remove(functions_to_delay, i)
            end
        end
        return true
    end
    table.insert(functions_to_delay, {
        funct = fn,
        params = arguments,
        time_to_delay = math.max(current_time + time + 0.01, current_time + time)
    })
    return true
end

local panorama = Panorama.Open()
local CompetitiveMatchAPI = panorama.CompetitiveMatchAPI

local function reconnect()
    if CompetitiveMatchAPI.HasOngoingMatch() then
        CompetitiveMatchAPI.ActionReconnectToOngoingMatch('', '', '', '')
    end
end

function derank(event)
    if event:GetName() == "round_freeze_end" then
        local local_player = EntityList.GetLocalPlayer()
        local local_team = local_player:GetProp("m_iTeamNum")
        local local_player_info = local_player:GetPlayerInfo()
        local local_player_steamID = local_player_info.iSteamID

        local players = EntityList.GetPlayers()
        local teammates_steamID = {}

        for i, player in pairs(players) do
            local player_info = player:GetPlayerInfo()
            local player_steamID = player_info.iSteamID

            if player:GetProp("m_iTeamNum") == local_team then
                table.insert(teammates_steamID, player_steamID)
            end
        end

        local team_index = 0
        for i, teammate_steamID in pairs(teammates_steamID) do
            if teammate_steamID == local_steam64 then
                team_index = i
            end
        end

        local game_rules = EntityList.GetGameRules()
        local total_rounds_played = game_rules:GetProp("m_totalRoundsPlayed")

        local delay = 5 + ((total_rounds_played + team_index - 1) % #teammates_steamID) * 0.1

        call_delay(reconnect, "", delay + 0.2)
    end
end

function draw()
    call_delay()
end

Cheat.RegisterCallback("draw", draw)
Cheat.RegisterCallback("events", derank)
 
Сверху Снизу