1
0
cuberite-2a/Plugins/Core/playerlist.lua
faketruth e7ea352f41 Got rid of cWorld::GetAllPlayers() and implemented ForEachPlayer() more or less in Lua
Core now uses ForEachPlayer() to interact with connected players

git-svn-id: http://mc-server.googlecode.com/svn/trunk@260 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-14 19:14:23 +00:00

16 lines
466 B
Lua

local PlayerTable = {}
function HandlePlayerListCommand( Split, Player )
PlayerTable = {}
Player:GetWorld():ForEachPlayer( AppendToTable )
local Message = cChatColor.Green .. "Connected players: (".. cChatColor.White.. #PlayerTable .. cChatColor.Green .. ")"
Player:SendMessage( Message )
Player:SendMessage( table.concat(PlayerTable, " ") )
return true
end
function AppendToTable( Player )
table.insert(PlayerTable, Player:GetName() )
end