01-15-2014, 05:07 AM
-- Create table at startup: g_Players = {} function OnWorldStarted(World) -- Hook that gets called when the worlds are initialized g_Players[World:GetName()] = {} end -- Add to table: table.insert(g_Players[cPlayer:GetWorld():GetName()], cPlayer:GetName()) -- Go through all the values. Assuming you need it every tick: function OnWorldTick(World, TimeDelta) for Idx, PlayerName in ipairs(g_Players[World:GetName()]) World:DoWithPlayer(PlayerName, function(Player) -- Do awesome stuff here end) end end