Author Topic: UnoLimited - No spawn limits for Admins or SuperAdmins  (Read 96569 times)

0 Members and 3 Guests are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #75 on: April 02, 2010, 03:35:25 PM »
Are you running Sandbox gamemode?
What other prop limiting mods?
What errors on server and or client when someone attempts to spawn something?
What version of ULX?
What version of UnoLimited (one is for SVN only, one isn't)

I/We/Anyone can't help you with the little detail you give.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline dpoolas

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #76 on: April 02, 2010, 06:35:08 PM »
no im running a darkrp server
The other prop protection i have is falcos prop protection and i have an allowed list on the server
there is no error nothing happens
The latest version
unolimited version 2

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #77 on: April 02, 2010, 10:14:57 PM »
Several users of DarkRP state this conflicts with it.
DarkRP apparently uses some of the same functionality UNoLimited uses for it's banned props list.
Since UNoLimited is meant for Sandbox, you may wish to ask the author(s) of DarkRP to write in more limit functionality.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline phoenixf129

  • Newbie
  • *
  • Posts: 11
  • Karma: 1
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #78 on: April 04, 2010, 07:34:09 AM »
im running UNoLimited v2.1 and i cant get it to work.

There is NO error supplied since i cannot find one, or simply, there isnt one.

[ULIB] Loading SHARED module: UnoLimited.lua
[ULIB]*** UnoLimited v2.1 Ready! *******

Im running sandbox, and i test it by going to the proplimit, and not being able to go over it.

Can i get some help? :S

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #79 on: April 04, 2010, 10:59:18 AM »
How are you testing? Listen or Dedicated server?
(Garry's mod doesn't limit any sbox_<item> in singleplayer)

The indication you post that it's loading is from a client side (which is where actual Gmod limit checks occur).
Though you won't get a "Ready" message after, does it load on the server according to the "[ULIB] Loading SHARED module: UnoLimited.lua" message?

Does ULib see you as one of the groups in UNoLimited?
Did you edit the file's group settings?
Are you running any other mod that monitors limits? (many anti-spam scripts use a similiar method used in this)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline phoenixf129

  • Newbie
  • *
  • Posts: 11
  • Karma: 1
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #80 on: April 05, 2010, 07:51:08 AM »
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: [Select]
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

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #81 on: April 05, 2010, 10:49:39 AM »
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).
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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline phoenixf129

  • Newbie
  • *
  • Posts: 11
  • Karma: 1
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #82 on: April 06, 2010, 04:36:52 AM »
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.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #83 on: April 06, 2010, 11:55:17 AM »
Uh, clarify "little tinker"
Words like that when coding often alarm me.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline phoenixf129

  • Newbie
  • *
  • Posts: 11
  • Karma: 1
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #84 on: April 07, 2010, 05:29:50 AM »
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: [Select]
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

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #85 on: April 07, 2010, 03:54:29 PM »
Hmm. I see big differences, but, I'm not sure how well it plays with others (other mods that would use gamemode call)
Also, I'm not sure how it's working at all, since he's using the same uniqueid name for every hook.
I'm not questioning too much if it works for you...and it gives me some ideas
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #86 on: April 07, 2010, 09:09:01 PM »
Upon further review... the method your friend used will break many other functions anytime a limit is reached/false is returned.
(and actually, even true being returned will break others)
I understand the logic, but using hooks breaks other scripts, including but not limited ULX logging, prop protect, many others.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline blindbox

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #87 on: May 28, 2010, 03:57:55 PM »
What would a fix be then? I have the same problem with phoenixf129, prop limits are not being obeyed. -1 to groups doesn't do a thing (not sure about other values). Oh, I'm on dedicated server as well.
« Last Edit: May 28, 2010, 03:59:32 PM by blindbox »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #88 on: May 28, 2010, 04:50:15 PM »
When did this start for you?
You post in other threads, all of which people have posted in problems that I feel are related to Garry's latest update.
If you are using any other mod which overrides the Garry's mod functions for prop count like we do, and they return something before this script does, it will break. This includes Urestrict, which uses very similar code. (Which, Jay asked if he could include in Urestrict..made sense...restrictions)
Garry made changes to the way lua files are downloaded that are either 1) broken or 2) none of us have learned to use yet.
Since datastream is also problematic, and ULib relies on datastream, and the SVN version of my code relies on ULib SVN, it may be some time before it's fixed...we have to wait on Garry.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline blindbox

  • Newbie
  • *
  • Posts: 8
  • Karma: 1
Re: UnoLimited - No spawn limits for Admins or SuperAdmins
« Reply #89 on: May 29, 2010, 12:14:26 AM »
I can't say exactly. I had exams and I haven't touched my garry's mod server for 2 months. So I simply started hosting again, update svns, servers and just start playing. I'll try disabling URestrict. However, UPS starts working again, which I am just about to update my post in that thread over there. Thanks for the input.