Public API · v0.4.2

Patrol data. Clean interface.

Look up detached ped and vehicle records, search collected records and prior history, read catalogs, manage BOLOs, react to paperwork and court outcomes, or build native desktop and tablet pages.

Start here

Getting started

The API is built into pdComp.dll. Reference the assembly in your project, but do not include it with your plugin.

The public API ships in pdComp.dll. Reference the already-loaded assembly with Private=false; never copy or load a second pdComp assembly into the game.

Release note: this reference covers the current public LCPDFR build, pdComp v0.4.2. Live record lookups, collected-record searches, prior-history snapshots, and citation enhancement data require v0.4.2.

Direct reference

Players need only the main pdComp download. For development, also grab the separate Developer SDK, which carries the reference assembly and its documentation.

Reference either the installed DLL at Grand Theft Auto V\Plugins\LSPDFR\pdComp.dll or lib\net48\pdComp.dll from the Developer SDK download. Either way RPH and LSPDFR load pdComp’s canonical installed assembly at runtime. The SDK keeps pdComp.xml beside its reference DLL, so IntelliSense shows each member’s documentation; the player download installs pdComp.dll alone. Target .NET Framework 4.8, the same framework as pdComp.

<!-- Point GtaPath at your install. Private=false keeps pdComp.dll out of your output. -->
<PropertyGroup>
  <GtaPath>C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V</GtaPath>
</PropertyGroup>

<ItemGroup>
  <Reference Include="pdComp">
    <HintPath>$(GtaPath)\Plugins\LSPDFR\pdComp.dll</HintPath>
    <Private>false</Private>
  </Reference>
</ItemGroup>
public void Start()
{
    PdCompApi.Ready += OnPdCompReady;
    PdCompApi.RuntimeStopping += OnPdCompStopping;
    RecordsApi.PaperworkFiled += OnPaperworkFiled;
}

public void Stop()
{
    PdCompApi.Ready -= OnPdCompReady;
    PdCompApi.RuntimeStopping -= OnPdCompStopping;
    RecordsApi.PaperworkFiled -= OnPaperworkFiled;
}
Threading: any-thread members read locked mirrors or detached snapshots. Members marked game fiber touch live entities, file-backed mutations, CDF, or LSPDFR state and must be called from an RPH game fiber.

pdComp.API

PdCompApi

Use PdCompApi to read the current patrol state, add a note to the current call, or create and clear BOLOs.

pdComp.API.PdCompApi is the general integration surface. Reads return safe defaults while pdComp is off duty; gameplay-changing writes honor the user’s ExternalApiWrites setting.

Lifecycle and state

Propertybool IsReady { get; }

Shows whether the on-duty pdComp runtime is ready.

True after the on-duty runtime is fully built and until teardown begins. Advisory; reads are already lifecycle-safe.Any thread

Eventevent EventHandler<EventArgs> Ready

Runs when pdComp is ready for the current duty session.

Raised once per duty session after the runtime is ready. Subscriptions survive duty cycles.

Eventevent EventHandler<EventArgs> RuntimeStopping

Runs when pdComp begins shutting down for the current duty session.

Raised before duty teardown or unload. Public mirrors have already been cleared when handlers run.

Propertybool OwnsInputFocus { get; }

Shows whether pdComp is using the player’s screen and input. Check it before handling your own hotkeys.

True while the computer, tablet, or a pdComp text prompt owns the screen and input.Any thread

Reads

MethodPdCompPresentedIdSnapshot GetLastPresentedId()

Returns the most recent ID handed to the officer, including the subject’s name and date of birth.

Latest ID physically presented: name, DOB, document/provider text, and presentation time. Returns null after cleanup or before presentation.Any thread

MethodPdCompCallSnapshot GetCurrentCall()

Returns the call the officer is currently working, including its location and activity log.

Detached callout identity, title, status, location, priority, agency, and activity log. Returns null while unavailable.Any thread

MethodIReadOnlyList<PdCompVehicleBolo> GetActiveBolos()

Returns the active vehicle BOLOs for display or plate matching.

Detached active BOLOs, newest first, with plate, reason, filing time, and captured vehicle description.Any thread

Writes

Methodsbool DismissPresentedId()
bool DismissPresentedId(uint pedHandle)

Dismisses the latest on-screen ID or the ID belonging to a specific subject.

The parameterless overload leaves older cards visible. The ped overload uses ped.Handle.Value. True means the request was queued for the next frame; these transient UI writes are not controlled by ExternalApiWrites.Any thread

