• RP Console Commands Limit
    11 replies, posted
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 [code]if not ply:IsSuperAdmin() then return end[/code] 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 [I]if ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() then[/I] 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. [I]Note: This only works if you have the FAdmin module disabled. Else, those permissions are managed by FAdmin itself. [/I]Instead of directly modifying the gamemode file, you can just drop this into /lua/autorun/server [CODE]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) [/CODE]
Into admin_functions.lua?
[QUOTE=Darkblizzard;47313399]Into admin_functions.lua?[/QUOTE] 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 [I]if ply:EntIndex() ~= 0 and not ply:IsAdmin() then[/I] with [I]if ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() then[/I]
Sorry, you need to Log In to post a reply to this thread.