• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Show every 5 minutes..

viking

Member
Joined
Aug 20, 2015
Messages
323
Reaction score
22
Any script to show in screen top killers and top frags every 5 minutes?


Please and thanks ;D

tfs 1.2 Protocol 10.76 ~10.79
 
Code:
    local topAmount = 5
    local fragTime = configManager.getNumber(configKeys.FRAG_TIME)
    function onThink(creature, interval)
        local text = ''
        local players = {}
        for _, playerId in ipairs(Game.getPlayers()) do
            local skullTime = playerId:getSkullTime()
            if skullTime > 0 then
                players[#players + 1] = {}
                players[#players][1] = playerId
                players[#players][2] = math.ceil(skullTime / fragTime)
            end
        end
        if #players < 2 then
            return false
        end
        table.sort(players, function(a, b) return a[2] > b[2] end)
        -- just incase there is less then topAmount of pkers
        local maxAmount = topAmount < #players and topAmount or #players
        for i = 1, maxAmount do
            text = text .. players[i][1]:getName() .. (i == maxAmount and '.' or ', ')
        end
        broadcastMessage('The top ' .. maxAmount .. ' fraggers on the server are ' .. text, MESSAGE_STATUS_WARNING)
        return true
    end
 
Last edited:
Back
Top