Difference between revisions of "Entity::dist"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
 
{{ServersideJsFunction}}
 
{{ServersideJsFunction}}
 
Gets the distance between two entities
 
Gets the distance between two entities
 +
 +
{{JSContainer|
  
 
==Syntax==
 
==Syntax==
Line 18: Line 20:
 
});
 
});
 
</pre>
 
</pre>
 +
}}
 
}}
 
}}
  

Latest revision as of 12:25, 2 December 2019

Server-Side
Function

Js.png JavaScript



Gets the distance between two entities

JavaScript Syntax
Jslogo.png


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