From caf4c99faf66b99ca4e04199f5fd42721a16837a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 01:06:59 +0000 Subject: [PATCH 1/2] Initial plan From 498bca2294fc694df2b05df935b5bf3d1e63abad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Apr 2026 01:09:36 +0000 Subject: [PATCH 2/2] feat: add qbx_police event logging integration Agent-Logs-Url: https://github.com/fivemanage/sdk/sessions/6aab40c2-12dd-4489-a75c-41c53173e1a5 Co-authored-by: itschip <59088889+itschip@users.noreply.github.com> --- config.json | 4 + config.schema.json | 20 ++- features/logs/server/logger.ts | 1 + .../logs/server/third-party/qbx-police.ts | 127 ++++++++++++++++++ features/utils/common/config.ts | 1 + 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 features/logs/server/third-party/qbx-police.ts diff --git a/config.json b/config.json index dff7961..82da5a8 100644 --- a/config.json +++ b/config.json @@ -27,6 +27,10 @@ "oxInventoryEvents": { "enabled": true, "dataset": "default" + }, + "qbxPoliceEvents": { + "enabled": false, + "dataset": "default" } } } \ No newline at end of file diff --git a/config.schema.json b/config.schema.json index 654eedb..63dc202 100644 --- a/config.schema.json +++ b/config.schema.json @@ -132,6 +132,23 @@ } }, "default": { "enabled": false, "dataset": "default" } + }, + "qbxPoliceEvents": { + "description": "qbx_police job events configuration.", + "type": "object", + "properties": { + "enabled": { + "description": "Enable qbx_police events to be logged.", + "type": "boolean", + "default": false + }, + "dataset": { + "description": "Dataset to use for qbx_police events.", + "type": "string", + "default": "default" + } + }, + "default": { "enabled": false, "dataset": "default" } } }, "required": [ @@ -144,7 +161,8 @@ "playerEvents", "chatEvents", "txAdminEvents", - "oxInventoryEvents" + "oxInventoryEvents", + "qbxPoliceEvents" ] } }, diff --git a/features/logs/server/logger.ts b/features/logs/server/logger.ts index e8fa588..5e8aac9 100644 --- a/features/logs/server/logger.ts +++ b/features/logs/server/logger.ts @@ -20,6 +20,7 @@ import './chat'; import './txadmin' import './baseevents' import './third-party/ox-inventory' +import './third-party/qbx-police' const levels = config.logs.levels.reduce>( (acc, curr, idx) => { diff --git a/features/logs/server/third-party/qbx-police.ts b/features/logs/server/third-party/qbx-police.ts new file mode 100644 index 0000000..a1db237 --- /dev/null +++ b/features/logs/server/third-party/qbx-police.ts @@ -0,0 +1,127 @@ +import { config } from "~/utils/common/config"; +import { ingest } from "../logger"; + +if (config.logs.qbxPoliceEvents.enabled) { + const dataset = config.logs.qbxPoliceEvents.dataset; + + onNet("police:server:SetHandcuffStatus", (isHandcuffed: boolean) => { + const playerSource = global.source; + + ingest(dataset, "info", isHandcuffed ? "qbx_police.player.handcuffed" : "qbx_police.player.unhandcuffed", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + isHandcuffed, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:JailPlayer", (targetSrc: number, time: number) => { + const playerSource = global.source; + + ingest(dataset, "info", "qbx_police.player.jailed", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + targetSource: targetSrc, + targetName: GetPlayerName(targetSrc.toString()), + jailTimeMinutes: time, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:BillPlayer", (targetSrc: number, price: number) => { + const playerSource = global.source; + + ingest(dataset, "info", "qbx_police.player.billed", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + targetSource: targetSrc, + targetName: GetPlayerName(targetSrc.toString()), + amount: price, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:SeizeCash", (targetSrc: number) => { + const playerSource = global.source; + + ingest(dataset, "info", "qbx_police.player.cashSeized", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + targetSource: targetSrc, + targetName: GetPlayerName(targetSrc.toString()), + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:Impound", (plate: string, fullImpound: boolean, price: number, body: number, engine: number, fuel: number) => { + const playerSource = global.source; + + ingest(dataset, "info", fullImpound ? "qbx_police.vehicle.impounded" : "qbx_police.vehicle.sentToDepot", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + plate, + fullImpound, + price: price ?? 0, + bodyDamage: body, + engineDamage: engine, + fuelLevel: fuel, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:Radar", (fine: number) => { + const playerSource = global.source; + + ingest(dataset, "info", "qbx_police.player.radarFined", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + fineIndex: fine, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:policeAlert", (text: string, camId: number | undefined, playerSource: number | undefined) => { + const source = global.source; + + ingest(dataset, "info", "qbx_police.alert.dispatched", { + playerSource: playerSource ?? source, + text, + camId: camId ?? null, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:FlaggedPlateTriggered", (radar: string, plate: string, street: string) => { + const source = global.source; + + ingest(dataset, "info", "qbx_police.vehicle.flaggedPlateDetected", { + playerSource: source, + playerName: GetPlayerName(source.toString()), + plate, + street, + radar, + }, { + _internal_RESOURCE: "qbx_police", + }); + }); + + onNet("police:server:SetTracker", (targetId: number) => { + const playerSource = global.source; + + ingest(dataset, "info", "qbx_police.player.trackerUpdated", { + playerSource, + playerName: GetPlayerName(playerSource.toString()), + targetSource: targetId, + targetName: GetPlayerName(targetId.toString()), + }, { + _internal_RESOURCE: "qbx_police", + }); + }); +} diff --git a/features/utils/common/config.ts b/features/utils/common/config.ts index 2f2ceaf..ca8a3c4 100644 --- a/features/utils/common/config.ts +++ b/features/utils/common/config.ts @@ -29,6 +29,7 @@ const ConfigSchema = object({ chatEvents: EventConfigSchema, txAdminEvents: EventConfigSchema, oxInventoryEvents: EventConfigSchema, + qbxPoliceEvents: EventConfigSchema, }), });