ACE Permissions

How would I go about adding permissions to a specific resource only? Or is that possible?

2 Likes

Should cover everything you need.

3 Likes

Yeah I’ve read it many times, didn’t help the tiny brain.

4 Likes

You can always ask in the topic, Big chance Vespura can answer your questions.

1 Like

Not really sure what you’re trying to do here?

Do you want to give your resource permissions to do something? or do you want to add “permissions”/aces to “principals” (players) so they can use something in your resource?

2 Likes

Basically add perms to a resource. Only given steam ID’s can use that resource.

what does the resource do exactly?
Is it a menu? do you use commands? do you interact with stuff in the world for it to work? Very basic example would be like this:

in server.cfg

add_ace identifier.steam:steamidhere "the.permission.name.you.want" allow

then in a server script:

if IsPlayerAceAllowed(playerSource, "the.permission.name.you.want") then
    -- do your code here
end

if you want this in a client script, use something like this at the top of your client file.

local allowedToUse = false
Citizen.CreateThread(function()
    TriggerServerEvent("<resourceName>.getIsAllowed")
end)

RegisterNetEvent("<resourceName>.returnIsAllowed")
AddEventHandler("<resourceName>.returnIsAllowed", function(isAllowed)
    allowedToUse = isAllowed
end)

-- In your resource, check "allowedToUse" whenever you want to "do" something that needs permissions, for example
if allowedToUse then
    -- do your cool code here
end

Server script:

RegisterServerEvent("<resourceName>.getIsAllowed")
AddEventHandler("<resourceName>.getIsAllowed", function(source)
    if IsPlayerAceAllowed(source, "the.permission.name.you.want") then
        TriggerClientEvent("<resourceName>.returnIsAllowed", source, true)
    else
        TriggerClientEvent("<resourceName>.returnIsAllowed", source, false)
    end
end)
14 Likes

Thank you @Vespura I was looking for the client side perm. Nailed it!

2 Likes

Sorry, I need help. I would like to limit the / eup command, only to those in game is set “agent” and “policeman”, how do I do? The guide says:

to restrict this, replace, false with, true in the RegisterCommand in eup_ui.lua and give command.eup add_ace

I changed “false” to “true”, but I did not quite understand what he meant by “give command.eup add_ace”. I need help, please, thank you!

1 Like

That’s not using ace permissions.

Add this somewhere in your server.cfg.

add_ace identifier.steam:<steam64 hex id> command.eup allow

Thanks so much! Instead of adding the steam ID hex, is there a way to add the group in the job category?

1 Like

if you’re talking about principal groups, then yes, but if you’re talking about some resource/framework specific group then no.

2 Likes

No, I’m talking about general groups. I refer to those who are in game “agent” and “captain”

1 Like

Then that’s a no. You can’t do that with aces/principals permissions.

1 Like

I see. So there is no way, right?

1 Like

Not with aces, you’ll have to seek support for whatever framework you’re using.

1 Like

Ok @Vespura, thanks for your help

1 Like

‘Frameworks’ should be adding principals for this, anyway, in an ideal case. :confused:

4 Likes

This does not work for me. Cant get the perms to work on client script.

1 Like

Permissions don’t work client side, triggering events is the only way to sync permissions between server and client side. Like explained in that post that you quoted.

1 Like