[DarkRP] Make it so only Superadmins & up can spawn entities

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:

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.


function SpawnProp( ply, model, ent )
if(!ply:IsSuperAdmin) then
return false
else
return true
end

end

hook.Add("PlayerSpawnedProp","DarkRPStopSpawn",SpawnProp)

No it does not. Because it’s ply:IsSuperAdmin() and not ply:IsSuperAdmin

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]

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]

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:


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

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

any serverside lua file

Well, thanks very much! That helped!

erm how did you not see this? https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_config/settings.lua#L177

Well it did not work work me, so I needed that custom line of code