Pursuit
Namespace: FivePD.API#
File: Source/Pursuit.cs#
Methods#
RegisterPursuit#
Registers a pursuit and returns the pursuit object.
The pursuit object allows you to Init the pursuit, and then start it whenever you want.
Initiating the pursuit will also spawn the default blips and sync between every client on the server. You must specify whether it is a vehicle or foor pursuit.
After starting the pursuit, the ped will try to run away from the closest player.
You can find more information about the object that this method returns in the IPursuit tab.
Returns: IPursuit<PursuitStateEnum>
Params:
- ped
- Type: Ped
- Ped
Example#
Ped suspect = await SpawnPed(PedHash.Agent,new Vector3(0,0,0),180f);var pursuit = Pursuit.RegisterPursuit(suspect);GetPursuitsByState#
Returns all (registered) pursuits with the given state.
Returns: IPursuit<PursuitStateEnum[]>
Params:
- pursuitState
- Type: PursuitStateEnum
- The state of the pursuit (
Awaiting,Active,Finished).
Example#
var pursuits = Pursuit.GetPursuitByState(PursuitStateEnum.Active); // To get all active pursuitsGetPursuitByHandle#
When you create a pursuit, a Handle will be assigned to the pursuit object.
The handle is a unique identifier that can be used to identify a pursuit.
Calling this method with the specified handle will return the corresponding pursuit (null, if the pursuit does not exist).
Returns: IPursuit<PursuitStateEnum[]>
Params:
- handle
- Type: int
- The handle of the pursuit
Example#
// Create a new pursuitvar pursuit = Pursuit.RegisterPursuit(suspect);int handle = pursuit.Handle; // store the handle of the pursuit (eg. globally)...var pursuit = Pursuit.GetPursuitByHandle(handle); // get back the same pursuit (somewhere else, eg. in a different scope)