Ulysses Stuff > Ulysses Release Archives

UnoLimited - No spawn limits for Admins or SuperAdmins

<< < (17/23) > >>

phoenixf129:
Dedicated Server.

And i do get that messege.

ULib DOES see me AND others as the groups in Unolimited.
Yes i edited it, il post the code below.
No im not running any other mods that monitor limits. OTHER Than ULX ofc.


--- Code: ---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 = {
superadmin = -1,
admin = 3,
vip = 2,
respected = 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
--- End code ---

JamminR:
Are you as a superadmin hitting a limit?

Your admin would definitely hit normal limit.

--- Quote from: My code comment ----- Range is 0 (0 percent) to 2 (200 percent).

--- End quote ---
Try changing your admin group to 2, not 3
You can't have more than 2 times the sbox_limit, if you do, it defaults to normal (1).
Your server console should have been saying an error every time an admin tried to spawn something.

phoenixf129:
As a superadmin i was always hitting the limit, and so were my admins. It may be fixed now, i had a little tinker myself, il post back in this one if it doesnt work still ;)

Thanks for your help.

JamminR:
Uh, clarify "little tinker"
Words like that when coding often alarm me.

phoenixf129:
well its fixed now, heh, no need to get worried!

heres the code, i gave it to a friend after i looked and couldnt find anything wrong, not sure whats different but im sure you'll know.


--- Code: ---if not ULib then Msg( "\n ** UnoLimited v2+ REQUIRES ULib v2.4+ .. Aborting\n\n") return end
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 = {
superadmin = -1,
admin = -1,
vip = 2,
respected = 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

/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnRagdoll( ply, model )
   Desc: Return true if it's allowed
---------------------------------------------------------*/
local function PlayerSpawnRagdoll( ply, model )

return LimitReachedProcess( ply, "ragdolls" )

end
hook.Add("PlayerSpawnRagdoll", "UnoLimited", PlayerSpawnRagdoll)


/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnProp( ply, model )
   Desc: Return true if it's allowed
---------------------------------------------------------*/
local function PlayerSpawnProp( ply, model )

return LimitReachedProcess( ply, "props" )

end
hook.Add("PlayerSpawnProp", "UnoLimited", PlayerSpawnProp)

/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnEffect( ply, model )
   Desc: Return true if it's allowed
---------------------------------------------------------*/
local function PlayerSpawnEffect( ply, model )

return LimitReachedProcess( ply, "effects" )

end
hook.Add("PlayerSpawnEffect", "UnoLimited", PlayerSpawnEffect)

/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnVehicle( ply, model, vname, vtable )
   Desc: Return true if it's allowed
---------------------------------------------------------*/
local function PlayerSpawnVehicle( ply, model, vname, vtable )

return LimitReachedProcess( ply, "vehicles" )

end
hook.Add("PlayerSpawnVehicle", "UnoLimited", PlayerSpawnVehicle)

/*---------------------------------------------------------
   Name: gamemode:PlayerSpawnNPC( ply, npc_type )
   Desc: Return true if player is allowed to spawn the NPC
---------------------------------------------------------*/
local function PlayerSpawnNPC( ply, npc_type, equipment )

return LimitReachedProcess( ply, "npcs" )

end
hook.Add("PlayerSpawnNPC", "UnoLimited", PlayerSpawnNPC)

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 code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version