JCKSDocs
JCKS JobsV2Primeiros passos

Existing scripts

The [jcks_compat] resources that answer ps-dispatch, cd_dispatch, esx_billing and okokBilling calls, so robbery, heist, shop and job scripts send their alerts and bills to JCKS Jobs without edits.

Robbery, heist, shop and job scripts usually send police alerts and bills through ps-dispatch, cd_dispatch, esx_billing or okokBilling. The [jcks_compat] folder has one small resource per system. It answers the exports and events of the original, so the calls land in the JCKS Jobs dispatch and invoices and the scripts need no edit.

The [jcks_compat] resources are not part of the JCKS Jobs 2.0.0 download yet, they come with a later update. Until then, the systems listed under Built into JCKS Jobs work without them, esx_billing and okokBilling included.

Your scripts use Install Replaces
exports['ps-dispatch']:CustomAlert, StoreRobbery, CarJacking and the other presets, ps-dispatch:server:notify jcks_compat_psdispatch ps-dispatch
TriggerServerEvent('cd_dispatch:AddNotification', ...), exports['cd_dispatch']:GetPlayerInfo() jcks_compat_cddispatch cd_dispatch
esx_billing:sendBill, exports['esx_billing']:BillPlayer, okokBilling:CreateCustomInvoice, exports['okokBilling']:CreateInvoice jcks_compat_billing esx_billing, okokBilling

Installation

  1. Remove the original resource from server.cfg. Each compat resource has provide '<original name>' in its manifest, so dependency 'ps-dispatch' and exports['ps-dispatch'] keep working. If the original still runs, the compat resource stays idle and prints a warning.
  2. Start the compat resources after JCKS Jobs. Each one depends on jcks_bridge and jcks_jobs.
cfg
ensure jcks_lib
ensure jcks_bridge
ensure jcks_jobs

ensure jcks_compat_psdispatch
ensure jcks_compat_cddispatch
ensure jcks_compat_billing

Start only the ones you need. With jcks_compat_billing running, set Config.BillingCompat.esxBilling and Config.BillingCompat.okokBilling in JCKS Jobs to false, so a bill is not created twice.

  1. Check settings/config.lua of each one: which alert becomes which JCKS radio code, title, kind and priority, on and off switches, rate limits. Every compat resource also has a README with the full list of covered exports and events.

What the server checks

  • Alerts from a player's game carry only the alert name. The position comes from the player's ped on the server, coordinates from the script are used only within MaxOffset metres of it, plates are read from the vehicle entity. Every player has a rate limit, officer and EMS alerts need that job category on duty, the same alert near an open call is merged.
  • cd_dispatch alerts broadcast by a server script (TriggerClientEvent(..., -1, ...)) reach every player first. The call is created once, when enough different players passed the same alert back (Relay.quorum).
  • Bills from a player's game follow the rules of the JCKS invoice window through exports.jcks_jobs:BillFromPlayer: billing permission, duty, distance, amount up to Config.Billing.maxAmount, and a society_<job> account must be the sender's own job.
  • Bills from server scripts are trusted like CreateInvoice, but the job must exist in JCKS Jobs and the amount limit applies.
  • Texts are cut to the JCKS limits.

jcks_compat_psdispatch

ps-dispatch API Side Result
exports['ps-dispatch']:CustomAlert(data) client Dispatch call. message is the title, information the text. code, priority, jobs, radius, sprite, plate, model, firstColor, weapon, name, callsign, number are used. codeName or dispatchCode picks an entry of Config.Alerts when one exists
StoreRobbery, FleecaBankRobbery, PaletoBankRobbery, PacificBankRobbery, VangelicoRobbery (camId) client Robbery call, the camera id is a line on the card
VehicleTheft, CarJacking, CarBoosting, VehicleShooting, SpeedingVehicle (vehicle) client Call with model and colour, the plate is read on the server. Without vehicle the player's current vehicle is used
Shooting, Hunting, Fight, Explosion, SuspiciousActivity, DrugSale, HouseRobbery, SignRobbery, UnionRobbery, HumaneRobbery, ArtGalleryRobbery, TrainRobbery, VanRobbery, UndergroundRobbery, BobcatSecurityHeist, YachtHeist, DrugBoatRobbery, PrisonBreak, InjuriedPerson, DeceasedPerson client Call with the code and title from Config.Alerts
OfficerDown, OfficerInDistress, OfficerBackup, PlateBackup, EmsDown client Police or EMS on duty only. Officer down, distress and EMS down are pinned red cards for police and EMS
ps-dispatch:client:officerdown, :officerbackup, :platebackup, :emsdown client event Same as the exports
ps-dispatch:client:sendEmergencyMsg (message, '911' or '311', anonymous) client event 911 call for police, 311 call for EMS, with the caller name unless anonymous
TriggerServerEvent('ps-dispatch:server:notify', data) client to server Same as CustomAlert
TriggerEvent('ps-dispatch:server:notify', data) server Dispatch call at data.coords
exports['ps-dispatch']:SendTargetedAlert(targets, data), ps-dispatch:server:targetAlert server Pulse card for those players only. Accepted only from server scripts
exports['ps-dispatch']:GetDispatchCalls() server Open JCKS calls in the GetDispatchCalls format

