fivem-ts

a library to speed up the development of Fivem scripts and frameworks


Project maintained by Purpose-Dev Hosted on GitHub Pages — Theme by mattgraham

fivem-ts - Documentation v0.7.5Docs


fivem-ts - Documentation v0.7.5 / Client / Vehicle

Class: Vehicle

Represents an in-game entity with various properties and methods to interact with the underlying game engine.

Extends

Constructors

new Vehicle()

new Vehicle(id): Vehicle

Parameters

id: number

Returns

Vehicle

Overrides

Entity.constructor

Defined in

client/models/Vehicle.ts:17

Accessors

AttachedBlip

get AttachedBlip(): Blip

Retrieves the attached blip for the entity. If a valid blip handle exists for the entity, it returns a new Blip instance; otherwise, it returns null.

Returns

Blip

The attached Blip instance or null if no valid blip exists.

Inherited from

Entity.AttachedBlip

Defined in

client/models/Entity.ts:456


Bones

get Bones(): EntityBoneCollection

Retrieves the EntityBoneCollection associated with this entity.

Returns

EntityBoneCollection

Entity Bone Collection of Entity

Inherited from

Entity.Bones

Defined in

client/models/Entity.ts:31


ClassDisplayName

get ClassDisplayName(): string

Returns

string

Defined in

client/models/Vehicle.ts:26


ClassType

get ClassType(): VehicleClass

Returns

VehicleClass

Defined in

client/models/Vehicle.ts:30


Handle

get Handle(): number

Gets the handle value.

Returns

number

The handle value as a number.

Inherited from

Entity.Handle

Defined in

client/models/Entity.ts:22


HasCollided

get HasCollided(): boolean

Checks if the entity with the specified handle has collided with anything.

Returns

boolean

Returns true if the entity has collided with anything, otherwise false.

Inherited from

Entity.HasCollided

Defined in

client/models/Entity.ts:422


HasGravity

set HasGravity(value): void

Sets whether the entity has gravity.

Parameters

value: boolean

A boolean value indicating whether the entity should have gravity.

Inherited from

Entity.HasGravity

Defined in

client/models/Entity.ts:233


Heading

get Heading(): number

Retrieves the current heading of the entity.

set Heading(heading): void

Sets the heading of an entity to a specified value.

Parameters

heading: number

The new heading value for the entity.

Returns

number

The heading of the entity.

Inherited from

Entity.Heading

Defined in

client/models/Entity.ts:171


Health

get Health(): number

Retrieves the current health of the entity.

set Health(value): void

Sets the health of the entity.

Parameters

value: number

The health value to be set for the entity.

Returns

number

The health of the entity.

Inherited from

Entity.Health

Defined in

client/models/Entity.ts:52


HeightAboveGround

get HeightAboveGround(): number

Calculates and returns the height of the entity above the ground level.

Returns

number

The height of the entity above the ground.

Inherited from

Entity.HeightAboveGround

Defined in

client/models/Entity.ts:242


IsAlive

get IsAlive(): boolean

Checks the living status of the entity.

Returns

boolean

Returns true if the entity is alive, otherwise false.

Inherited from

Entity.IsAlive

Defined in

client/models/Entity.ts:97


IsCollisionEnabled

get IsCollisionEnabled(): boolean

Checks if collision is enabled for

set IsCollisionEnabled(value): void

Enables or disables collision detection for the entity.

Parameters

value: boolean

A boolean indicating whether collision should be enabled (true) or disabled (false).

Returns

boolean

Inherited from

Entity.IsCollisionEnabled

Defined in

client/models/Entity.ts:428


IsDead

get IsDead(): boolean

Checks whether the entity is dead.

Returns

boolean

Returns true if the entity is dead, otherwise false.

Inherited from

Entity.IsDead

Defined in

client/models/Entity.ts:88


IsInAir

get IsInAir(): boolean

Determines if the entity is currently in the air.

Returns

boolean

A boolean value indicating whether the entity is airborne.

Inherited from

Entity.IsInAir

Defined in

client/models/Entity.ts:333


IsInvincible

set IsInvincible(value): void

Sets the invincibility status of the entity.

Parameters

value: boolean

A boolean value where true makes the entity invincible and false removes invincibility.

Inherited from

Entity.IsInvincible

Defined in

client/models/Entity.ts:379


IsInWater

get IsInWater(): boolean

Determines if the entity represented by this instance is in water.

Returns

boolean

True if the entity is in water, otherwise false.

Inherited from

Entity.IsInWater

Defined in

client/models/Entity.ts:342


IsOccluded

