How do I get Gmod to return a number of players on the server?

This is what I’ve got:



include( 'shared.lua' )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

function GM:Initialize()
	self:Wait()
	local paused = false
end

function GM:Wait()
	timer.Create("wait", .01, .01, function()
		if table.Count( player ) > 1 then
			self:BeginRound()
			timer.Stop("wait")
		end
	end)
	timer.Start("wait")
end

function GM:Loadout( pl )
end

function GM:BeginRound( pl )
	if( !self:Pause() ) then
		print("The game begins!")
		PrintMessage( HUD_PRINTTALK, "The Game Begns!" )
	end
end

function GM:Pause()
	if paused == true then return false end
	if paused == false then return true end
end


Is this supposed to work?

The console of the server gives me the “The game begins” console message before anyone even joins.

#player.GetAll() will return the number of players on the server.

player is a table that has more than one thing in it - GetAll, GetHumans, etc.

Do this:


if #player.GetAll( ) > 1 then
  self:BeginRound( )
  ...
end

THANK YOU!!! IT WORKED!!!