Not covered: the ps-dispatch UI events (attach, detach, clear, notes), its automatic crime detection and its /911 commands. JCKS Jobs has its own crime alerts (Config.Alerts) and /911, /ems.

Key Type Default What it changes
Enabled boolean true false = every call is answered but nothing reaches dispatch
Debug boolean false Prints every accepted and refused alert
Locale string 'en' Language of the words the resource adds itself (gender, vehicle colour, camera, anonymous): en, cs or sk
MaxOffset number 150.0 Metres. Client coordinates farther from the ped are replaced by the ped position
RateLimit.count, RateLimit.window number 6, 30 Alerts per player in that many seconds
Cooldown number 10 Seconds before the same player sends the same alert again, 0 = off
Merge.radius, Merge.seconds number 60.0, 45 The same alert within this distance and time of an open one is dropped, seconds = 0 = no merging
Priority table [0] = 3, [1] = 3, [2] = 2, [3] = 1 ps-dispatch priority to JCKS priority for alerts not in Alerts
Kinds table leo, police, sheriff to police, ems, ambulance to ems, fire to fire ps-dispatch job names to JCKS kinds. Other names use their JCKS job category
Restricted table officer alerts leo, emsdown ems Alerts only that job category may send on duty
Caller string 'Witness' Caller when the alert has none
Custom.enabled boolean true false = unknown CustomAlert and notify calls are dropped
Custom.code, Custom.title string '10-80', 'Alert' Code and title when the script sends none
Alerts table every ps-dispatch alert by codeName enabled, code, title, kind, jobs, priority, panic, radius per alert
lua
storerobbery = { enabled = true, code = '10-90', title = 'Store robbery', priority = 2 },
officerdown = { enabled = true, code = '10-13', title = 'Officer is down', jobs = { 'ems', 'leo' }, priority = 3, panic = true },
civdown = { enabled = true, code = '10-69', title = 'Person is injured', kind = 'ems', priority = 3 },

jcks_compat_cddispatch

cd_dispatch API Side Result
exports['cd_dispatch']:GetPlayerInfo() client The same fields as cd_dispatch: ped, coords, street_1, street_2, street, sex, unique_id, and in a vehicle vehicle, vehicle_label, vehicle_colour, vehicle_plate, heading, speed
TriggerServerEvent('cd_dispatch:AddNotification', data) client to server Dispatch call at the player's position
TriggerClientEvent('cd_dispatch:AddNotification', -1, data) server to every client Dispatch call at data.coords, created once by the relay quorum
TriggerEvent('cd_dispatch:PanicButtonEvent') client Presses the JCKS panic button
Field of data Used as
job_table Who gets the call. { 'police' } is a police call, { 'ambulance' } an EMS call, see Kinds
title '10-15 - Store Robbery' becomes code 10-15 and title Store Robbery. Without a code, DefaultCode
message Text of the call
flash 1 = critical call (FlashPriority, FlashIsPanic)
blip.sprite, blip.radius Blip sprite and search circle
coords From a client used only within MaxOffset of the player's ped

Not covered: GetPlayerNotifications, GetPlayersDispatchData, GetConfig and cd_dispatch:GetRadioChannel. Their data has no equivalent in JCKS Jobs.

Key Type Default What it changes
Enabled boolean true false = every call is answered but nothing reaches dispatch
Debug boolean false Prints every accepted and refused alert
Locale string 'en' Language of the words the resource adds itself (fallback title, gender, vehicle colour, direction): en, cs or sk
MaxOffset number 150.0 Metres. data.coords farther from the ped is replaced by the ped position
RateLimit.count, RateLimit.window number 6, 30 Alerts per player in that many seconds
Relay.enabled boolean true false = alerts broadcast by server scripts are ignored
Relay.quorum number 2 Different players that must pass the same alert back, 1 to 10. With fewer players online, every online player
Relay.window number 5 Seconds to collect them
Kinds table police, sheriff, leo to police, ambulance, ems to ems, fire to fire job_table names to JCKS kinds. Other names use their JCKS job category
DefaultCode string '10-80' Code when the title has none
Priority number 2 Priority of a normal alert
FlashPriority number 3 Priority of an alert with flash = 1
FlashIsPanic boolean false true = flash = 1 alerts from server scripts and on duty emergency players are pinned red cards. Relayed alerts never are
Caller string 'Witness' Caller on the card

