LSPDFR Helpers — ZoneInfo, Officers, Pursuits, RadioAnimation, LspdfrRuntime
Small, null-safe wrappers over LSPDFR APIs that are easy to get wrong raw. Everything here degrades to a sensible fallback instead of throwing.
ZoneInfo — where is this?
Zone intelligence for dispatch text and scanner audio, wrapping
Functions.GetZoneAtPosition.
string area = ZoneInfo.AreaName(position); // "Mission Row"; fallback "your location"
string area2 = ZoneInfo.AreaName(position, "the area"); // custom fallback
EWorldZoneCounty county = ZoneInfo.County(position); // LosSantos when unresolvable
if (ZoneInfo.IsOffMainland(position))
{
// Cayo Perico or North Yankton — the standard mainland backup tables don't apply;
// adjust dispatch text/units accordingly
}
Typical use — dispatch flavor:
notifier.Show(Palette.Dispatch("units respond to " + Palette.Key(ZoneInfo.AreaName(pos))));
Officers — who is this cop?
Officer identity via LSPDFR's persona system, for broadcasts like "Unit J. Herrera is down".
if (Officers.IsCop(ped)) // null/dead-safe Functions.IsPedACop
{
string name = Officers.Name(ped); // full persona name; "an officer" fallback
notifier.Show(Palette.Danger("Officer " + name + " is down!"));
}
Pursuits — pursuit-safe helpers
LSPDFR pursuit handles (LHandle) are opaque and can die at any moment. These helpers
never store a handle — every operation re-fetches and re-validates via
Functions.IsPursuitStillRunning.
if (Pursuits.IsPursuitActive())
{
// the player has a live pursuit right now
}
bool added = Pursuits.TryAddCop(cop); // adds to the active pursuit; false when none/fails
BurnsieCallout's leash uses IsPursuitActive() to avoid ending a callout while a chase
legitimately ranges away from the scene — do the same in your own "player left the area"
logic.
RadioAnimation — keyed-up radio, done right
Plays the LSPDFR radio animation on the player, with the details handled:
- Chooses the pose that fits: shoulder mic on foot, chest mic seated in a vehicle.
- Saves the previous radio action and restores it afterwards.
- Skips entirely when the player is dead or ragdolled — you cannot key a radio from the ground.
- Fire-and-forget on its own fiber; failures are cosmetic and logged at debug.
RadioAnimation.PlayFor(fibers, log, durationMs: 2500);
FrontendSounds.RadioSquelchOpen();
scanner.Enqueue(phrase, position);
LspdfrRuntime — runtime introspection
For compatibility reports and coexistence warnings.
Version lspdfr = LspdfrRuntime.GetLspdfrVersion(log); // null when unavailable
// Which plugins that might conflict are loaded?
List<string> clashes = LspdfrRuntime.FindPlugins(log, "UltimateBackup", "StopThePed");
if (clashes.Count > 0)
{
log.Warn("Also loaded: " + string.Join(", ", clashes) +
" — if both provide a panic button, configure one of them off.");
}
FindPlugins matches loaded LSPDFR plugin assembly names against case-insensitive name
fragments and returns the matches. Use it to inform users about overlapping features —
never to silently change behavior based on another plugin's presence.