get IsOccluded(): boolean

Checks if the current entity is occluded.

This method determines whether the entity associated with the current instance is occluded, meaning it is blocked from view by other objects or entities.

Returns

boolean

Inherited from

Entity.IsOccluded

Defined in

client/models/Entity.ts:299


IsOnFire

get IsOnFire(): boolean

Checks if the entity is currently on fire.

Returns

boolean

Inherited from

Entity.IsOnFire

Defined in

client/models/Entity.ts:370


IsOnlyDamagedByPlayer

set IsOnlyDamagedByPlayer(value): void

Modifies the entity to only take damage from players.

Parameters

value: boolean

If true, the entity will only be damaged by players; otherwise, it can be damaged by other sources.

Inherited from

Entity.IsOnlyDamagedByPlayer

Defined in

client/models/Entity.ts:388


IsOnScreen

get IsOnScreen(): boolean

Checks if the entity represented by this object is currently visible on the screen.

Returns

boolean

True if the entity is on the screen, false otherwise.

Inherited from

Entity.IsOnScreen

Defined in

client/models/Entity.ts:308


IsPersistent

get IsPersistent(): boolean

Determines whether the current entity is persistent.

set IsPersistent(value): void

Parameters

value: boolean

Returns

boolean

True if the entity is persistent; otherwise, false.

Inherited from

Entity.IsPersistent

Defined in

client/models/Entity.ts:351


IsPositionFrozen

set IsPositionFrozen(value): void

Sets the frozen state of the entity’s position.

Parameters

value: boolean

If true, the entity’s position will be frozen. If false, the entity’s position will be unfrozen.

Inherited from

Entity.IsPositionFrozen

Defined in

client/models/Entity.ts:189


IsRecordingCollisions

set IsRecordingCollisions(value): void

Sets whether the entity is recording collisions.

Parameters

value: boolean

A boolean indicating whether the entity should record collisions.

Inherited from

Entity.IsRecordingCollisions

Defined in

client/models/Entity.ts:446


IsUpright

get IsUpright(): boolean

Checks if the entity is in an upright position.

Returns

boolean

True if the entity is upright, false otherwise.

Inherited from

Entity.IsUpright

Defined in

client/models/Entity.ts:317


IsUpsideDown

get IsUpsideDown(): boolean

Determines if the entity is upside down. This method checks the orientation

Returns

boolean

Inherited from

Entity.IsUpsideDown

Defined in

client/models/Entity.ts:324


IsVisible

get IsVisible(): boolean

Check if the entity is currently visible.

set IsVisible(value): void

Sets the visibility of the entity.

Parameters

value: boolean

A boolean value indicating whether the entity should be visible.

Returns

boolean

True if the entity is visible, otherwise false.

Inherited from

Entity.IsVisible

Defined in

client/models/Entity.ts:278


LodDistance

get LodDistance(): number

Retrieves the Level of Detail (LOD) distance for the current entity.

set LodDistance(value): void

Sets the Level of Detail (LOD) distance for the entity.

Parameters

value: number

The distance at which the entity will switch LOD models.

Returns

number

The LOD distance of the entity.

Inherited from

Entity.LodDistance

Defined in

client/models/Entity.ts:260


MaxHealth

get MaxHealth(): number

Retrieves the maximum health value of an entity.

set MaxHealth(value): void

Sets the maximum health for the entity.

Parameters

value: number

The maximum health value to be set for the entity.

Returns

number

The maximum health of the entity.

Inherited from

Entity.MaxHealth

Defined in

client/models/Entity.ts:70


MaxSpeed

set MaxSpeed(value): void

Sets the maximum speed for the entity.

Parameters

value: number

The maximum speed to be set for the entity.

Inherited from

Entity.MaxSpeed

Defined in

client/models/Entity.ts:224


Model

get Model(): Model

Gets an instance of the Model class.

Returns

Model

A new instance of the Model class initialized with the entity model of the current handle.

Inherited from

Entity.Model

Defined in

client/models/Entity.ts:106


NetworkId

get NetworkId(): number

Retrieves the network ID associated with the current entity.

Returns

number

The network ID of the entity.

Inherited from

Entity.NetworkId

Defined in

client/models/Entity.ts:43


Opacity

get Opacity(): number

Retrieves the opacity level of the entity associated with this handle.

set Opacity(value): void

Sets the opacity (alpha value) of this entity.

Parameters

value: number

The opacity value to set, where 0 is fully transparent and 255 is fully opaque.

Returns

number

The opacity level as a number, where 0 represents fully transparent and 255 represents fully opaque.

Inherited from

Entity.Opacity

