RAGE.Game.Pathfind.GetStreetNameAtCoord

From RAGE Multiplayer Wiki
Revision as of 10:16, 5 May 2020 by MisterJ (talk | contribs)

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

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

Syntax

RAGE.Game.Pathfind.GetStreetNameAtCoord(x, y, z, ref streetName, ref crossingName);

Required Arguments

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

Return value

  • int: streetName, crossingRoad

Example

// Clientside
public string GetActualStreetName()
{
    var local = RAGE.Elements.Player.LocalPlayer;
    var tempStreetName = 0;
    var tempCrossingName = 0;
    var tempResult = string.Empty;

    RAGE.Game.Pathfind.GetStreetNameAtCoord(local.Position.X, local.Position.Y, local.Position.Z, ref tempStreetName, ref tempCrossingName);

    if (tempStreetName != 0)
    {
        tempResult = RAGE.Game.Ui.GetStreetNameFromHashKey((uint) tempStreetName);
    }
    if (tempCrossingName != 0)
    {
        tempResult = RAGE.Game.Ui.GetStreetNameFromHashKey((uint) tempCrossingName);
    }

    return tempResult;
}

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