Skip to content

Player

@vimp-mp/types 2.0.1

Interface · Client API

Player known to this client. Local players and streamed remote players expose a live GTA ped handle; non-streamed remotes keep handle = 0 and mutation methods degrade to no-ops until they stream in.

Stream-synced meta methods are class-level shortcuts that bind type = Player and this.id implicitly — they're equivalent to vimp.entities.getStreamSyncedMeta(ENTITY_TYPE.Player, this.id, key).

ts
interface Player

Members

alpha

ts
readonly alpha: number

Current entity opacity.

forwardVector

ts
readonly forwardVector: Vec3

Current forward direction vector.

handle

ts
readonly handle: number

GTA ped/entity handle, or 0 when a remote player is not streamed.

heading

ts
readonly heading: number

Current heading in degrees.

id

ts
readonly id: number

Server/network player identifier.

isLocal

ts
readonly isLocal: boolean

Whether this wrapper represents the local player.

isStreamed

ts
readonly isStreamed: boolean

Whether the player's GTA ped is currently streamed.

isTalking

ts
readonly isTalking: boolean

Whether the player is currently transmitting voice audio.

model

ts
readonly model: number

Current ped model hash.

name

ts
readonly name: string

Current display name.

position

ts
readonly position: Vec3

Current world position.

rotation

ts
readonly rotation: Vec3

Current world rotation in degrees.

socialClub

ts
readonly socialClub: string

Social Club account name reported for the player.

vehicle

ts
readonly vehicle: Vehicle | null

Vehicle the player is currently sitting in, or null when the player is on foot, still playing the entry animation, not streamed, or sitting in a vehicle VIMP does not track.

attachToEntity

ts
attachToEntity(target: { handle: number }, boneIndex: number, offset: Vec3, rotation: Vec3, p9: boolean, useSoftPinning: boolean, collision: boolean, isPed: boolean, vertexIndex: number, fixedRot: boolean): void

Attaches the player ped to another GTA entity.

clearDecorations

ts
clearDecorations(): void

Removes all decorations from the player ped.

clearProp

ts
clearProp(componentId: number): void

Clears the prop equipped in the specified component slot.

clearTasks

ts
clearTasks(): void

Clears queued tasks on the player ped.

clearTasksImmediately

ts
clearTasksImmediately(): void

Immediately clears all tasks on the player ped.

detach

ts
detach(useDetachVelocity: boolean, collision: boolean): void

Detaches the player ped from its current parent entity.

freezePosition

ts
freezePosition(freeze: boolean): void

Freezes or unfreezes the player's current position.

getBoneCoords

ts
getBoneCoords(boneId: number, offsetX: number, offsetY: number, offsetZ: number): Vec3

Returns a ped bone's world coordinates with an optional local offset.

getBoneIndex

ts
getBoneIndex(boneId: number): number

Resolves a GTA ped bone ID to its runtime bone index.

getBoneIndexByName

ts
getBoneIndexByName(boneName: string): number

Resolves a named bone on the streamed player ped, or returns -1.

getComponentDrawable

ts
getComponentDrawable(componentId: number): number

Returns the active drawable for a clothing component.

getComponentTexture

ts
getComponentTexture(componentId: number): number

Returns the active texture for a clothing component.

getOffsetFromInWorldCoords

ts
getOffsetFromInWorldCoords(offsetX: number, offsetY: number, offsetZ: number): Vec3

Converts a player-local offset into world coordinates.

getPropDrawable

ts
getPropDrawable(propId: number): number

Returns the active drawable for a prop slot.

getPropTexture

ts
getPropTexture(propId: number): number

Returns the active texture for a prop slot.

getSpeed

ts
getSpeed(): number

Returns the streamed player ped's current speed in metres per second.

getStreamSyncedMeta

ts
getStreamSyncedMeta<T = unknown>(key: string): T | undefined

Reads a stream-synced value, or undefined when the key is unavailable.

getStreamSyncedMetaKeys

ts
getStreamSyncedMetaKeys(): Array<string>

Lists the stream-synced keys currently cached for this player.

getWorldPositionOfBone

ts
getWorldPositionOfBone(boneIndex: number): Vec3