Defined in

client/models/Entity.ts:397


Position

get Position(): Vector3

Gets the current position of the entity as a Vector3 object.

set Position(vector): void

Sets the position of the entity to the specified coordinates.

Parameters

vector: Vector3

The vector containing the new coordinates (x, y, z).

Returns

Vector3

The position of the entity in 3D space.

Inherited from

Entity.Position

Defined in

client/models/Entity.ts:115


Quaternion

get Quaternion(): Quaternion

Retrieves the quaternion for the current entity.

set Quaternion(quaternion): void

Sets the quaternion values for this entity.

Parameters

quaternion: Quaternion

The quaternion object containing x, y, z, and w components.

Returns

Quaternion

The quaternion representing the entity’s orientation.

Inherited from

Entity.Quaternion

Defined in

client/models/Entity.ts:152


Rotation

get Rotation(): Vector3

Retrieves the rotation of the entity as a Vector3.

set Rotation(vector): void

Sets the rotation of the entity.

Parameters

vector: Vector3

The vector representing the new rotation angles (in degrees) for the entity.

Returns

Vector3

The rotation of the

Inherited from

Entity.Rotation

Defined in

client/models/Entity.ts:133


RotationVelocity

get RotationVelocity(): Vector3

Retrieves the current rotation velocity of an entity. The rotation velocity is represented as a Vector3 object.

Returns

Vector3

The rotation velocity of the entity.

Inherited from

Entity.RotationVelocity

Defined in

client/models/Entity.ts:214


SubmersionLevel

get SubmersionLevel(): number

Retrieves the submersion level of the entity as a number.

Returns

number

The submersion level of the entity, where a higher value indicates a greater degree of submersion.

Inherited from

Entity.SubmersionLevel

Defined in

client/models/Entity.ts:251


Velocity

get Velocity(): Vector3

Computes and returns the velocity of the entity as a Vector3

set Velocity(velocity): void

Sets the velocity for the entity.

Parameters

velocity: Vector3

Returns

Vector3

Inherited from

Entity.Velocity

Defined in

client/models/Entity.ts:195

Methods

applyForce()

applyForce(direction, rotation, forceType?): void

Applies a force to the entity in a specified direction and with a specified rotation.

Parameters

direction: Vector3

The direction in which the force is to be applied.

rotation: Vector3

The rotational force to be applied.

forceType?: ForceType = ForceType.MaxForceRot2

The type of force to be applied, default is MaxForceRot2.

Returns

void

Inherited from

Entity.applyForce

Defined in

client/models/Entity.ts:807


applyForceRelative()

applyForceRelative(direction, rotation, forceType?): void

Applies a force to an entity in a direction relative to its current rotation.

Parameters

direction: Vector3

The direction vector in which the force is applied.

rotation: Vector3

The rotation vector representing the entity’s current rotation.

forceType?: ForceType = ForceType.MaxForceRot2

The type of force to be applied. Defaults to MaxForceRot2.

Returns

void

Inherited from

Entity.applyForceRelative

Defined in

client/models/Entity.ts:838


attachBlip()

attachBlip(): Blip

Attaches a blip to the entity associated with this instance.

Returns

Blip

The newly created Blip associated with the entity.

Inherited from

Entity.attachBlip

Defined in

client/models/Entity.ts:471


attachTo()

attachTo(entity, position, rotation): void

Attaches the current entity to a specified target entity at a given position and rotation.

Parameters

entity: Entity

The target entity to attach to.

position: Vector3

The position offset from the target entity.

rotation: Vector3

The rotation offset from the target entity.

Returns

void

Inherited from

Entity.attachTo

Defined in

client/models/Entity.ts:708


attachToBone()

attachToBone(entityBone, position, rotation): void

Attaches the current entity to a specified bone of another entity with given position and rotation offsets.

Parameters

entityBone: EntityBone

The bone of the target entity to attach this entity to.

position: Vector3

The position offset relative to the bone position.

rotation: Vector3

The rotation offset relative to the bone orientation.

Returns

void

Inherited from

Entity.attachToBone

Defined in

client/models/Entity.ts:737


clearLastWeaponDamage()

clearLastWeaponDamage(): void

Clears the last recorded weapon damage for the entity.

Returns

void

This method does not return a value.

Inherited from

Entity.clearLastWeaponDamage

Defined in

client/models/Entity.ts:558


delete()

delete(): void

Deletes the current entity if it is not the player’s entity. The method first sets the entity as a mission entity and then deletes it.

Returns

void

No return value.

Inherited from

Entity.delete

Defined in

client/models/Entity.ts:885