A cheater who fires the client event on his own game alone cannot create a call while two or more players are online.

jcks_compat_billing

API Side Result
TriggerServerEvent('esx_billing:sendBill', target, 'society_<job>', label, amount) client to server JCKS invoice of <job> with every invoice window rule
exports['esx_billing']:BillPlayer(target, senderIdentifier, 'society_<job>', label, amount) server JCKS invoice for an online player. Returns the invoice id or false
exports['esx_billing']:BillPlayerByIdentifier(targetIdentifier, senderIdentifier, 'society_<job>', label, amount) server Same, the target can be offline
TriggerEvent('esx_billing:sendBillToIdentifier', targetIdentifier, 'society_<job>', label, amount) server Same, without a sender. Ignored when a client triggers it
TriggerServerEvent('okokBilling:CreateCustomInvoice', target, price, reason, invoiceSource, society, societyName) client to server okokBilling V2. JCKS invoice of society, the reason is reason (invoiceSource)
exports['okokBilling']:CreateInvoice(receiver, amount, reason, author) server okokBilling V3. author is a job ('police') or the server id of the sender, then the sender's current JCKS job
TriggerEvent('okokBilling:ToggleMyInvoices') client Opens the JCKS invoices (F7)
TriggerEvent('okokBilling:ToggleCreateInvoice') client Opens the JCKS invoice for the closest player

JCKS invoices always belong to a company. A bill without society_<job> (an esx_billing personal bill) becomes an invoice of the sender's current job with PersonalBills = 'job'.

Not covered: the esx_billing F7 menu and its callbacks (esx_billing:getBills, esx_billing:payBill), the esx_billing:paidBill event, okokBilling getInvoices and payReference, and qb-phone invoices. qb-phone has no event or export that creates an invoice, scripts write into its phone_invoices table directly.

Key Type Default What it changes
Enabled boolean true false = every bill is dropped
Debug boolean false Prints every accepted and refused bill
EsxBilling boolean true Answer the esx_billing events and exports
OkokBilling boolean true Answer the okokBilling events and exports
PersonalBills string 'job' Bills without a society: job = invoice of the sender's current job, refuse = dropped
SelfInvoices boolean true okokBilling:CreateCustomInvoice to the player himself (radar and fine scripts) is allowed for any JCKS job named in society, without the billing permission
SenderMustHoldJob boolean true Server exports with an online sender: the sender must hold the job of the society_<job> account
RateLimit.count, RateLimit.window number 3, 10 Bills per player from his game in that many seconds
CreateInvoiceDistance number 3.0 Metres for okokBilling:ToggleCreateInvoice to find the closest player

Built into JCKS Jobs

JCKS Jobs itself answers some other systems while the original is not there. Nothing from [jcks_compat] is needed for them.

Systems Switch When it answers
qs-dispatch, rcore_dispatch, tk_dispatch, core_dispatch, lb-tablet, wasabi_mdt, piotreq_gpt, linden_outlawalert Config.Compat.dispatch (default true) The resource is not installed. Alerts from players are limited to 3 per 30 seconds and placed at the player when the given position is more than 150 m away
esx_billing (sendBill, BillPlayer, BillPlayerByIdentifier, sendBillToIdentifier, on ESX getBills, getTargetBills, payBill and the esx_billing:paidBill event) Config.BillingCompat.esxBilling (default true) esx_billing is not started
okokBilling (CreateInvoice, okokBilling:CreateCustomInvoice) Config.BillingCompat.okokBilling (default true) okokBilling is not started

Both switches are in settings/config.lua. ps-dispatch and cd_dispatch are covered only by their [jcks_compat] resources.

Limits

  • The original and the compat resource cannot run together, the compat resource stays idle while the original runs.
  • ps-dispatch targeted alerts become Pulse cards, JCKS has no private dispatch calls.
  • Data of cd_dispatch and ps-dispatch that has no JCKS equivalent (radio channel, notification lists, UI events) is not answered.
  • Paying, listing and declining go through the JCKS invoices window, the billing menus and callbacks of esx_billing and okokBilling are not covered.