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