Methodbool TryAddSceneActivity(string primary, string detail, string source)

Adds a note from your plugin to the current call’s activity log.

Adds a bounded, source-tagged line to the live call log and report context. Returns false when unavailable, disabled, or blank.Game fiber

MethodPdCompBoloWriteResult CreateBolo(string plate, string reason)

Creates a BOLO for a plate through the same path used by pdComp.

Creates a BOLO through normal persistence and CDF synchronization. Blank reasons use pdComp’s default; plates over 16 characters or reasons over 80 are rejected.Game fiber

MethodPdCompBoloWriteResult ClearBolo(string plate)

Clears the active BOLO for a plate.

Clears an active BOLO through the same persistence and sync path.Game fiber

BOLO event

Eventevent EventHandler<PdCompBoloChangedEventArgs> BoloChanged

Runs when pdComp or another plugin creates or clears a BOLO.

Raised after a BOLO is created or cleared through either the pdComp UI or public API. Event data contains the detached BOLO, final write result, and IsActive state.

Back to top ↑

pdComp.API · Expanded in v0.4.2

Catalog APIs

Use ChargesApi and CitationApi to read the charge and citation catalogs loaded for the current duty session.

Both methods are safe from any thread and return immutable, deeply detached snapshots. They return empty collections before PdCompApi.Ready and after RuntimeStopping. Catalogs load once per duty session, so refresh consumer-side indexes when Ready fires.

ChargesApiIReadOnlyList<PdCompChargeCatalogEntry> GetCatalog()

Returns the user’s loaded arrest-charge catalog.

Entries include code, description, severity, category, tier, legal class, statute, notes, jurisdiction, court weight, felony flags, and detached modifier and enhancement rows.Any thread

CitationApiIReadOnlyList<PdCompCitationCatalogEntry> GetCatalog()

Returns the user’s loaded citation catalog.

Entries include code, description, base fine and points, category, statute, correctable and appearance flags, enforcement type, jurisdiction, notes, pdComp’s derived tier and court weight, and selectable Enhancements in catalog order.Any thread

foreach (PdCompChargeCatalogEntry charge in ChargesApi.GetCatalog())
{
    Console.WriteLine($"{charge.Code}: tier {charge.Tier} ({charge.LegalClass})");
}

foreach (PdCompCitationCatalogEntry citation in CitationApi.GetCatalog())
{
    foreach (PdCompCitationEnhancementSnapshot condition in citation.Enhancements)
        Console.WriteLine($"{condition.Id}: {condition.Label}");
}
Back to top ↑

pdComp.API

CitationApi

Use CitationApi when your plugin controls the conversation during a traffic stop. It can trigger the physical citation handoff and receive the result.

pdComp.API.CitationApi lets NPCAI or another plugin coordinate a conversation-triggered physical citation handoff. pdComp owns delivery for both the Policing Redefined and Stop The Ped paths by default. Every method is safe from any thread; pdComp queues game work onto its own fiber.

Delivery modes: [Integration] PrCitationHandoff and StpCitationHandoff both default to PdComp, which parks a filed citation as a pending handoff against the live ped. A user who selects the provider-owned mode (Pr or Stp) keeps that provider’s Give Citations or Issue Ticket menu, and your calls return false; pdComp still observes those handoffs internally, so NPCAI context advances after the menu interaction.
Handover key: the player can also deliver a pending citation with the configured key, [Controls] CitationHandoffKey, default Shift+H. Setting it to None allows automatic proximity delivery when no conversation trigger is registered, so a pending handoff may be gone before you call TriggerHandoff.
MethodCitationHandoffAvailability GetAvailability()

Checks whether pdComp can hand over a citation and explains why when it cannot.

Explains whether handoff mode is available: available, off duty, PR missing, owned by PR, or owned by Stop The Ped. Available still requires a valid subject on an active stop when the citation is filed, and the answer can change as the session moves.Any thread

Methodstring GetPendingHandoffText(Rage.Ped ped)

Returns a short summary of the citation waiting to be handed to the subject.

Returns the bounded charges-and-fines line for the pending bundle, or null.Any thread

Methodbool TriggerHandoff(Rage.Ped ped)

Requests the physical citation handoff for the selected subject.

Requests delivery. True only when the state changes from waiting to requested; repeated or unavailable calls return false.Any thread

