Jump to content

Create a scene


NeXuS™

Recommended Posts

Posted

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) 
  

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

Posted

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.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

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?

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

Posted

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.

Previously known as MrTasty.

Posted
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

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

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...