Ulysses Stuff > Ulysses Release Archives
UnoLimited - No spawn limits for Admins or SuperAdmins
Cyberuben:
This is what the code contains now, before I made this post
--- 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 = {
owner = -1,
superadmin = -1,
admin = 2,
operator = 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: sents
Desc: Return true if it's allowed
---------------------------------------------------------*/
function GAMEMODE:PlayerSpawnEffect( ply, name )
return LimitReachedProcess( ply, "sents" )
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 ---
But this doesn't seem to work.
If you might want to try what happens, add me to Steam, steam://friends/add/cyberuben (copy link and paste in browser), and then you can see what happens yourself.
JamminR:
In my previous post I gave specific code for you to add.
You've apparently edited on your own and now have function gamemode:PlayerSpawnEffect twice.
Don't add your own, add what example I gave.
JamminR:
All, please don't PM me. So far, my inbox is full of questions that will help everyone. I dare say the only reason I've ever gotten a private that should have been private was to research what the author believed to be a possible ULX exploit (it wasn't, turned out to be the game mode they were using)
A concerned citizen writes;
--- Quote from: Suna45 on July 23, 2011, 09:57:13 AM ---hi im currently working on making a server am using Exsto for admin control and so on , i was wondering if UnoLimited 1.1 would work with the current admin mod so i can set limits for superadmins and myself the owner. please pm me or send me an email with your answer. thanks in advance!
--- End quote ---
First; Our condolences that you are using another admin mod. Your choice, but still, our condolences :)
Second; UnoLimited v1 uses Garry's IsSuperadmin and IsAdmin for its group checks.
These are standard functions written for every developer to use for any mod/code.
If Exsto's owner isn't detected by either one of those functions, then no, it won't detect the owner group. As for Exsto's admin group, as long as it is a actual group name and not a team name, then yes, it will detect admin.
Glider:
This comes up when I try to use it on my server:
[ERROR] addons/unolimited_v2/lua/ulib/modules/unolimited.lua:52: attempt to call global 'SinglePlayer' (a nil value)
1. Call - addons/unolimited_v2/lua/ulib/modules/unolimited.lua:52
2. Spawn_NPC - gamemodes/sandbox/gamemode/commands.lua:406
3. unknown - gamemodes/sandbox/gamemode/commands.lua:454
4. unknown - lua/includes/modules/concommand.lua:69
JamminR:
Someone else is more than welcome to convert this to Gmod13.
I won't be in the foreseeable future.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version