• [DarkRP] Make it so only Superadmins & up can spawn entities
    13 replies, posted
How can I make it so only superadmins and up can spawn entities from the Q menu? Right now admins can spawn them and I don't want them to be able to.
Think it's this one: [url]http://wiki.garrysmod.com/page/SANDBOX/PlayerSpawnedSENT[/url] Place it in an server init. [lua] function GM:PlayerSpawned (ply, ent ) if ( not ply:IsSuperAdmin() ) then return false end end [/lua]
I am NO expert and I haven't even played DarkRP and I just made this up, but, it should work for your needs. Stops anyone who isn't a superadmin from spawning things. [CODE]function SpawnProp( ply, model, ent ) if(!ply:IsSuperAdmin) then return false else return true end end hook.Add("PlayerSpawnedProp","DarkRPStopSpawn",SpawnProp)[/CODE]
No it does not. Because it's ply:IsSuperAdmin() and not ply:IsSuperAdmin
[QUOTE=monkstick;41576360]I am NO expert and I haven't even played DarkRP and I just made this up, but, it should work for your needs. Stops anyone who isn't a superadmin from spawning things. [CODE]function SpawnProp( ply, model, ent ) if(!ply:IsSuperAdmin) then return false else return true end end hook.Add("PlayerSpawnedProp","DarkRPStopSpawn",SpawnProp)[/CODE][/QUOTE] This is to disable prop spawning, OP wants to disable entity spawning (EG Bouncing balls)
Haha, cant believe I forgot the brackets. :suicide: edit: are all the entites class type sent? [editline]24th July 2013[/editline] [QUOTE]function DarkRPAntiSent(ply,ent) if(!ply:IsSuperAdmin()) then ent:Remove() end end hook.Add("PlayerSpawnedSENT","DarkRPNoSENT",DarkRPAntiSent)[/QUOTE] Just tested this one, this works.
I suggest using the hook PlayerSpawnSENT, which you can simply return false to. [lua] function BlockSents( ply, sent_type ) if !(ply:IsSuperAdmin()) then return false end end hook.Add( "PlayerSpawnSENT", "DarkRPBlockSents", BlockSents ) [/lua]
[QUOTE=Persious;41600153]I suggest using the hook PlayerSpawnSENT, which you can simply return false to. [lua] function BlockSents( ply, sent_type ) if !(ply:IsSuperAdmin()) then return false end end hook.Add( "PlayerSpawnSENT", "DarkRPBlockSents", BlockSents ) [/lua][/QUOTE] In what file do you write this?
DarkRPModification has an option for it, look in the config.
I checked the configs, but I am únable to find where to write that code into: [CODE]local hooks = { "Effect", "NPC", "Prop", "Ragdoll", "SENT", "Vehicle" } for _, v in pairs (hooks) do hook.Add("PlayerSpawn"..v, "Disallow_user_"..v, function(client) if (client:IsUserGroup("admin") or client:IsUserGroup("superadmin")) then return true end return false end) end[/CODE] On my Dark RP I want to limit prop spawning and everyhting else, limited to admins and superadmins. But I am too stupid to get that working... in which specific file do I need to add this line of code? Hint: I am using ulx and more ulx on my server
[QUOTE=menewath;49994272]On my Dark RP I want to limit prop spawning and everyhting else, limited to admins and superadmins. But I am too stupid to get that working... in which specific file do I need to add this line of code? Hint: I am using ulx and more ulx on my server[/QUOTE] any serverside lua file
Well, thanks very much! That helped!
erm how did you not see this? [url]https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_config/settings.lua#L177[/url]
Well it did not work work me, so I needed that custom line of code
Sorry, you need to Log In to post a reply to this thread.