How to use GetClosestRoad

Hello I try any solutions to resolve my problem but all solutions didn’t work :confused:

My problem is that my TriggerServerEvent (‘GetIDPlayer’) is in a loop that returns a TriggerServerEvent with a drawtxt. The trick is that I feel like I have an epileptic seizure with the message blinking every 0.0000001 seconds. It’s horrible :3 So the solution is to use that code and it doesn’t works. An idea to solve my problem? :smiley:

local pos = GetEntityCoords(GetPlayerPed(-1)) local rped = GetClosestPed(pos['x'], pos['y'], pos['z'], 5.0,1,1,0) if DoesEntityExist(rped) then TriggerServerEvent('GetIDPlayer') end

Best Regards,
Proxene

I’m trying to use GetClosestRoad and found your thread name relevant but its content is not.

// 0x132F52BBA570FE92 0x567B0E11
Any GET_CLOSEST_ROAD(float x, float y, float z, float p3, int p4, Vector3* p5, Vector3* p6, Any* p7, Any* p8, float* p9, BOOL p10);
p1 seems to be always 1.0f in the scripts

So I tried this:

local pos1=GetEntityCoords(GetPlayerPed(-1))
local pos2=GetEntityCoords(GetPlayerPed(-1))
local p7=.0
local p8=.0
local p9=.0
GetClosestRoad(pos1.x,pos1.y,pos1.z, 1000.0, 0, Citizen.PointerValueVector(pos1), Citizen.PointerValueVector(pos2),Citizen.PointerValueFloat(p7), Citizen.PointerValueFloat(p8), Citizen.PointerValueFloat(p9), false);

What am I doing wrong?

The question is still in the air. Tried a lot of options, no luck to get coordinates.

You use it like this:

local iThinkThisIsABool, street1, street2 = GetClosestRoad(X, Y, Z, 1.0, 1, false) -- values found here: http://gtaforums.com/topic/717612-v-scriptnative-documentation-and-research/?p=1067461488

street1 and 2 are vectors for the roads.

Doesn’t work for me strangely enough.

local pedcoords = GetEntityCoords(GetPlayerPed(-1))
local iThinkThisIsABool, street1, street2 = GetClosestRoad(pedcoords.x, pedcoords.y, pedcoords.z, 1.0, 1, false)

Gives me execution error

[  19347016] InvokeNative: execution failed: Error executing native 0x132f52bba570fe92 at address 0x1414ed589.
[  19347031] Error resuming coroutine: Execution of native 132f52bba570fe92 in script host failed.
[  19347031] stack traceback:
[  19347031] 	[C]: in upvalue '_in'
[  19347031] 	citizen:/scripting/lua/natives_21e43a33.lua:2170: in function 'GetClosestRoad'

Works for me (latest client):

http://tgrhavoc.me/fuck_you/slut/5dIXSnYJAZQsPn17i5DxO0Tgm.png

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(10)
		
		local pos = GetEntityCoords(PlayerPedId())
		local b, s, s1 = GetClosestRoad(pos.x, pos.y, pos.z, 1.0, 1, false)
		
		print(string.format("b=%s\ns=%.2f, %.2f, %.2f\ns1=%.2f, %.2f, %.2f",
				tostring(b), s.x, s.y, s.z, s1.x,s1.y,s1.z))		
	end
end)

Your code gives me exact error. Latest client, having no idea what is going on.

The only thing I can think of is, you’re not using the correct manifest version.

I’m using 44febabe-d386-4d18-afbe-5e627f4af937

Nope, it is

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'