Перейти к содержанию

RAGE.Game.Pathfind.GetStreetNameAtCoord

Материал из RAGE MP Wiki Archive
Версия от 10:26, 5 мая 2020; imported>MisterJ
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

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 as int to the name of the street the coords are on
crossingRoad - if the coordinates are on an intersection, a hash as int to the name of the crossing road

Note: The names are returned as hash as int, the strings can be returned using the function RAGE.Game.Ui.GetStreetNameFromHashKey((uint) hash as int).

Syntax

<syntaxhighlight lang="c#">RAGE.Game.Pathfind.GetStreetNameAtCoord(x, y, z, ref streetName, ref crossingRoad);</syntaxhighlight>

Required Arguments

  • x: float
  • y: float
  • z: float
  • streetName: ref int
  • crossingRoad: ref int

Return value

  • hash as int: streetName, crossingRoad

Example

<syntaxhighlight lang="c#"> // Clientside public string GetActualStreetName() {

   var local = RAGE.Elements.Player.LocalPlayer;
   var tempStreetName = 0;
   var tempCrossingRoad = 0;
   var tempResult = string.Empty;
   RAGE.Game.Pathfind.GetStreetNameAtCoord(local.Position.X, local.Position.Y, local.Position.Z, ref tempStreetName, ref tempCrossingRoad);
   if (tempStreetName != 0)
   {
       tempResult = RAGE.Game.Ui.GetStreetNameFromHashKey((uint) tempStreetName);
   }
   if (tempCrossingRoad != 0)
   {
       tempResult = Ui.GetStreetNameFromHashKey((uint) tempCrossingRoad);
   }
   return tempResult;

} </syntaxhighlight>

If you want the real streetname you have to use: https://wiki.rage.mp/index.php?title=RAGE.Game.Ui.GetStreetNameFromHashKey