IPursuit
FivePD.API
#
Namespace: Source/Interfaces/IPursuit.cs
#
File: 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#
HandleType:int (read-only)Returns the unique handle of the pursuit.
#
IsInPursuitType:bool (read-only)Returns whether the local player is in pursuit.
#
IsVehiclePursuitType:bool (read-only)Returns whether the local player is in a vehicle pursuit.
#
SuspectType:Ped (read-only)Returns the suspect ped.
#
FleeingFromType:Ped (read-only)Returns the ped the suspect is currently fleeing from (could be another player).
#
PursuitStateType:PursuitStateEnum (read-only)Returns the current state of the pursuit.
#
Methods#
Initvoid 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);
#
ActivatePursuitActivates 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()); //
#
TerminateTerminates the pursuit.
PursuitState
changes to Finished
.
Example
pursuit.Terminate();