Methodvoid SetConversationTriggerRegistration(string consumerId, bool active)

Registers your plugin to decide when a citation is handed over. Unregister it when the feature is disabled or the plugin unloads.

Registers an independent conversation-trigger consumer. IDs must be stable, nonblank, and at most 80 characters. Registrations survive duty cycles; pass false when your plugin unloads or disables the feature.Any thread

Eventevent EventHandler<CitationHandoffEventArgs> HandoffEnded

Runs when a handoff ends, whether delivered or cancelled.

Raised once on pdComp’s game fiber when a handoff reaches a terminal state. Event data includes the bundle and citation IDs, captured ped handle and subject, details, animation flag, cancellation reason, and occurrence time. CancellationReason.None means the ticket was delivered.

Typical handoff

CitationApi.SetConversationTriggerRegistration(
    "MyPlugin.CitationConversation", true);

string line = CitationApi.GetPendingHandoffText(ped);
if (line != null)
{
    bool requested = CitationApi.TriggerHandoff(ped);
}
Back to top ↑

pdComp.API

RecordsApi

Use RecordsApi to look up detached ped and vehicle records or listen for filed paperwork and resolved court cases.

pdComp.API.RecordsApi returns provider-normalized point-in-time snapshots and typed event data. Lookup calls run on an RPH game fiber; event subscriptions survive duty cycles and handlers run on pdComp’s game fibers outside store locks.

Record lookups

MethodPdCompPedRecordSnapshot GetPedRecord(Rage.Ped ped)

Returns a full detached record for one live pedestrian.

Returns null when pdComp or its record provider is unavailable, the ped is null or no longer exists, the provider has no record, or lookup fails.Game fiber

MethodPdCompVehicleRecordSnapshot GetVehicleRecord(Rage.Vehicle vehicle)

Returns a full detached record for one live vehicle.

Includes the registered owner, document state, BOLO state, and ALPR context when known. Returns null when unavailable or lookup fails.Game fiber

MethodIReadOnlyList<PdCompPedRecordSnapshot> SearchPedRecords(string query)

Searches the pedestrian records currently collected in Ped Lookup.

Matches name and ISO date-of-birth terms and returns up to eight full snapshots, including prior-history totals and entries. Blank or unavailable searches return an empty list.Game fiber

MethodIReadOnlyList<PdCompVehicleRecordSnapshot> SearchVehicleRecords(string query)

Searches the vehicle records currently collected in Vehicle Lookup.

Matches plate, cached VIN, description, color, or owner and returns up to eight full snapshots. Blank or unavailable searches return an empty list.Game fiber

Lookup scope: searches cover records already exposed on pdComp’s lookup pages, not every entity in the GTA world. Clear Call Data removes that transient collection. For vehicle documents, check RegistrationStatusKnown and InsuranceStatusKnown before reading the corresponding status; unknown values are null, not implied valid.

Events

Eventevent EventHandler<PdCompPaperworkFiledEventArgs> PaperworkFiled

Runs when the player files a citation, arrest, report, or warning.

Raised for a citation, arrest, general report, or warning. Kind selects the populated snapshot; citation and arrest events also carry the related CourtCaseId.

Eventevent EventHandler<PdCompCourtCaseResolvedEventArgs> CourtCaseResolved

Runs when a court case reaches a final outcome.

Raised once when a court case first reaches a terminal outcome, with the complete resolved case snapshot.

Snapshot contents

LookupPdCompPedRecordSnapshot
PdCompPriorHistorySnapshot
PdCompPriorHistoryEntrySnapshot

Identity, licensing, permits, warrants, status, advisories, and prior contacts for a pedestrian.

Ped records expose name, DOB, gender, address, issuing state, license status and expiry, weapon/hunting/fishing permits, wanted and warrant details, parole/probation, deceased state, provider stop/citation counts, advisories, and optional prior history. Search results add reported stop/citation/warning totals, generated-arrest count, and entries with charge metadata, tier, felony flags, severity, and source.

LookupPdCompVehicleRecordSnapshot

Identity, ownership, documents, BOLOs, and ALPR context for a vehicle.

Vehicle records expose plate, VIN, colors, make/model, detached owner and owner type, authoritative registration/insurance flags with status and expiry, stolen and BOLO state, and Callout Interface or pdComp ALPR source, label, detail, and time.

PaperworkPdCompCitationSnapshot · PdCompArrestSnapshot

Data included with filed citations and arrests.

