[Need Help] Issue with "TaskVehiclePark()" and "GetIsTaskActive()"

Hi everyone! I’m having a bit of a struggle :sweat_smile: I saw an other topic discussing about GetIsTaskActive() for “TaskVehiclePark()” and “TaskVehicleDriveToCoord()” and I’m trying to make a function so a bus can come near the player, park, and if the bus is park then the player can enter the bus… But I ran in two issues:

  1. The bus really want to park ON the player not NEAR so every time he crush the player :frowning:
  2. I can’t seem to be able to tell the Task to wait for the bus to be stopped for the player being asked to enter it

Here’s the function:

function GoToPlayerStop(x, y, z, bus, driver, bushash)
	player = GetPlayerPed(-1)

	TaskVehicleDriveToCoord(driver, bus, x, y, z, 17.0, 0, bushash, drivingStyle, 1, true)
	TaskVehiclePark(driver, bus, x, y, z, 5.28, 0, 60.0, true)
		while (GetIsTaskActive(driver, 12)) do
			Wait(100)
  		end
	TaskEnterVehicle(player, bus, -1, 0, 1.0, 1, 0)
end

Thanks for any help you can gave :heart:
Have a great day (As you can saw my first language ain’t English and I’m still a beginner in coding…)

Maybe I should mentioned the one who get the solution for the other topic… (@TheIndra)

If you can help that will be greatly appreciated :heart:

Hey :slightly_smiling_face: !
I add a similar issue when I worked on my Valet script, the NPC bringing the car was always running over me x).
To solve that, I played with the args of the natives that define a stop radius :

TaskVehicleDriveToCoord(
	ped --[[ Ped ]], 
	vehicle --[[ Vehicle ]], 
	x --[[ number ]], 
	y --[[ number ]], 
	z --[[ number ]], 
	speed --[[ number ]], 
	p6 --[[ Any ]], 
	vehicleModel --[[ Hash ]], 
	drivingMode --[[ integer ]], 
	stopRange --[[ number ]], --THIS ONE
	p10 --[[ number ]]
)

TaskVehiclePark(
	ped --[[ Ped ]], 
	vehicle --[[ Vehicle ]], 
	x --[[ number ]], 
	y --[[ number ]], 
	z --[[ number ]], 
	heading --[[ number ]], 
	mode --[[ integer ]], 
	radius --[[ number ]],  -- AND THIS ONE
	keepEngineOn --[[ boolean ]]
)

It requires a good amount of testing, but in the end you might be able to get it to stop where you want.


1 Like