summaryrefslogtreecommitdiffstats
path: root/Plugins/Core/playerlist.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/Core/playerlist.lua')
-rw-r--r--Plugins/Core/playerlist.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/Plugins/Core/playerlist.lua b/Plugins/Core/playerlist.lua
index c120f068f..63990e825 100644
--- a/Plugins/Core/playerlist.lua
+++ b/Plugins/Core/playerlist.lua
@@ -1,16 +1,16 @@
+local PlayerTable = {}
+
function HandlePlayerListCommand( Split, Player )
- local World = Player:GetWorld()
- local PlayerList = World:GetAllPlayers()
+ PlayerTable = {}
+ Player:GetWorld():ForEachPlayer( AppendToTable )
- local Message = cChatColor.Green .. "Connected players: (".. cChatColor.White.. #PlayerList .. cChatColor.Green .. ")"
+ local Message = cChatColor.Green .. "Connected players: (".. cChatColor.White.. #PlayerTable .. cChatColor.Green .. ")"
Player:SendMessage( Message )
-
- local PlayerTable = {}
- for i, TempPlayer in ipairs( PlayerList ) do
- local PlayerName = TempPlayer:GetName()
- table.insert(PlayerTable, PlayerName )
- end
-
+
Player:SendMessage( table.concat(PlayerTable, " ") )
return true
+end
+
+function AppendToTable( Player )
+ table.insert(PlayerTable, Player:GetName() )
end \ No newline at end of file