Citations include filing details, total fine, and lines with final fine, points, appearance requirement, category, statute, correctable flag, enforcement type, jurisdiction, notes, and selected enhancement snapshots. Arrests include filing details, selected modifier and enhancement IDs, and detached evidence including where each item was found.

PaperworkPdCompReportSnapshot · PdCompWarningSnapshot

Data included with filed reports and warnings, including reports from custom catalogs.

Reports include their type, optional CustomTypeId, subject, call reference, narrative, disposition, complete call context, and detached custom fields (Id, Label, Section, Type, Value). Warnings include subject, location, and reason.

CourtPdCompCourtCaseSnapshot

Data included when a court case is resolved.

Resolved cases include their IDs, subject, dates, status, outcome, sentence, plea, charge dispositions, and timeline.

Back to top ↑

pdComp.Addons

In-process add-on SDK

Use the in-process SDK to add pages to pdComp’s desktop or tablet.

Add-on callbacks execute in pdComp’s runtime; keep them short and treat live graphics/entity work as game-fiber-only.

Installation and discovery

Build a .NET Framework 4.8 class library that references pdComp.dll (with Private=false, as above), then place your compiled DLL in Grand Theft Auto V\Plugins\LSPDFR\pdComp\addons\.

Each time the player goes on duty, pdComp scans that folder and instantiates every non-abstract type that implements IPdCompAddon and has a public parameterless constructor. Initialize runs at duty start and Shutdown at duty end. An add-on whose MinimumPdCompVersion is newer than the installed pdComp is skipped and the skip is logged.

IPdCompAddon

Propertiesstring Id { get; }
string Name { get; }
Version MinimumPdCompVersion { get; }

Identifies the add-on and the oldest pdComp version it supports.

Stable identity, display name, and minimum supported host version for the add-on.

Methodvoid Initialize(IPdCompHost host)

Runs when pdComp loads the add-on. Save the host reference to access pdComp services.

Receives the host services when the add-on starts.

Methodvoid Shutdown()

Runs when pdComp unloads the add-on. Release resources and event subscriptions created by the add-on.

Stops the add-on and releases its subscriptions/resources.

IPdCompHost

ServicesIPdCompData Data { get; }
IPdCompEvents Events { get; }
IPdCompUi Ui { get; }
IPdCompTheme Theme { get; }

Provides access to pdComp’s data, events, navigation, and theme.

Host-owned data, event, navigation, and theme services.

Propertybool CareerRadioFlavorEnabled { get; }

Shows whether the player has enabled career radio chatter.

Whether career add-on radio flavor is enabled for this runtime.

Methodstring AddonDataPath(string addonId)

Returns the folder where the add-on can store its files.

Returns the add-on’s host-managed data directory.

Methodsvoid Log(string message)
void Notify(string title, string message)

Writes to pdComp’s log or shows an in-game notification.

Writes through pdComp logging and notification surfaces.

Methodvoid ReportCareerRank(int xp, string rankName)

Sends the player’s XP and rank to pdComp for display.

Reports career progression for display within pdComp.

Methodstring PromptText(string title, string initial, int maxLength)

Opens pdComp’s text-entry prompt and returns the player’s input, or null when they cancel.

Blocks on pdComp’s native bounded text-entry prompt; call it only from page input handlers such as OnClick.

Methodsvoid DrawText(Graphics g, string text, string font, float size, PointF position, Color color)
IReadOnlyList<string> WrapText(string text, string font, float size, float maxWidth)

Uses pdComp’s text rendering and wrapping so add-on pages match the built-in UI.

Uses the host’s rendering and line-wrapping behavior for consistent add-on UI.

MethodIReadOnlyList<string> NearbySquadOfficerNames(int max)

Returns nearby squad officer names for rosters, backup lists, or similar UI.

Returns up to the requested number of nearby squad officer names.

Methodbool TryCompleteReportReview(Guid reportId, out PdCompReportSummary report)

Marks a pending report as reviewed and returns the updated summary.

Attempts to complete a report review and returns the updated summary.

UI and data interfaces

IPdCompUivoid RegisterDesktopPage(IPdCompPage page)
void RegisterTabletPage(IPdCompPage page)

Adds a page to pdComp’s desktop or tablet navigation.

Registers a native navigation page in the desktop or tablet shell.

IPdCompDatastring OfficerName { get; }
string OfficerCallsign { get; }
PdCompRecordCounts Counts { get; }
IReadOnlyList<PdCompReportSummary> RecentReports(int max)

