Skip to main content

Entity::dist

Server-side function

Gets the distance between two entities

Syntax​

entity.dist(position)

Required Arguments​

  • position: Vector3

Example​

Gets the distance between a player and a vehicle

Server-Side

let distVeh = mp.vehicles.new(mp.joaat('turismor'), new mp.Vector3(-423.88, 1128.86, 326));
mp.events.addCommand('dist', (player) => {
let dist = player.dist(distVeh.position);
player.outputChatBox(`Distance: ${dist}`)
});