if not ULib then Msg( "\n ** UnoLimited v2+ REQUIRES ULib v2.4+ .. Aborting\n\n") return else
Msg( "[ULIB]*** UnoLimited v2.1 Ready! *******\n")
local UNL = { }
-- ---------------------------------------------------------
--   Name: UnoLimited
--   Author: Garry 98.50% - Megiddo .75% - JamminR .75% - A "Team Ulysses idea
--   Desc: Allows defined groups to spawn past the sbox_max limits.
--   v1 release to Ulysses - v1.1 - Fixed sents (evil garry)
--	 v2 Added group control - ULib 2.4+ required
-- ---------------------------------------------------------
-- The numbers are a percentage and will be multiplied to the actual sbox limit.
-- Range is 0 (0 percent) to 2 (200 percent). Setting a group to 0 will limit that group to nothing.
-- Example - Server has "sbox_maxprops 400" limit. .5 percent of that is 200 props. 
-- Any group = .5 will have a 200 prop limit. However, 1.5 would give them 600
-- NOTE!!! - Any decimals will be rounded DOWN to nearest whole number. 
-- If you allow sbox 1 of something...any multiplier below 1 will set that groups limit to 0. Any not 2 will be 1.
-- All groups not specified get 'standard' limit set in your server.cfg.
-- Any group set to -1 becomes unlimited
-- ==================
-- Edit the following table. Add groups as necessary. Add comma at end of previous line if additional added.

UNL.groups = {
		owner = -1,
		co-owner = -1,
		superadmin = 0,
		admin = 2,
		moderator = 1.75,
		officer = 1.5,
		donator = 1.5
			}


-- ------- Please ask for Team Ulysses assistance editing below this line ----------------

local function GetUnoLimit ( ply, str )
	local gmulti = UNL.groups[ ply:GetUserGroup() ]
	local a

	if gmulti then
		if gmulti == -1 then return gmulti end
		if ( gmulti < 0 || gmulti > 2 ) then 
		ULib.error( string.format( "* UNoLimited - Group %q multiplier %q out of range(0 to 2)...setting to 1", ply:GetUserGroup(), gmulti ) )
		gmulti = 1
		end
		a = math.floor( ( gmulti * server_settings.Int( "sbox_max"..str, 0 ) ) )
	else
		a = server_settings.Int( "sbox_max"..str, 0 )
	end
	return a
end


local function LimitReachedProcess( ply, str )

	-- Always allow in single player
	if (SinglePlayer()) then return true end
		
	local c = GetUnoLimit ( ply, str )
	
	-- Always allow if multiplier is -1
	if c == -1 then return true end

	if ( ply:GetCount( str ) < c || c < 0 ) then return true end

	ply:LimitHit( str )
	return false

end

local function init()
/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnRagdoll( ply, model )
   Desc: Return true if it's allowed 
---------------------------------------------------------*/
function GAMEMODE:PlayerSpawnRagdoll( ply, model )

	return LimitReachedProcess( ply, "ragdolls" )
	
end


/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnProp( ply, model )
   Desc: Return true if it's allowed 
---------------------------------------------------------*/
function GAMEMODE:PlayerSpawnProp( ply, model )

	return LimitReachedProcess( ply, "props" )

end


/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnEffect( ply, model )
   Desc: Return true if it's allowed 
---------------------------------------------------------*/
function GAMEMODE:PlayerSpawnEffect( ply, model )

	return LimitReachedProcess( ply, "effects" )

end

/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnVehicle( ply, model, vname, vtable )
   Desc: Return true if it's allowed 
---------------------------------------------------------*/
function GAMEMODE:PlayerSpawnVehicle( ply, model, vname, vtable )

	return LimitReachedProcess( ply, "vehicles" )
	
end

/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnNPC( ply, npc_type )
   Desc: Return true if player is allowed to spawn the NPC
---------------------------------------------------------*/
function GAMEMODE:PlayerSpawnNPC( ply, npc_type, equipment )

	return LimitReachedProcess( ply, "npcs" )	
	
end

local meta = FindMetaTable( "Player" )
// Return if there's nothing to add on to
if (!meta) then return end

function meta:CheckLimit( str )

	// No limits in single player
	if (SinglePlayer()) then return true end
	
	local c = GetUnoLimit ( self, str )
	

	if ( c < 0 ) then return true end
	if ( self:GetCount( str ) > c-1 ) then self:LimitHit( str ) return false end

	return true

end

end

hook.Add( "Initialize", "LimitInitilize", init )

end