• Block Spawning entities
    8 replies, posted
Is there any way to block spawning entities for a certain ULX group all of the Trial mods can spawn in entities
Couldn't you just do [lua]hook.Add( "PlayerSpawnSENT", "blockULXSpawn", function( ply, class ) if not ply:IsUserGroup("usergrouphere") then return false end end)[/lua]
Sorry I know nothing about this stuff where would I put this?
lua/autorun/server
hook.Add( "PlayerSpawnSENT", "blockULXSpawn", function( ply, class ) if not ply:IsUserGroup("trial-moderator","moderator") then return false end end) I did this but it just banned entities for every ULX group including Admin and Super Admin
Simply syntax error remove the not and it should work properly. As it stands right now that code says if the person is not trial moderator or moderator then don't let them spawn entities.
[QUOTE=boxvader;50345623]Simply syntax error remove the not and it should work properly. As it stands right now that code says if the person is not trial moderator or moderator then don't let them spawn entities.[/QUOTE] Actually, he just did trial-moderator. IsUserGroup takes one arg.
[QUOTE=code_gs;50345782]Actually, he just did trial-moderator. IsUserGroup takes one arg.[/QUOTE] Would you look at that I didn't realize that. OP you need to change the line to this [CODE]if ply:IsUserGroup("trial-moderator") or ply:IsUserGroup("moderator") then [/CODE] Although this code is still going to allow user, and regular admins to spawn in entities. Alternatively you could replace to code like this. [CODE]if not ply:IsUserGroup("superadmin") then[/CODE] This will prevent anyone besides super admins from spawning in entities. I suggest using this method so that you only have to whitelist 1 or 2 ranks compared to blacklisting a bunch.
Yeah, I wrote the code on my phone. Sorry about the syntax error. If you only wanted Superadmin to have access to spawning SENTs then change the code to. [lua]hook.Add( "PlayerSpawnSENT", "blockULXSpawn", function( ply, class ) if not ply:IsSuperAdmin() then return false end end)[/lua] If you wanted multiple groups, you could just use a table and pull from the table.
Sorry, you need to Log In to post a reply to this thread.