The Zyrix Admin API uses a built-in permission system that validates staff member access for every function call. All API functions require a valid staff ID and automatically check permissions based on your server configuration.
Every API function requires a staffId parameter as the first argument:
Copy
-- staffId is typically the player's server IDlocal staffId = source -- In server-side eventslocal success, status = exports['zyrix_admin']:BanPlayer(staffId, targetId, duration, reason)
Your Zyrix configuration defines different permission levels and what actions each level can perform:
Copy
-- The API automatically validates permissionslocal success, status = exports['zyrix_admin']:TeleportPlayer(staffId, targetId, coords)if status == 'no_permission' then print('Staff member lacks teleportation permissions')end
When permission checks fail, you’ll receive specific error responses:
Copy
local success, status = exports['zyrix_admin']:BanPlayer(staffId, targetId, 3600, "Cheating")-- Possible permission-related responses:if status == 'no_permission' then -- Staff member doesn't have ban permissionselseif status == 'invalid_staff' then -- Invalid or offline staff ID providedelseif status == 'insufficient_rank' then -- Staff rank is too low for this actionend
Always ensure the staff member is valid before making API calls:
Copy
local function isValidStaff(playerId) return exports['zyrix_admin']:IsStaffMember(playerId)endif isValidStaff(staffId) then -- Proceed with API callend
Provide meaningful feedback when permissions are insufficient:
Copy
local success, status = exports['zyrix_admin']:KickPlayer(staffId, targetId, reason)if status == 'no_permission' then TriggerClientEvent('chat:addMessage', staffId, { color = {255, 0, 0}, multiline = false, args = {"[Zyrix]", "You don't have permission to kick players"} })end
Permission configuration is managed through your Zyrix admin panel or configuration files. Refer to the Permissions Configuration guide for detailed setup instructions.
The permission system is designed to be flexible and configurable. You can customize permission levels and requirements through your Zyrix admin configuration.