Different props limit for each group?

Guest, 15 props limit.
Respected, 20.
Admin, 25.
Superadmin, no limit.

Possible?

Yeah it is, but I dont know how…

Maybe sometime like:

[lua]if ply:Team() == 1 then
self.sbox_proplimits = 15
end[/lua]

I have NO idea if it will work, but try it and tell me if it works or not

I think it just sets the gamemode’s proplimit.
self. is not used to set a person’s thing…

I see so many servers allowing respected users to spawn more props.

What’s the secret?

[lua]
function PropGroups( pl, mdl )
– Yay variables –
local AdminLimit = 25 – Prop limit for admins
local RespectedLimit = 20 – Prop limit for respected
local UserLimit = 15 – Prop limit for regular users

if pl:IsSuperAdmin() then
	return true -- Unlimited prop spawning.
elseif pl:IsAdmin() then
	return pl:GetCount( "prop_physics" ) < AdminLimit
elseif pl:IsUserGroup( "respected" ) -- Make sure this is correct.
	return pl:GetCount( "prop_physics" ) < RespectedLimit
else
	return pl:GetCount( "prop_physics" ) < UserLimit
end

end
hook.Add( “PlayerSpawnProp”, “UserGroupPropLimits”, PropGroups )
[/lua]

Stick this at the bottom of the init.lua in your sandbox gamemode.


21:29:01 > for k , v in ipairs(player.GetAll()) do print(v:GetCount("props")) end...
         0
         0
         0
         1
         21
         53
21:29:08 lua_run for k , v in ipairs(player.GetAll()) do print(v:GetCount("prop_physics")) end
21:29:08 > for k , v in ipairs(player.GetAll()) do print(v:GetCount("prop_physics")) end...
         0
         0
         0
         0
         0
         0


Also,

All changes would get overwritten on server restart.

I’m confused by chieftiger and FlapJack’s responses.

Whose the right one?

I thank you both though.

His basic idea is right, just he implemented it wrong.

[lua]function PropGroups( pl, mdl )
– Yay variables –
local AdminLimit = 25 – Prop limit for admins
local RespectedLimit = 20 – Prop limit for respected
local UserLimit = 15 – Prop limit for regular users

if pl:IsSuperAdmin() then
	return true -- Unlimited prop spawning.
elseif pl:IsAdmin() then
	return pl:GetCount( "props" ) < AdminLimit
elseif pl:IsUserGroup( "respected" ) -- Make sure this is correct.
	return pl:GetCount( "props" ) < RespectedLimit
else
	return pl:GetCount( "props" ) < UserLimit
end

end
hook.Add( “PlayerSpawnProp”, “UserGroupPropLimits”, PropGroups )[/lua]

Should work.

Will these save upon restart?

I added that to the server Jack. It completley disables DarkRP. Says it can’t find cl_init.lua once I put it in, after I remove it everything’s dandy again.

Anyone would know why?

Nevermind, I figured it out. Lua tag’s wern’t added.

I wish people would stop posting replies like this. Please, only reply with code if you are quite confident it will work.

I know this post is kinda old, but I’m having trouble adding this into my server as the guy above said it breaks dark rp, he said he fixed it by adding lua tags but I haven’t the slighest idea on how to fix it, if anyone could point me in the right direction I would be greatful!

How would I add a GAMEMODE:Notify command if somebody tries to spawn a prop more than the prop limit?