• 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!

!online

Kthxbye

New Member
Joined
Jul 11, 2012
Messages
122
Reaction score
2
I need this script to not show online support players
Lua:
local maxPlayersPerMessage = 10

function onSay(player, words, param)
    local hasAccess = player:getGroup():getAccess()
    local players = Game.getPlayers()
    local onlineList = {}

    for _, targetPlayer in ipairs(players) do
        if hasAccess or not targetPlayer:isInGhostMode() then
            table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
        end
    end

    local playersOnline = #onlineList
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, ("%d players online."):format(playersOnline))

    for i = 1, playersOnline, maxPlayersPerMessage do
        local j = math.min(i + maxPlayersPerMessage - 1, playersOnline)
        local msg = table.concat(onlineList, ", ", i, j) .. "."
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
    end
    return false
end
 

forgee

Veteran OT User
Joined
May 9, 2011
Messages
321
Solutions
16
Reaction score
270
Location
Sweden
GitHub
forgee
Staff members should see other staff members but players should not see staff. I did not test it though.
Lua:
local maxPlayersPerMessage = 10

function onSay(player, words, param)
    local hasAccess = player:getGroup():getAccess()
    local players = Game.getPlayers()
    local onlineList = {}

    for _, targetPlayer in ipairs(players) do
        if hasAccess or not targetPlayer:getGroup():getAccess() then
            table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
        end
    end

    local playersOnline = #onlineList
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, ("%d players online."):format(playersOnline))

    for i = 1, playersOnline, maxPlayersPerMessage do
        local j = math.min(i + maxPlayersPerMessage - 1, playersOnline)
        local msg = table.concat(onlineList, ", ", i, j) .. "."
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
    end
    return false
end
 
Top