RAGE.Game.Pathfind.GetStreetNameAtCoord: Difference between revisions
No edit summary |
No edit summary |
||
| 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 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). | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="c#">RAGE.Game.Pathfind.GetStreetNameAtCoord(x, y, z, ref streetName, ref | <syntaxhighlight lang="c#">RAGE.Game.Pathfind.GetStreetNameAtCoord(x, y, z, ref streetName, ref crossingRoad);</syntaxhighlight> | ||
=== Required Arguments === | === Required Arguments === | ||
*'''x:''' float | *'''x:''' float | ||
| Line 17: | Line 17: | ||
var local = RAGE.Elements.Player.LocalPlayer; | var local = RAGE.Elements.Player.LocalPlayer; | ||
var tempStreetName = 0; | var tempStreetName = 0; | ||
var | 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 | 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 ( | if (tempCrossingRoad != 0) | ||
{ | { | ||
tempResult = | tempResult = Ui.GetStreetNameFromHashKey((uint) tempCrossingRoad); | ||
} | } | ||
Revision as of 10:21, 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 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 crossingRoad);
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 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