[SUGGESTION] AFK mode for people AFK longer than 5 minutes

Discussion in 'Suggestions / Bugs' started by Bruhtatochips, Jul 30, 2020.

Thread Status:
Not open for further replies.
  1. Bruhtatochips

    Bruhtatochips New Member

    Joined:
    Jul 19, 2017
    Messages:
    15
    Likes Received:
    4
    AFK people are included in votes like /extend and /rtv. This means that if there's enough AFK people in a server at a moments notice that if every active player voted /extend or /rtv, it wouldn't be passed. This happened to us earlier in which we needed 11 votes, had 8 already, and the rest of the people needed for it to pass were AFK meaning we couldn't extend the map at all. It would seriously improve the player experience if those AFK longer than, say 5 minutes, were put in a special AFK mode where they're not included in those votes but are still ingame. When they move, they exit the AFK mode. This would make it so if there were 5 people AFK for the map, and only 9 active players, that if 8/9 active players voted then it would pass instead of it failing since 8/14 didn't vote. This even applies when the votes need a fraction, because not every active player is going to agree and since all the AFK players would automatically disagree the vote wouldn't pass, but with an AFK mode the vote would pass if the fraction needed voted yes.
     
  2. Teddi

    Teddi Well-Known Member Bear

    Joined:
    Jul 21, 2007
    Messages:
    9,635
    Likes Received:
    1,118
    RTV / Extend does not count AFK players. However when a map changes level, all players will be unflagged from being AFK (for ~5 minutes).

    Code:
    //Quick function to garner what our 'non-afk' amount of players is.
    local validPlayers = 0
    function BB.GetActivePlayers()
        if !BB.Modules.IsLoaded("afk_system") then
            BB.EMsg("afk_system module is not loaded, cannot use this function!")
            return #player.GetAll()
        end
    
        validPlayers = 0
        for k, v in pairs(player.GetAll()) do
            if v:GetAFKState() then
                continue
            end
            validPlayers = validPlayers + 1
        end
    
        return validPlayers
    end
    The above function is what decides (alongside with some functions not presented) how many players are considered required for a given vote in terms of "active" players. What I would recommend however is trying /rtv or /extend over periods of times (even if you've already done a command) as we're not actively recalculating these requirements - they only get called when a player tries to use one of those commands.
     
    Soders likes this.
Thread Status:
Not open for further replies.