Im a newbe in C# and to learn it, i started to convert my Lua-Scripts into C#.
I started with my vehicle HUD, where i have a problem and totaly stuck:
I found the method “World.GetStreetName()” to get the name of the street for given Vector3 coords.
Unfortunately it gives me only the name of the current street and not the name of a crossing street like the native function “GET_STREET_NAME_AT_COORD”.
local streetA, streetB = Citizen.InvokeNative(0x2EB41072B4C1E4C0, coords.x, coords.y, coords.z, Citizen.PointerValueInt(), Citizen.PointerValueInt())
I tried to use the native function, but totaly failed because i don’t understand how to use it if the return is “void”.
Stupid code, i know, but atleast i tried.
Is there some sort of documentation/tutorial/examples?
int streetHash1 = 0;
int streetHash2 = 0;
Function.Call(Hash.GET_STREET_NAME_FROM_HASH_KEY, coords.X, coords.Y, coords.Z, out streetHash1, out streetHash2);
With this i get the following error:
Argument 5 may not be passed with the ‘out’ keyword
Argument 6 may not be passed with the ‘out’ keyword
private static Tuple<string, string> getStreetNameFromCoords(Vector3 coords)
{
var streetHash1Pointer = new OutputArgument();
var streetHash2Pointer = new OutputArgument();
Function.Call(Hash.GET_STREET_NAME_FROM_HASH_KEY, coords.X, coords.Y, coords.Z, streetHash1Pointer, streetHash2Pointer);
int streetHash1 = streetHash1Pointer.GetResult<int>();
int streetHash2 = streetHash2Pointer.GetResult<int>();
//return new Tuple<string, string>(streetHash1.ToString(), streetHash2.ToString());
string streetName1 = Function.Call<string>(Hash.GET_STREET_NAME_FROM_HASH_KEY, streetHash1);
if (streetHash2 != 0 && streetHash2 != streetHash1)
{
string streetName2 = Function.Call<string>(Hash.GET_STREET_NAME_FROM_HASH_KEY, streetHash2);
return new Tuple<string, string>(streetName1, streetName2);
}
return new Tuple<string, string>(streetName1, streetName1);
}
With this i get on each tick (same pos) a different value at “streetHash1Pointer” and “streetHash2Pointer” (e.g. pic top left corner).
The “GET_STREET_NAME_FROM_HASH_KEY” function dosen’t return with this values either.