Public API · v0.4.0

Patrol data. Clean interface.

Read pdComp state, share call activity, manage BOLOs, react to filed paperwork and court outcomes, trigger citation handoffs, 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: the API below first ships with pdComp v0.4.0. The current public LCPDFR build is v0.3.8.

Direct reference

Reference the installed DLL at Grand Theft Auto V\Plugins\LSPDFR\pdComp.dll. The release ships pdComp.xml beside it, so IntelliSense shows each member’s documentation. 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

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

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 on the Policing Redefined delivery path; Stop The Ped keeps its own menu-driven flow. Every method is safe from any thread; pdComp queues game work onto its own fiber.

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 waiting for an active NPCAI bridge.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 listen for filed paperwork and resolved court cases. Each event includes a complete copy of the record.

pdComp.API.RecordsApi provides typed, detached notifications for filed paperwork and resolved court cases; there are no follow-up record queries. Subscriptions survive duty cycles, and handlers run on pdComp’s game fibers outside store locks.

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

PaperworkPdCompCitationSnapshot · PdCompArrestSnapshot

Data included with filed citations and arrests.

Citations include filing details, citation lines, and total fine. Arrests include filing details, selected modifier and enhancement IDs, and detached evidence.

PaperworkPdCompReportSnapshot · PdCompWarningSnapshot

Data included with filed reports and warnings.

Reports include subject, call reference, narrative, disposition, and call context. 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.

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
CitationApiCitationHandoffEventArgs
RecordsApiPdCompPaperworkFiledEventArgs, PdCompCourtCaseResolvedEventArgs, PdCompCitationSnapshot, PdCompCitationLine, PdCompArrestSnapshot, PdCompArrestCharge, PdCompEvidenceSnapshot, PdCompReportSnapshot, PdCompWarningSnapshot, PdCompCourtCaseSnapshot, PdCompCourtChargeDisposition, PdCompCourtTimelineEntry

Enum values

EnumValues
PdCompBoloWriteResultSuccess, NotReady, Disabled, InvalidPlate, InvalidReason, AlreadyActive, NotActive, StoreFailed, SyncSkippedVehicleGone, SyncFailed
CitationHandoffAvailabilityAvailable, OffDuty, PrNotLoaded, HandoffOwnedByPr, NpcAiBridgeInactive
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.
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