NeXuS™ Posted January 16, 2016 Posted January 16, 2016 Hey. I want to make a scene with a car, which is a taxi. I use setPedControlState to control it to the positions, but it sometimes goes longer, sometimes goes shorter. So, its little bit buggy. Is there any other way to do it? local scene2 = createVehicle(420, 1947.1982421875, -1749.4130859375, 13.3828125, 0, 0, 90) local scene2sofor = createPed(255, 0, 0, 0) warpPedIntoVehicle(bemutatoPed, scene2, 2) warpPedIntoVehicle(scene2sofor, scene2) setTimer(function() setPedControlState(scene2sofor, "accelerate", true) setTimer(setPedControlState, 4500, 1, scene2sofor, "accelerate", false) setTimer(setPedControlState, 6000, 1, scene2sofor, "handbrake", true) end, 1500, 1)
tosfera Posted January 16, 2016 Posted January 16, 2016 The way you're doing it currently is the way to go for the most realistic way, you just need to work on the timings. 2 timers isn't going to make your entire scene completely. You should add some distance checks, position checks, here and there a few variables holding states and so on.
NeXuS™ Posted January 16, 2016 Author Posted January 16, 2016 I just did the timing already. But 5 out of 10 gets to x, 2 out of 10 gets x-2... etc.. What do you mean on position check? if x > xmax then setPedControlState(ped, "brake_reverse", true) end or like that? Its a scene for register new account, so it cant be done that way. Maybe there are some settings that make the car always the right speed?
Addlibs Posted January 16, 2016 Posted January 16, 2016 Make a position check on regular (e.g. every 50ms on timer) or irregular (but frequent) (e.g. onClientRender - but that may be too much for some CPUs) intervals. You can't always rely on having something run by one and only one function.
Army@1 Posted January 16, 2016 Posted January 16, 2016 If you want the vehicle to move with a constant speed then the following resource can help you. https://community.multitheftauto.com/ind ... ils&id=989 (cruisecontrol2 -- Varez/dzek)
NeXuS™ Posted January 16, 2016 Author Posted January 16, 2016 The way you're doing it currently is the way to go for the most realistic way, you just need to work on the timings. 2 timers isn't going to make your entire scene completely. You should add some distance checks, position checks, here and there a few variables holding states and so on. Thanks, used your suggestion, and it was working. It is still buggy, but works fine. https://www.youtube.com/watch?v=Fo12yK8ymac
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