How would I go about adding permissions to a specific resource only? Or is that possible?
Should cover everything you need.
Yeah Iāve read it many times, didnāt help the tiny brain.
You can always ask in the topic, Big chance Vespura can answer your questions.
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?
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)
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!
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?
if youāre talking about principal groups, then yes, but if youāre talking about some resource/framework specific group then no.
No, Iām talking about general groups. I refer to those who are in game āagentā and ācaptainā
Then thatās a no. You canāt do that with aces/principals permissions.
I see. So there is no way, right?
Not with aces, youāll have to seek support for whatever framework youāre using.
āFrameworksā should be adding principals for this, anyway, in an ideal case.
This does not work for me. Cant get the perms to work on client script.
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.