> For the complete documentation index, see [llms.txt](https://hrscripts.gitbook.io/hrscripts-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hrscripts.gitbook.io/hrscripts-documentation/resources/hrlib/modules/trackingentities/client/functions.md).

# Functions

## TrackEntity

Function to start tracking an entity for its deletion

```lua
function HRLib.TrackEntity(
    entityId: integer,
    attachedInfo: table<string, any>?,
    cb: fun(entityType: 'vehicle'|'ped'|'object')?    
)
```

Parameters description

* `entityId` - the id of the entity to track
* `attachedInfo` - a table where you can set additional info to the properties in the event trigger
* `cb` - a callback function to trigger during entity check if you of course want to do something with the entity in each check or to add additional info to the properties in the event trigger but needs to be triggered on each check

## GetIsEntityTracked

Function to check if an entity is being tracked by the function [TrackEntity](#trackentity)

```lua
function HRLib.GetIsEntityTracked(entityId: integer): boolean
```

Parameters description

* `entityId` - the id of the entity to check

## GetTrackedEntityProperties

Function to get the last values set to the properties in the last check

```lua
function HRLib.GetTrackedEntityProperties(entity: integer, index: string?): any?
```

Parameters description

* `entity` - the entity id to get the properties of
* `index` - index of the properties if you're not interested to get all the properties\
  (if `nil`, it will return all the properties)

## GetTrackedEntities

Function to get all tracked entities from the player

```lua
function HRLib.GetTrackedEntities(): { entity: integer, properties: table }[]?
```

## RemoveEntityTracker

Function to stop tracking entity

```lua
function HRLib.RemoveEntityTracker(entityId: integer)
```

Parameters description

* `entityId` - the entity id to remove the tracker of
