Kartik Scripts

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_vehicles and police_armoury_catalogs).

Utility Functions

Developers can utilize the following utility helpers in server/util.lua to write custom scripts:

  • JobMeets(source, allowedJobs): Returns true if the player has one of the specified allowed jobs.
  • GradeMeets(source, jobName, allowedGrades): Returns true if the player's job grade is allowed or meets the grade threshold.

How to Configure In-Game

  1. Open the Admin Tablet with /policeadmin.
  2. Go to the World Builder or Vehicle Shop / Armoury settings.
  3. Select multiple departments from the dropdown (e.g. police, sheriff) that should have access.
  4. Set the specific rank grade level (e.g. Officer, Sergeant, Lieutenant) or minimum grade integer to lock down purchase rights.
  5. Save the configuration. It updates in real-time across the server without requiring a resource restart.

On this page