Skip to main content

IPursuit


Namespace: FivePD.API#
File: Source/Interfaces/IPursuit.cs#

Creating a pursuit using the API can be handy in many situations.

The new pursuit system allows you to easily create,manage and terminate multiple pursuits.

This system spawns blips, syncs these between players and manages the ped.

Each pursuit has its own unique handle, that can later be used to get back a pursuit from the system.

Note: A pursuit will be automatically terminated if the ped gets arrested (or IsDead = true). The synced blips will be automatically deleted from every client.


Properties#

Handle#

Type:int (read-only)

Returns the unique handle of the pursuit.

IsInPursuit#

Type:bool (read-only)

Returns whether the local player is in pursuit.

IsVehiclePursuit#

Type:bool (read-only)

Returns whether the local player is in a vehicle pursuit.

Suspect#

Type:Ped (read-only)

Returns the suspect ped.

FleeingFrom#

Type:Ped (read-only)

Returns the ped the suspect is currently fleeing from (could be another player).

PursuitState#

Type:PursuitStateEnum (read-only)

Returns the current state of the pursuit.


Methods#

Init#

void Init(bool vehiclePursuit, float fleeDistance, float areaRadius, bool suspectBlip = true);

Initializes the pursuit.

In this process, the blips get spawned and synced between all other players and the PursuitState changes to Awaiting.

Params:

  • vehiclePursuit
    • Type: bool
    • Is it a vehicle or foot pursuit? If true, the pursuit changes to a vehicle pursuit (ped behaves differently).
  • fleeDistance
    • Type: float
    • If a player gets closer than the given distance, the ped will start running away (always from the closest player).
  • areaRadius
    • Type: float
    • Blip area radius.
  • suspectBlip
    • Type: bool
    • Whether to attach a blip to the suspect (default: true).

Example

var pursuit = FivePD.API.Pursuit.RegisterPursuit(suspect);pursuit.Init(false,150f,125f,true);

ActivatePursuit#

Activates the pursuit.

PursuitState changes to Active and the pursuit will start once a player gets closer than the given distance.

Example

// using the previous examplevar pursuit = FivePD.API.Pursuit.RegisterPursuit(suspect); // use an already spawned pedpursuit.Init(false,150f,125f,true);... // somewhere elsepursuit.Activate(); // Your pursuit is now ActiveDebug.Log(pursuit.PursuitState.ToString()); // 

Terminate#

Terminates the pursuit.

PursuitState changes to Finished.

Example

pursuit.Terminate();