Jump to content

ped taskEnterVehicle


Ivanleviathan

Recommended Posts

Hello everyone.

I am writing a script for a taxi with a peds. 

So, player reaches a marker -> ped enter vehicle on passenger seat -> you got new marker -> reach this marker -> ped leaving car and dissapers after timeout.
 

Trouble fires when ped trying to enter vehicle on passenger seat. Ped startring to move in place, and after timeout ped is already in car, without animations of car door opening and e.t.c...
Have this code.

function pickUpPassenger(){
	let interval = setInterval(function(){
		if(player.vehicle){
			ped.taskEnterVehicle(player.vehicle.handle, 5000, 0, 1, 1, 0);
			clearInterval(interval);
			setTimeout(function(){
				mp.events.call('passengerSit');
			}, 5000);
		}
	}, 1000);
}

"ped" variable is global, so ped object always ok.

 

Link to comment
Share on other sites

26 минут назад, Stefan Mentosan сказал:

try a larger timeout on taskEnterVehicle

 

function pickUpPassenger(){
	missionStatus = 2;
	let interval = setInterval(function(){
		if(player.vehicle){
			ped.taskEnterVehicle(player.vehicle.handle, 50000, 0, 1, 1, 0);
			clearInterval(interval);
			setTimeout(function(){
				mp.events.call('passengerSit');
			}, 50000);
		}
	}, 1000);
}

same

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...