detach()

detach(): void

Detaches the current entity from its parent, effectively making it independent.

This method calls DetachEntity with parameters to ensure the entity is completely detached, handling any necessary dependencies and housekeeping.

Returns

void

No return value.

Inherited from

Entity.detach

Defined in

client/models/Entity.ts:765


exists()

exists(): boolean

Checks if the entity exists in the current context.

Returns

boolean

True if the entity exists, otherwise false.

Inherited from

Entity.exists

Defined in

client/models/Entity.ts:875


getEntityAttachedTo()

getEntityAttachedTo(): Entity

Returns the entity to which this entity is attached.

Returns

Entity

The entity that this entity is attached to.

Inherited from

Entity.getEntityAttachedTo

Defined in

client/models/Entity.ts:794


getOffsetPosition()

getOffsetPosition(offset): Vector3

Calculates the world position offset from the entity’s current position.

Parameters

offset: Vector3

The local offset vector to be applied to the entity’s position.

Returns

Vector3

The new world position vector after applying the given offset.

Inherited from

Entity.getOffsetPosition

Defined in

client/models/Entity.ts:675


getPositionOffset()

getPositionOffset(worldCoords): Vector3

Calculates the position offset from the given world coordinates.

Parameters

worldCoords: Vector3

The world coordinates to calculate the offset from.

Returns

Vector3

Inherited from

Entity.getPositionOffset

Defined in

client/models/Entity.ts:688


hasBeenDamagedBy()

hasBeenDamagedBy(entity): boolean

Determines if the current entity has been damaged by the specified entity.

Parameters

entity: Entity

The entity to check against for damage.

Returns

boolean

Inherited from

Entity.hasBeenDamagedBy

Defined in

client/models/Entity.ts:517


hasBeenDamagedByAnyMeleeWeapon()

hasBeenDamagedByAnyMeleeWeapon(): boolean

Checks if the entity has been damaged by any melee weapon.

This method determines whether the entity, represented by the ‘handle’, has sustained damage from any weapon falling under the melee category.

Returns

boolean

True if the entity has been damaged by any melee weapon; otherwise, false.

Inherited from

Entity.hasBeenDamagedByAnyMeleeWeapon

Defined in

client/models/Entity.ts:549


hasBeenDamagedByAnyWeapon()

hasBeenDamagedByAnyWeapon(): boolean

Checks if the entity has been damaged by any weapon.

Returns

boolean

True if the entity has been damaged by any weapon; otherwise, false.

Inherited from

Entity.hasBeenDamagedByAnyWeapon

Defined in

client/models/Entity.ts:537


hasBeenDamagedByWeapon()

hasBeenDamagedByWeapon(weapon): boolean

Checks if the entity has been damaged by the specified weapon.

Parameters

weapon: WeaponsHash

The weapon to check against.

Returns

boolean

Inherited from

Entity.hasBeenDamagedByWeapon

Defined in

client/models/Entity.ts:528


hasClearLosToEntity()

hasClearLosToEntity(entity, traceType?): boolean

Checks if there is a clear line of sight to the specified entity.

Parameters

entity: Entity

The entity to check line of sight to.

traceType?: number = 17

The type of trace to use for the line of sight check.

Returns

boolean

Inherited from

Entity.hasClearLosToEntity

Defined in

client/models/Entity.ts:495


hasClearLosToEntityInFront()

hasClearLosToEntityInFront(entity): boolean

Determines if there is a clear line of sight (LOS) from the current entity to the specified entity in front.

Parameters

entity: Entity

The target entity to check LOS against.

Returns

boolean

Inherited from

Entity.hasClearLosToEntityInFront

Defined in

client/models/Entity.ts:506


isAttached()

isAttached(): boolean

Determines if the entity is currently attached.

Returns

boolean

True if the entity is attached, otherwise false.

Inherited from

Entity.isAttached

Defined in

client/models/Entity.ts:774


isAttachedTo()

isAttachedTo(entity): boolean

Checks whether the current entity is attached to the specified entity.

Parameters

entity: Entity

The entity to which the current entity might be attached.

Returns

boolean

True if the current entity is attached to the specified entity, false otherwise.

Inherited from

Entity.isAttachedTo

Defined in

client/models/Entity.ts:785


isInAngledArea()

isInAngledArea(origin, edge, angle): boolean

Determines if the entity is within an angled area specified by an origin point, an edge point, and an angle.

Parameters

origin: Vector3

The origin point of the angled area.

edge: Vector3

The edge point defining the angled area’s width.

angle: number

The angle of the area.

Returns

boolean

