Configuration

Config = {}

Config.Framework = "QBCORE"  -- ESX OR CUSTOM ...
-- These two settings are for internal use and should not be changed:
Config.CurrentCooldown = 0  
Config.CurrentType = "COOLDOWN OFF"  -- Changed from false to default string matching Config.Types key

--=========================
-- Job permissions: minimum grade required
Config.PoliceJobs = {
    ['police'] = 1,
    ['sheriff'] = 2,
}

Config.MaxCooldown = 60 -- Maximum cooldown time (in minutes) for the priority system. 
Config.command = "priority"  -- The command that triggers the priority system.
Config.DefaultText = "PRIORITY SYSTEM IS OFF"  -- Message shown when the system is disabled or inactive.

Config.Types = {
    ["COOLDOWN"] = { label = "COOLDOWN", color = "rgba(241, 203, 27, 0.7)" },
    ["ON HOLD"] = { label = "ON HOLD", color = "rgba(241, 27, 31, 0.7)" }, 
    ["IN PROGRESS"] = { label = "IN PROGRESS", color = "rgba(175, 122, 75, 0.7)" },  
    ["POLICE MEETING"] = { label = "POLICE MEETING", color = "rgba(27, 241, 241, 0.7)" }, 
    ["SAFE"] = { label = "SAFE", color = "rgba(27, 241, 128, 0.7)" }, 
    ["EMERGENCY"] = { label = "EMERGENCY", color = "rgba(255, 0, 0, 0.8)" }, 
    ["ON PATROL"] = { label = "ON PATROL", color = "rgba(0, 0, 255, 0.7)" }, 
    ["COOLDOWN OFF"] = { label = "COOLDOWN OFF", color = "rgba(255, 255, 255, 0.171)" }, 
    ["TRAINING"] = { label = "TRAINING", color = "rgba(255, 165, 0, 0.7)" }
}

Config Explanation

1. Config.Framework

Config.Framework = "QBCORE"
  • This sets the game framework you are using.

  • Common values are "QBCORE" or "ESX".

  • Some scripts behave differently depending on the framework, so you set this once.


2. Internal Tracking Variables

Config.CurrentCooldown = 0
Config.CurrentType = "COOLDOWN OFF"
  • CurrentCooldown stores how many minutes are left on the cooldown timer for the priority system.

  • CurrentType holds the current status or state of the priority system.

  • Starts as "COOLDOWN OFF" meaning no active cooldown or priority event.


3. Job Permissions

Config.PoliceJobs = {
    ['police'] = 1,
    ['sheriff'] = 2,
}
  • This table defines which jobs are allowed to use or see the priority system features.

  • The keys ('police', 'sheriff') are the job names.

  • The values (1, 2) represent the minimum grade or rank needed in that job to access it.

  • For example, a police officer with grade 1 or above can interact with the system, but a sheriff needs at least grade 2.


4. Max Cooldown Time

Config.MaxCooldown = 60
  • The maximum cooldown period for the priority system, in minutes.

  • If a priority event has a cooldown, it can last up to this value.

  • Cooldowns prevent the priority system from being spammed or reused too quickly.


5. Command Trigger

Config.command = "priority"
  • The chat command players will type to interact with the priority system.

  • Typing /priority (or !priority depending on your command prefix) will activate the system or show its status.


6. Default Text

Config.DefaultText = "PRIORITY SYSTEM IS OFF"
  • This message is displayed when the priority system is inactive or off.

  • For example, when there is no current priority event or cooldown.


7. Priority Types

Config.Types = {
    ["COOLDOWN"]        = { label = "COOLDOWN",        color = "rgba(241, 203, 27, 0.7)" },
    ["ON HOLD"]         = { label = "ON HOLD",         color = "rgba(241, 27, 31, 0.7)" },
    ["IN PROGRESS"]     = { label = "IN PROGRESS",     color = "rgba(175, 122, 75, 0.7)" },
    ["POLICE MEETING"]  = { label = "POLICE MEETING",  color = "rgba(27, 241, 241, 0.7)" },
    ["SAFE"]            = { label = "SAFE",            color = "rgba(27, 241, 128, 0.7)" },
    ["EMERGENCY"]       = { label = "EMERGENCY",       color = "rgba(255, 0, 0, 0.8)" },
    ["ON PATROL"]       = { label = "ON PATROL",       color = "rgba(0, 0, 255, 0.7)" },
    ["COOLDOWN OFF"]    = { label = "COOLDOWN OFF",    color = "rgba(255, 255, 255, 0.171)" },
    ["TRAINING"]        = { label = "TRAINING",        color = "rgba(255, 165, 0, 0.7)" }
}
  • This table defines the various states or statuses the priority system can be in.

  • Each key (e.g., "COOLDOWN", "ON HOLD") is a type of priority state.

  • For each type, there is:

    • label: The human-readable text to show.

    • color: A CSS-like RGBA color used for displaying this state in the UI/chat with transparency.

Example:

  • If the system is in "EMERGENCY" mode, it will show the label "EMERGENCY" with a red color (rgba(255, 0, 0, 0.8)).

  • If it’s "COOLDOWN OFF", it means no cooldown is active, shown with a semi-transparent white.


Summary

  • This config is for a priority status system used mainly by police jobs (or similar) on your server.

  • It tracks priority states like "EMERGENCY", "ON PATROL", "COOLDOWN", etc.

  • Players with specified jobs and grades can control or view the priority system.

  • The system has a cooldown to prevent spamming.

  • The command (by default /priority) allows users to toggle or check priority.

  • The colors help visually distinguish priority statuses in any UI or chat message.

Last updated