Returns the world position of a bone on the streamed player ped.

hasStreamSyncedMeta

ts
hasStreamSyncedMeta(key: string): boolean

Reports whether the player currently exposes a stream-synced key.

isPlayingAnim

ts
isPlayingAnim(dictionary: string, name: string, taskFlag: number): boolean

Reports whether the streamed player ped is playing an animation.

removeDecoration

ts
removeDecoration(collection: string | number, overlay: string | number): void

VIMP currently has no native for removing one decoration; this is a no-op.

resetAlpha

ts
resetAlpha(): void

Restores the player's default opacity.

setAlpha

ts
setAlpha(alpha: number): void

Changes the streamed player ped's opacity.

setCollision

ts
setCollision(collision: boolean, keepPhysics: boolean): void

Enables or disables collision for the streamed player ped.

setComponentVariation

ts
setComponentVariation(componentId: number, drawableId: number, textureId: number, paletteId: number): void

Changes a clothing component drawable, texture and palette.

setCoords

ts
setCoords(xPos: number, yPos: number, zPos: number, xAxis: boolean, yAxis: boolean, zAxis: boolean, clearArea: boolean): void

Moves the streamed player ped using GTA's axis and area-clear flags.

setDecoration

ts
setDecoration(collection: string | number, overlay: string | number): void

Applies a tattoo or decoration overlay to the player ped.

setEyeColor

ts
setEyeColor(eyeColor: number): void

Changes the player ped's eye-colour index.

setFaceFeature

ts
setFaceFeature(index: number, value: number): void

Sets one GTA face-feature morph value.

setHairColor

ts
setHairColor(colorId: number, highlightColorId: number): void

Changes the player ped's base and highlight hair colours.

setHeadBlendData

ts
setHeadBlendData(shapeFirstId: number, shapeSecondId: number, shapeThirdId: number, skinFirstId: number, skinSecondId: number, skinThirdId: number, shapeMix: number, skinMix: number, thirdMix: number, isParent: boolean): void

Applies GTA freemode head-blend ancestry and mix values.

setHeading

ts
setHeading(heading: number): void

Changes the streamed player ped's heading in degrees.

setHeadOverlay

ts
setHeadOverlay(overlayId: number, index: number, opacity: number): void

Applies a head overlay and opacity to the player ped.

setHeadOverlayColor

ts
setHeadOverlayColor(overlayId: number, colorTypeId: number, firstColor: number, secondColor: number): void

Applies palette colours to a player head overlay.

setInvincible

ts
setInvincible(invincible: boolean): void

Enables or disables damage for the streamed player ped.

setModel

ts
setModel(model: string | number): void

Replaces the player's streamed ped model using a hash or model name.

setNoCollision

ts
setNoCollision(otherHandle: number, thisFrameOnly: boolean): void

Suppresses collision with another GTA entity for this frame or persistently.

setPosition

ts
setPosition(position: Vec3): void

Moves the streamed player ped to a world position without an offset.

setPropertyVariation

ts
setPropertyVariation(componentId: number, drawableId: number, textureId: number, attach: boolean): void

Changes an attached prop drawable and texture.

setRotation

ts
setRotation(rotation: Vec3): void

Changes the streamed player ped's rotation in degrees.

setVisible

ts
setVisible(visible: boolean): void

Shows or hides the streamed player ped.

stopAnim

ts
stopAnim(dictionary: string, name: string, blendOutSpeed: number): void

Stops the specified animation on the player ped.

taskEnterVehicle

ts
taskEnterVehicle(vehicleHandle: number, timeout: number, seat: number, speed: number, flag: number, overrideEntryClipsetName?: string): void

Instructs the player ped to enter a GTA vehicle.

taskPlayAnim

ts
taskPlayAnim(dictionary: string, name: string, blendInSpeed: number, blendOutSpeed: number, duration: number, flag: number, playbackRate: number, lockX?: boolean, lockY?: boolean, lockZ?: boolean): void

Starts an animation task on the player ped.

taskSwapWeapon

ts
taskSwapWeapon(drawWeapon?: boolean): void

Instructs the player ped to draw or holster its weapon.

VIMP developer documentation