02-19-2013, 10:58 PM
got a fix for the /players command in console. it was actualy pretty simple. this is the function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | function HandleConsolePlayers(Split) local PlayersInWorlds = {}; -- "WorldName" => [players array] local AddToTable = function (Player) local WorldName = Player:GetWorld():GetName(); if (PlayersInWorlds[WorldName] == nil ) then PlayersInWorlds[WorldName] = {}; end table.insert(PlayersInWorlds[WorldName], Player:GetName() .. " " .. Player:GetIP()); end cRoot:Get():ForEachPlayer(AddToTable); for WorldName, Players in pairs(PlayersInWorlds) do LOG( "World " .. WorldName .. ":" ); for i, PlayerName in ipairs (Players) do LOG( " " .. PlayerName); end end return true; end |