hasPermission
Last updated
Last updated
Description
Checks if a player has a specific ACE permission on the server.
This function uses FiveM's built-in IsPlayerAceAllowed
to determine whether the player with the given source has access to the specified permission node.
Parameters
source
(number): The server-side source ID of the player.
permission
(string): The ACE permission string to check (e.g., "command.somecommand"
).
Return Value
Returns true
if the player has the permission.
Returns nil
or does not return anything if the player does not have the permission (so itโs best to use it in an if ps.hasPermission(...) then ... end
context).
Example Use Case
if ps.hasPermission(source, "commands") then
print("Player has permission to run admin commands.")
else
print("Access denied.")
end