
local meta = FindMetaTable( "Player" )

// Return if there's nothing to add on to
if (!meta) then return end

g_SBoxObjects = {}

function meta:GetCount( str )

	local key = self:UniqueID()
	local tab = g_SBoxObjects[ key ]
	
	if ( !tab || !tab[ str ] ) then return 0 end
	
	local c = 0
	
	for k, v in pairs ( tab[ str ] ) do
	
		if (v:IsValid()) then 
			c = c + 1
		else
			tab[ str ][ k ] = nil
		end
	
	end

	return c

end

function meta:AddCount( str, ent )

	local key = self:UniqueID()
	g_SBoxObjects[ key ] = g_SBoxObjects[ key ] or {}
	g_SBoxObjects[ key ][ str ] = g_SBoxObjects[ key ][ str ] or {}
	
	local tab = g_SBoxObjects[ key ][ str ]
	
	table.insert( tab, ent )

end

function meta:LimitHit( str )

	self:SendLua( "GAMEMODE:LimitHit( '".. str .."' )" )

end

function meta:AddCleanup( type, ent )

	cleanup.Add( self, type, ent )
	
end

if (SERVER) then

	function meta:SendHint( str, delay )

		self:GetTable().Hints = self:GetTable().Hints or {}
		if (self:GetTable().Hints[ str ]) then return end
		
		self:SendLua( "GAMEMODE:AddHint( '"..str.."', "..delay.." )" )
		self:GetTable().Hints[ str ] = true

	end
	
	function meta:SuppressHint( str )

		self:GetTable().Hints = self:GetTable().Hints or {}
		if (self:GetTable().Hints[ str ]) then return end
		
		self:SendLua( "GAMEMODE:SuppressHint( '"..str.."' )" )
		self:GetTable().Hints[ str ] = true

	end

end
