Basic Aces & Principals overview/guide

so for the police police.flash how do i change it to the correct thing?
and what is it to

1 Like

and also is that the only wrong thing in it?!

1 Like

It looks like it yeah. Just remove that top one completely as it does absolutely nothing. Just use the bottom one with your steam and then change it to add_ace instead. That should work.

Yea im gonna need help is there any video tutorials
because im trying to geth this to work with Yodas aop

Vespura if you can help me reach me on discord please
Xavier#2138

Nope there’s no video tutorials, you can create a topic in #development:scripts, share some code there and ask specific questions about it there.

never mind i found some help but thanks anyways

Hi there Vespura,

I’m trying to restrain a command in an ace perm for a group that exists(admin) but I’m having problems with it. I’ve added the perm check and now even someone with an admin ace perm can’t use it.

In server.cfg

add_principal identifier.steam:110000100aexxxx group.admin

and in the client.lua:

RegisterCommand("xcommand", function(source, args, rawCommand)
	if IsPlayerAceAllowed(source, "admin") then
		
		--command stuff
		
	end
end, false)

What have I done wrong?

For one, IsPlayerAceAllowed() is a server native so this wouldn’t work. Also, it looks like you’re trying to check to see if they player has admin but the admin ace isn’t being allowed anywhere. You would have to do something like:

add_ace group.admin admin allow

or so…

I have the allow in the server.cfg as well, sorry for not mentioning it:

add_ace group.admin command allow # allow all commands

The command doesn’t require anything on the server side so how do I pass the command to server and then right back to client so it can be used?

Right, but this will only allow execution of commands that are restricted, for example RegisterCommand('commandname', somefunction, true). You’re checking if the player has the ace admin, which it doesn’t apparently.

command != all aces are allowed
command = any restricted command

Also, you can’t check if a player is in a specific group. You can only check if the player has a specific ace.

so if I’m understanding this right, changing:

, false)

to:

, true)

Will make the command restricted and even though this code is on the clientside, adding a user to the group admin and having:

add_ace group.admin command allow # allow all commands

Will make this command restricted but those in the admin group will still be able to use it?

Commands on the client side can not be set to ‘restricted’. As there’s no way for the client to know if a player has permissions for it. So it must be a server sided command. Then it’ll work. You can just use a server side command, then trigger an event on the client. The ace will then automatically be checked when the command is executed (command.<command name>), so you don’t have to do it.

1 Like

Thanks very much for your and @zee 's help. With Faxes help in another thread, I managed to convert a client command to server, allowing it to be restricted.

Where Do I put add_principal identifier.steam: <steam_id_here> group.

Those statements can be dropped right into your server.cfg above anything that needs it.

Is there a way to only let certain people use esx_truckshop? with ACE Permissions?

Thanks for sharing knowledge.:sorrindo:

Alright well I don’t know if I am just special, But this is all great help for making a command having permissions.

how would I add Ace permissions to something that is written as

Citizen.CreateThread(function()
     while true do
       Wait(0)
          if IsControlPressed( 0, KEYBIND ) then
               ExampleEvent(Open.Menu.API)
          end
     end
end)

I believe I understand the permissions.cfg would be

add_ace group.example mgn-example allow
add_principal identifier.steam:000000000000000 group.example # Name

I am completely lost of how to link the server.lua to the client.lua in this sense, because it’s not written as a command, but more or less a passive action.