e7ea352f41
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
16 lines
466 B
Lua
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 |