Multi-Department Access
This system applies robust grade and department checks across the script, allowing fine-grained control over which officers can access which vehicles, armouries, zones, or tablet functionalities.
How It Works
- Multiple Job Selections: Admins can configure objects and services (such as the Vehicle Shop, Armoury, and Garages) to support multiple allowed jobs (e.g.
police,sheriff,state_patrol) simultaneously. - Flexible Grade Checking: Rather than just checking if an officer is a minimum rank, the script can check for specific allowed grades or check against department-specific grade levels.
- Safe DB Migrations: Supported jobs and grades are serialized as JSON arrays inside the SQL database (
police_vehshop_vehiclesandpolice_armoury_catalogs).
Utility Functions
Developers can utilize the following utility helpers in server/util.lua to write custom scripts:
JobMeets(source, allowedJobs): Returnstrueif the player has one of the specified allowed jobs.GradeMeets(source, jobName, allowedGrades): Returnstrueif the player's job grade is allowed or meets the grade threshold.
How to Configure In-Game
- Open the Admin Tablet with
/policeadmin. - Go to the World Builder or Vehicle Shop / Armoury settings.
- Select multiple departments from the dropdown (e.g.
police,sheriff) that should have access. - Set the specific rank grade level (e.g.
Officer,Sergeant,Lieutenant) or minimum grade integer to lock down purchase rights. - Save the configuration. It updates in real-time across the server without requiring a resource restart.