[HELP] Add speed for vehicle

Hello world!

I Just trying to add more speed for vehicle using this function “SetVehicleForwardSpeed” I can stop vehicle using this function but I can’t set more speed for vehicle, I will give an example to clear the idea for you, When I enter the car and apply the function with replace speed parameter to 120, the vehicle is stops like when press the break button, not do accelerate for engine so I think it’s a bug in this function, Any solution or suggestions for this case?

Thanks
Test_Anything.

It is working for me…

This is a Snippet from a Code of mine:

if IsControlPressed(1, 71) and IsControlPressed(1, 86) then --Accelerate Forward and Horn
	SetVehicleBoostActive(playerVeh, 1, 0) --Boost Sound
	SetVehicleForwardSpeed(playerVeh, 75.0) --Forward Speed
	StartScreenEffect("RaceTurbo", 0, 0) --Screen Effect
elseif IsControlPressed(1, 72) and IsControlPressed(1, 86) then  --Accelerate Backward and Horn
	SetVehicleBoostActive(playerVeh, 1, 0) --Boost Sound
	SetVehicleForwardSpeed(playerVeh, -75.0) --Backward Speed
end
SetVehicleBoostActive(playerVeh, 0, 0)

It is important to use float Values (x.x) and not int (x), otherwise it won’t work.

4 Likes

Nice, you solve the issue but I have another question
When apply this function with change rotation of the vehicle it’s will back the rotation of vehicle and make forward speed for it, To make the case clear for you… Try to drift in vehicle and apply the function It’s will change the rotation of the vehicle and adds forward speed
solution or suggestions for this case?

Regards,
Test_Anything.

The Problem is, that this native just boost the car forward or backward. The heading gets locked to the heading the vehicle had, when starting the boost. You could combine this with another native (SetEntityHeading) or use another native than this one.

Any example for use this function with vehicles to do this idea? I can’t understand it as well.