General > Developers Corner

How to restrict ENTITIES and WEAPONS?

<< < (5/5)

JamminR:

--- Quote ---on the planet. It is known.
--- End quote ---
Virtual Planets in your self-made gamemodes don't count!

Sam,
This Swep Hook you posted for SWEPS should work, as long as it's running on the server.

--- Code: ---function DenySWEPs(ply, class)
    if not ply:IsUserGroup("donator") then
        ply:ChatPrint("You must be a donator to use this item!")
        return false
    end
end
hook.Add("PlayerSpawnSWEP", "DenySWEPs", DenySWEPs)

--- End code ---
What do you not understand about it?
What doesn't work about it?

Samg381:
Well, I placed it in the code and it had no effect whatsoever. Not sure what the issue is.

However, I have found a workaround and I am no longer in need of a quick solution.
Although a universal Entity/Swep User restrict code would be handy, I might just forget it.

lampman13:
can you tell me your work around please?

Samg381:
Sure.
I opened the URS configuration "urs_server.lua", and made a custom code on line 8.
It pretty much makes any user who spawns a donator+ weapon get a "You need to buy donator" message,
and everyone who is already a donator get the message "This entity is restricted for your group".

Navigation

[0] Message Index

[*] Previous page

Go to full version