Pathfind::getStreetNameAtCoord: Difference between revisions

From RAGE Multiplayer Wiki
Line 13: Line 13:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// Clientside
// Clientside
  const localPlayer = mp.players.local;  
const localPlayer = mp.players.local;  


  let getStreet = mp.game.pathfind.getStreetNameAtCoord(localPlayer.position.x, localPlayer.position.y, localPlayer.position.z, 0, 0);
let getStreet = mp.game.pathfind.getStreetNameAtCoord(localPlayer.position.x, localPlayer.position.y, localPlayer.position.z, 0, 0);
// Returns streetname as hashes of the position from the local player
// Returns streetname as hashes of the position from the local player
</syntaxhighlight>
</syntaxhighlight>

Revision as of 08:17, 17 November 2017

Determines the name of the street which is the closest to the given coordinates.

x,y,z - the coordinates of the street
streetName - returns a hash to the name of the street the coords are on
crossingRoad - if the coordinates are on an intersection, a hash to the name of the crossing road

Note: the names are returned as hashes, the strings can be returned using the function UI::GET_STREET_NAME_FROM_HASH_KEY.

Syntax

mp.game.pathfind.getStreetNameAtCoord(x, y, z, streetName, crossingRoad);

Required Arguments

  • x: float
  • y: float
  • z: float
  • streetName: Hash
  • crossingRoad: Hash

Return value

  • object: streetName, crossingRoad

Example

// Clientside
const localPlayer = mp.players.local; 

let getStreet = mp.game.pathfind.getStreetNameAtCoord(localPlayer.position.x, localPlayer.position.y, localPlayer.position.z, 0, 0);
// Returns streetname as hashes of the position from the local player

Credits to Splak

See also

Template:Pathfind s function c