Provides the officer’s name, callsign, record counts, and recent reports.

Officer identity, record totals, and bounded recent-report summaries.

IPdCompEventsevent Action<PdCompActivityEvent> Activity

Notifies the add-on of activity inside pdComp.

The host activity feed for in-process add-ons.

IPdCompPagestring NavLabel { get; }
string Title { get; }
void OnEnter()
void OnLeave()
void OnTick()
void OnClick(PointF cursor)
void OnScroll(int delta)
void Draw(Graphics g, RectangleF bounds, PointF cursor)

Defines how a page is named, opened, updated, controlled, and drawn.

Complete page lifecycle, input, and drawing contract for native add-on pages. pdComp isolates game-fiber callback failures and suppresses repeat calls to the failed operation; the computer or tablet shell contains draw failures.

IPdCompThemefloat S(float value)
Font, size, and color properties

Provides pdComp’s fonts, colors, and resolution-aware sizing.

Resolution-aware scaling plus the active UI/title fonts, heading/body sizes, and semantic background, panel, row, text, accent, gold, good, warning, and danger colors.

Back to top ↑

Detached data

Types & enums

API data is returned as a point-in-time copy. These copies do not update as pdComp’s state changes, so request a new one when you need current data.

Public DTOs are detached point-in-time snapshots. Nested collections are copied and read-only; fetch a fresh snapshot when current state matters.

SurfaceSnapshots and event data
PdCompApiPdCompBoloChangedEventArgs, PdCompPresentedIdSnapshot, PdCompCallEvent, PdCompCallSnapshot, PdCompVehicleBolo
ChargesApiPdCompChargeCatalogEntry, PdCompChargeModifierCatalogEntry, PdCompChargeEnhancementCatalogEntry
CitationApiPdCompCitationCatalogEntry, PdCompCitationEnhancementSnapshot, CitationHandoffEventArgs
RecordsApiPdCompPedRecordSnapshot, PdCompVehicleRecordSnapshot, PdCompPriorHistorySnapshot, PdCompPriorHistoryEntrySnapshot, PdCompPaperworkFiledEventArgs, PdCompCourtCaseResolvedEventArgs, PdCompCitationSnapshot, PdCompCitationLine, PdCompArrestSnapshot, PdCompArrestCharge, PdCompEvidenceSnapshot, PdCompReportSnapshot, PdCompReportField, PdCompWarningSnapshot, PdCompCourtCaseSnapshot, PdCompCourtChargeDisposition, PdCompCourtTimelineEntry

Enum values

EnumValues
PdCompBoloWriteResultSuccess, NotReady, Disabled, InvalidPlate, InvalidReason, AlreadyActive, NotActive, StoreFailed, SyncSkippedVehicleGone, SyncFailed
CitationHandoffAvailabilityAvailable, OffDuty, PrNotLoaded, HandoffOwnedByPr, NpcAiBridgeInactive (retained for compatibility; no longer returned), HandoffOwnedByStp
CitationHandoffCancellationReasonNone, TimedOut, SubjectUnavailable, StopEnded, PdCompStopped, DeliveryFailed, InternalError
PdCompPaperworkKindCitation, Arrest, Report, Warning

Integration rules

Compatibility

Public API behavior remains compatible within a major pdComp release. Updates may add enum values and DTO properties, so code against only the members you need and allow for values you do not recognize.

Existing public signatures keep their meaning within a major pdComp release. Enum values and DTO properties may be appended, so feature-detect the exact member you need and tolerate values you do not recognize yet.

Reflection consumers: find pdComp through AppDomain.CurrentDomain.GetAssemblies(), feature-detect the exact type/member you need, and leave the integration disabled when it is absent. Do not use Assembly.LoadFrom. Probe each v0.4.2 record lookup independently when supporting older installations.
Assembly pdComp = AppDomain.CurrentDomain.GetAssemblies()
    .FirstOrDefault(a => a.GetName().Name == "pdComp");

Type api = pdComp?.GetType("pdComp.API.PdCompApi", false);
MethodInfo addLine = api?.GetMethod("TryAddSceneActivity");

// TryAddSceneActivity is game-fiber-only: invoke it from an RPH game fiber.
bool logged = addLine != null && (bool)addLine.Invoke(
    null,
    new object[] { "Witness interviewed", "Statement taken", "MyPlugin" });
Get pdComp on LCPDFR