Permissions
Restrict access for users
Understand the Permission System
In the settings.lua file you can find two functions, HasAccessServer and HasAccessClient, that need to return either true or false to restrict access.
- true implies that the user has access to the live tool
- false restricts the user’s access to the live tool
Please make sure that both functions check the same logic to prevent race conditions. If there is only access to the client, the user can open the menu but cannot log in or use any features. If there is only access to the server, the client cannot open the menu but will still receive notifications.
Examples
ESX Group
---@param source number
---@param license string
---@return boolean
function HasAccessServer(source, license)
local xPlayer = ESX.GetPlayerFromId(source)
if not xPlayer or xPlayer.group ~= "admin" then
return false
end
return true
end