Ivanleviathan Posted January 28, 2021 Posted January 28, 2021 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.
Stefan Mentosan Posted January 28, 2021 Posted January 28, 2021 try a larger timeout on taskEnterVehicle
Ivanleviathan Posted January 28, 2021 Author Posted January 28, 2021 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
Ivanleviathan Posted January 30, 2021 Author Posted January 30, 2021 so, fixed it. U need to init ped at server-side.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now