Limiting Prop Possession to Specific User Groups (TTT)

Hey guys,

I had a surprisingly difficult time finding this, and I’m still not able to get it quite right.

Basically, I want only specific ranks to be able to possess props. When a non-donator rank tries to possess a prop, I want nothing to happen.

I went to propspec.lua, and added the following, under the function PROPSPEC.Key(ply, key):

if ply:IsUserGroup("regular") then
    return false

This made it so that, as a regular (and therefore not a donator), you could hit E on the prop, and it would bring you to the possession POV, but as soon as you pressed any key, it would immediately put you back to spectating.

While I understand this likely has something to do with PROPSPEC.End(ply), I don’t know what I could do to make it the way I mentioned above. I’ve seen it done before, I just have no idea how to execute it.

Thanks in advance.

At the top of the function that starts the propspec you could add

if ( not ply:IsUserGroup( "donator" ) ) then return end


Hey Invule, thanks for the reply.

After trying this, it caused a weird bug where nobody would spawn. Not sure why that would be…

Any other ideas?

EDIT: Sorry, didn’t realize I had two conflicting pieces of code. This worked perfectly for one rank, but after adding some, it stopped working.

How would I do this for multiple ranks?

Right now I have:

if ( not ply:IsUserGroup( "donator++" ) ) or ( not ply:IsUserGroup( "moderator" ) ) or ( not ply:IsUserGroup( "admin" ) ) then return end

[editline]23rd May 2015[/editline]

God damn, I figured it out. I just had to use “and” instead of “or”.

Thanks for the help, Invule!