RAGE.Game.Pathfind.GetStreetNameAtCoord: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Determines the name of the street which is the closest to the given coordinates.<br><br>x,y,z - the coordinates of the street<br>streetName - returns a int to the name of the street the coords are on<br>crossingRoad - if the coordinates are on an intersection, a int to the name of the crossing road<br><br>Note: the names are returned as int, the strings can be returned using the function RAGE.Game.Ui.GetStreetNameFromHashKey((uint) int).
Determines the name of the street which is the closest to the given coordinates.<br><br>x,y,z - the coordinates of the street<br>streetName - returns a hash as int to the name of the street the coords are on<br>crossingRoad - if the coordinates are on an intersection, a hash as int to the name of the crossing road<br><br>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==
==Syntax==
<syntaxhighlight lang="c#">RAGE.Game.Pathfind.GetStreetNameAtCoord(x, y, z, ref streetName, ref crossingName);</syntaxhighlight>
<syntaxhighlight lang="c#">RAGE.Game.Pathfind.GetStreetNameAtCoord(x, y, z, ref streetName, ref crossingRoad);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''x:''' float
*'''x:''' float
Line 9: Line 9:
*'''crossingRoad:''' ref int
*'''crossingRoad:''' ref int
===Return value===
===Return value===
*'''int:''' streetName, crossingRoad
*'''hash as int:''' streetName, crossingRoad
==Example==
==Example==
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 17: Line 17:
     var local = RAGE.Elements.Player.LocalPlayer;
     var local = RAGE.Elements.Player.LocalPlayer;
     var tempStreetName = 0;
     var tempStreetName = 0;
     var tempCrossingName = 0;
     var tempCrossingRoad = 0;
     var tempResult = string.Empty;
     var tempResult = string.Empty;


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


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



Latest revision as of 10:26, 5 May 2020

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

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

Required Arguments

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

Return value

  • hash as int: streetName, crossingRoad

Example

// 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;
}

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