Entity::dist

From RAGE Multiplayer Wiki

Server-Side
Function

 JavaScript



Gets the distance between two entities

JavaScript Syntax


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}`)
});


See also