RP Console Commands Limit

Hello,
I wanted to know if there was a file to be able to configure to only allow the “rp_(command)” in console usable by superadmins?

Thank you.

Since these aren’t default console commands, go to the file where they are declared and add


if not ply:IsSuperAdmin() then return end

to the top of the convar function.

Would you happen to know where this function is declared? I’ve been trying to find them for a while.

Notepad++ or Sublime Find in files --> server directory --> *.lua filter --> search rp_

It’s unable to find the file.

By default, DarkRP restricts some rp_* commands to superadmins.
For an example, in the latest DarkRP build, rp_setmoney is restricted to superadmins in sv_money.lua:237
if ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() then

However, some commands like rp_tellall are able to be used by regular admins.
Head into darkrp/gamemode/modules/base/sh_util.lua:197 and replace self:IsAdmin() with self:IsSuperAdmin()

This is a quickfix and isn’t recommended as you’re modifiying core gamemode files.

This’ll change all the commands that require only admin to superadmin.
*Note: This only works if you have the FAdmin module disabled. Else, those permissions are managed by FAdmin itself.

*Instead of directly modifying the gamemode file, you can just drop this into /lua/autorun/server


local plyMeta = FindMetaTable("Player")

timer.Simple(0, function()
	function plyMeta:hasDarkRPPrivilege(priv)
		if FAdmin then
			return FAdmin.Access.PlayerHasPrivilege(self, priv)
		end
		return self:IsSuperAdmin()
	end
end)




Into admin_functions.lua?

No, you create a new lua file.

I created a new file for it and inputted what you said, but admins still seem to be able to use the “rp_(command)”.

Which commands are you trying? Some commands do not call hasDarkRPPrivilege before executing.

rp_(job) (name)
rp_(arrest) (name)
rp_(unarrest) (name)

Ah, rp_(job) doesn’t do the same check, which is weird.
rp_arrest and rp_unarrest, please check again for those.

To solve the job command, go into gamemodes\darkrp\gamemode\modules\base\sh_createitems.lua:401 and replace

if ply:EntIndex() ~= 0 and not ply:IsAdmin() then
with
if ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() then