[Help] Restrict command for SteamId and IP only

I was wondering how I could restrict a command so that only a certain set of people could use it that are listed at the top of the script. I’ve seen this on another script but don’t exactly understand it. Thank you!

local allowed_ids = { 'steam:110000112345678' }

RegisterCommand('private_hi', function(source, args)
    print('hey there ' .. tostring(args[1]))
end, true) -- the true is 'restricted'

for _, id in ipairs(allowed_ids) do
    ExecuteCommand(('add_ace identifier.%s command.private_hi allow'):format(id)) -- this doesn't have a native yet
end

and in your server.cfg

add_ace resource.yourresourcename command.add_ace allow
1 Like

Hmm, could you possibly explain how each things works? Thank you for the help :slight_smile:

This no longer seems to work. Can someone please update? This would be most useful.