Inherited from

Entity.isInAngledArea

Defined in

client/models/Entity.ts:595


isInArea()

isInArea(minBounds, maxBounds): boolean

Checks if the current entity is within the specified area defined by the minimum and maximum bounds.

Parameters

minBounds: Vector3

A Vector3 object representing the minimum bounds of the area.

maxBounds: Vector3

A Vector3 object representing the maximum bounds of the area.

Returns

boolean

Inherited from

Entity.isInArea

Defined in

client/models/Entity.ts:570


isInRangeOf()

isInRangeOf(position, range): boolean

Determines whether a given position is within a specified range of this object’s position.

Parameters

position: Vector3

The position to check against this object’s position.

range: number

The range within which to check.

Returns

boolean

Returns true if the given position is within the specified range, otherwise false.

Inherited from

Entity.isInRangeOf

Defined in

client/models/Entity.ts:619


isNearEntity()

isNearEntity(entity, bounds): boolean

Checks if the current entity is near the specified entity within the given bounds.

Parameters

entity: Entity

The entity to check proximity against.

bounds: Vector3

The 3D vector specifying the bounds to check within.

Returns

boolean

Inherited from

Entity.isNearEntity

Defined in

client/models/Entity.ts:633


isTouching()

isTouching(entity): boolean

Checks if the current entity is touching the specified entity.

Parameters

entity: Entity

The entity to check against.

Returns

boolean

True if the current entity is touching the specified entity, otherwise false.

Inherited from

Entity.isTouching

Defined in

client/models/Entity.ts:653


isTouchingModel()

isTouchingModel(model): boolean

Checks if the current entity is touching the specified model.

Parameters

model: Model

The model to check against.

Returns

boolean

Inherited from

Entity.isTouchingModel

Defined in

client/models/Entity.ts:664


markAsNoLongerNeeded()

markAsNoLongerNeeded(): void

Marks the entity as no longer needed by the game, which allows the game engine to clean it up as necessary. This method effectively turns off the mission flag for the entity and informs the system that it can regard this entity as disposable.

Returns

void

No return value.

Inherited from

Entity.markAsNoLongerNeeded

Defined in

client/models/Entity.ts:899


removeAllParticleEffects()

removeAllParticleEffects(): void

Removes all particle effects from the entity associated with this instance.

Returns

void

This method does not return a value.

Inherited from

Entity.removeAllParticleEffects

Defined in

client/models/Entity.ts:866


resetOpacity()

resetOpacity(): void

Returns

void

Inherited from

Entity.resetOpacity

Defined in

client/models/Entity.ts:413


setNoCollision()

setNoCollision(entity, toggle): void

Sets the no-collision state between this entity and another entity.

Parameters

entity: Entity

The entity with which collision state will be set.

toggle: boolean

A boolean flag indicating whether to enable or disable the no-collision state.

Returns

void

Inherited from

Entity.setNoCollision

Defined in

client/models/Entity.ts:483


fromHandle()

static fromHandle(handle): Ped | Vehicle | Prop

Creates an instance of Ped, Vehicle, or Prop based on the given handle.

Parameters

handle: number

The handle of the entity.

Returns

Ped | Vehicle | Prop

Inherited from

Entity.fromHandle

Defined in

client/models/Entity.ts:910


fromNetworkId()

static fromNetworkId(networkId): Ped | Vehicle | Prop

Converts a network identifier to a corresponding entity (Ped, Vehicle, or Prop).

Parameters

networkId: number

The network identifier for the entity.

Returns

Ped | Vehicle | Prop

Inherited from

Entity.fromNetworkId

Defined in

client/models/Entity.ts:929


getClassDisplayName()

static getClassDisplayName(vehicleClass): string

Returns a formatted string representing the display name of the vehicle class.

Parameters

vehicleClass: VehicleClass

The enumeration value representing the class of the vehicle.

Returns

string

The formatted display name of the vehicle class.

Defined in

client/models/Vehicle.ts:41


getModelClass()

static getModelClass(vehicleModel): VehicleClass

Retrieves the vehicle class associated with a given vehicle model.

Parameters

vehicleModel: Model

The model of the vehicle for which to retrieve the class.

Returns

VehicleClass

The class of the specified vehicle model.

Defined in

client/models/Vehicle.ts:51


getModelDisplayName()

static getModelDisplayName(vehicleModel): string

Retrieves the display name for a given vehicle model.

Parameters

vehicleModel: Model

The model of the vehicle for which the display name is to be retrieved.

Returns

string

The display name of the vehicle model.

Defined in

client/models/Vehicle.ts:61