ACE Permissions

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)
17 Likes