ULX unlimited props for a specific group.

hello guys, I was wondering how can I get unlimited props for a specific group like for example root_user?
Im using up to date ULIX and ulib.

thanks for your time :slight_smile:

[lua]do
local Props = 200 // Prop Limit
if GetConVarNumber(“sbox_maxprops”) <= Props then
RunConsoleCommand(“sbox_maxprops”,Props)
end
end

local PropLimit = {
{10,“superadmin”}, //Amount, Group Seperate with a comma
//{100,“Moo”},
//{200,“Cow”}, Last one doesn’t need a comma.
{5,“guest”}
}

hook.Add(“PlayerInitialSpawn”, “CheckMate”, function(ply)
for k,v in pairs(PropLimit) do
if ply:IsUserGroup(v[2]) then
ply.Count = v[1]
ply.Index = v[2]
end
end
end)

hook.Add( “PlayerSpawnProp”, “PropLimit”, function(ply)

return (ply:GetCount( "props" ) &lt; ply.Count) and (ply:IsUserGroup( ply.Index ))	

end)
[/lua]

Why not just do?

[lua]
local PropLimit = {}
PropLimit[“superadmin”] = 500
PropLimit[“admin”] = 300

hook.Add(“PlayerInitialSpawn”, “”, function(ply)
if PropLimit[ply:GetUserGroup()] then
ply.Count = PropLimit[ply:GetUserGroup()]
end
end)[/lua]

Because you fail at Lua kiddo.

[editline]11th December 2011[/editline]

I Suggest you should go learn Lua before helping people! :slight_smile:

So i simply suggested using the usergroup as an index so you dont need to loop, thus reducing processing power.

You don’t need the whole do portion at the top as that ConVar is only used in the PlayerSpawnProp hook.

[lua]
local PropLimit = {}
PropLimit[“superadmin”] = 500
PropLimit[“admin”] = 300

hook.Add(“PlayerSpawnProp”, function(client, model)
local count = client:GetCount(“props”);
local group = client:GetNetworkedString(“usergroup”);
local limit = PropLimit[group];

 if (limit) then
      return count &lt;= limit;
 end;

end);
[/lua]

Fixed for you, bud.

-snip-

[editline]11th December 2011[/editline]

[lua]local PropLimit = {}
PropLimit[“superadmin”] = 500
PropLimit[“admin”] = 300

hook.Add(“PlayerSpawnProp”, function(client, model)
local count = client:GetCount(“props”);
local group = client:GetNetworkedString(“usergroup”);
local limit = PropLimit[group];

 if (limit) then
      return count &lt;= limit;
 end;

end); [/lua]

Firstly that’s wrong and Science code is wrong.

[editline]11th December 2011[/editline]

Please stop helping people unless you know lua trolling and failing.

So how is it wrong? Looks good to me.

Also, I’d say you’re trolling to if you did this:

http://www.facepunch.com/threads/1121082?p=32072500&highlight=#post32072500

actually his method is more efficient, dumbass. I suggest you learn Lua and go back to asking how to use datastream.

My system is not 100% done cause it was just a snippet I was changing.

As LauScript said, it’s more efficient to do it using the group as an index.
Learn to take some help rather than thinking that every single person is trying to destroy you.

ok thanks for all your contribution :slight_smile: I appricate it :3

[editline]12th December 2011[/editline]

which file are you guys actually talking about :P?

Edit the script to something like

[lua]UNL.groups = {
root_user = -1,
}[/lua]

Not sure if they updated UnoLimit, it works for props but might need some tweeks for sweps/sents since a few updates back it broke.

Use URS:

With it you can set limits for each user group. You can also change loadouts for each group, restrict sweps, sents, vehicles, etc. Everything can be changed in-game using the ULX menu and is saved automatically, so you don’t have to worry about losing your changes over server restarts.

I’m using it on my server and all I can say is that it’s awesome :slight_smile:

Thanks everyone for your contribution :slight_smile: