Marcus
User.postCount++;
For those who rather have their online list in a book rather than a spamming message over the console, you can simply use this code I made.
Enjoy it!
talkactions.xml
online.lua
Enjoy it!
talkactions.xml
PHP:
<talkaction words="!online" script="online.lua" />
online.lua
PHP:
function onSay(player, words, param)
local players = Game.getPlayers()
local playerCount = Game.getPlayerCount()
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.")
local i = 1
local msg = ""
for k, targetPlayer in ipairs(players) do
msg = msg .."[".. i .."] ".. targetPlayer:getName() .. " [" .. targetPlayer:getLevel() .. "]\n"
i = i + 1
end
player:showTextDialog(1978, msg)
return true
end