ACE Permissions

Client Script

local allowedToUse = false
Citizen.CreateThread(function()
    TriggerServerEvent("cprscript.getIsAllowed")
end)

RegisterNetEvent("cprscript.returnIsAllowed")
AddEventHandler("cprscript.returnIsAllowed", function(isAllowed)
    allowedToUse = isAllowed
end)
RegisterCommand('adminrevive', function()

	if allowedToUse then
		TriggerEvent('reviveClient')
	else
		TriggerEvent('chatMessage', '', {255, 255, 255}, '^3[^1FLDOJRP^3]^0 You do not have permission to use this command.')
	end
	
end)

Server Script

RegisterServerEvent("cprscript.getIsAllowed")
AddEventHandler("cprscript.getIsAllowed", function(source)
    if IsPlayerAceAllowed(source, "cpr.adminrevive") then
        TriggerClientEvent("cprscript.returnIsAllowed", source, true)
    else
        TriggerClientEvent("cprscript.returnIsAllowed", source, false)
    end
end)

My console whenever i start the script.

Also the script runs, but i still get told i dont have perms to use it.

My perms | My group is dev

add_ace group.moderator "cpr.adminrevive" allow

add_principal group.admin group.moderator
add_principal group.dev group.admin

And i know im in the group because im using the perms to add tags to OOC chat for certain roles.

1 Like

Fixed it. In the server side. I just had to remove the source from function(source).

3 Likes

I have code in my server file and the code ace for Who can use it… But it is not working… I try also the EUP script running for only people I select

Someone a idea

1 Like

Someone?

1 Like

@Vespura Hey I tried your method on my cooldown script but it didnt work. Here is the server.lua for the pcd script, can you show me what im doing wrong and how to do it properly?

– Config
timermax = 21 – In minutes. Must be one bigger than the max timer you want (Eg if you want 20 it must be 21)

– Do not touch
cooldown = 0
ispriority = false
ishold = false

RegisterCommand(“pcd”, function()
if IsPlayerAceAllowed(playerSource, “cooldown”) then
TriggerEvent(“cooldownt”)
end, false)

RegisterCommand(“inprogress”, function()
TriggerEvent(‘isPriority’)
end, false)

RegisterCommand(“onhold”, function()
TriggerEvent(‘isOnHold’)
end, false)

RegisterNetEvent(‘isPriority’)
AddEventHandler(‘isPriority’, function()
ispriority = true
Citizen.Wait(1)
TriggerClientEvent(‘UpdatePriority’, -1, ispriority)
TriggerClientEvent(‘chatMessage’, -1, “WARNING”, {255, 0, 0}, “^1A priority call is in progress. Please do not interfere, otherwise you will be ^1kicked. ^7All calls are on ^3hold ^7until this one concludes.”)
end)

RegisterNetEvent(‘isOnHold’)
AddEventHandler(‘isOnHold’, function()
ishold = true
Citizen.Wait(1)
TriggerClientEvent(‘UpdateHold’, -1, ishold)
end)

RegisterNetEvent(“cooldownt”)
AddEventHandler(“cooldownt”, function()
if ispriority == true then
ispriority = false
TriggerClientEvent(‘UpdatePriority’, -1, ispriority)
end
Citizen.Wait(1)
if ishold == true then
ishold = false
TriggerClientEvent(‘UpdateHold’, -1, ishold)
end
Citizen.Wait(1)
if cooldown == 0 then
cooldown = 0
cooldown = cooldown + timermax
TriggerClientEvent(‘chatMessage’, -1, “WARNING”, {255, 0, 0}, “^1A priority call was just conducted. ^3All civilians must wait 20 minutes before conducting another one. ^7Failure to abide by this rule will lead to you being ^1kicked.”)
while cooldown > 0 do
cooldown = cooldown - 1
TriggerClientEvent(‘UpdateCooldown’, -1, cooldown)
Citizen.Wait(60000)
end
elseif cooldown ~= 0 then
CancelEvent()
end
end)

RegisterNetEvent(“cancelcooldown”)
AddEventHandler(“cancelcooldown”, function()
Citizen.Wait(1)
while cooldown > 0 do
cooldown = cooldown - 1
TriggerClientEvent(‘UpdateCooldown’, -1, cooldown)
Citizen.Wait(100)
end

end)

1 Like

Im having so much trouble with trying to setup ace permissions just so i can use the AOP script… even following dozens of tutorials step by step i still dont have perms to do anything like /announce /aopvote /pt on nothing… please help

add_ace Admin administrator allow

add_principal identifier.steam:11000010e6c5cd5 Admin

add_ace Fax.AOP faxes.aopcmds allow

add_principal identifier.steam:11000010e6c5cd5 Fax.AOP

those are my ace perms that i have rn ( my steam identifier is my hex)

1 Like

you’re never adding anyone to the FAX.AOP Ground / never letting the people in admin group use the fax.aop perm.

Here’s the code that works:

## Allow Admins & Fax.AOP group to use command.

add_ace group.admin Fax.AOP allow
add_ace group.admin faxes.aopcmds allow

## Add an admin to admin group.

add_principal identifier.steam:11000010d82baaa group.admin

Hope this clears it up, also if you dont want an admin group, you can use this.

add_principal identifier.steam:11000010d82baaa Fax.AOP
1 Like

I made it work a few days ago thanks.

2 Likes

Hi guys, I’m having a little problem with ace’s permissions, using cameras or animations only having that specific item in my backpack.
can anybody help me?

can someone help me , as you can i am new to this coding stuff for esx server , this ace permissions stuff is cofusing as hell , just want to know where im going wrong and why is it when i try and code is ifplayerace allowed comes back in my console error message

here are the screenshots : help please // need to know how to allow only police be able to get police cars etc not civs - Album on Imgur

if someone can help that be great thanks

Hello so I am using a garage mod with multiple different categories, for example Rangers and then in this category is the cars and there spawn codes. I also have another called Sheriff with cars and there spawn codes in there but what I want to do is attach these garages to certain roles, for example if you have Sheriff as a role on discord you can only access the Sheriff garage. Bare in mind this is all being done through the config