SA-MP Forums Archive
Prevent a car from braking? (decelerate) (Stopping, not breaking). - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Prevent a car from braking? (decelerate) (Stopping, not breaking). (/showthread.php?tid=580139)



Prevent a car from braking? (decelerate) (Stopping, not breaking). - Dokins - 02.07.2015

Title says all,

is it possible, if so, how?


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Lynn - 02.07.2015

As far as I know it's only possible to prevent a vehicle from gaining speed.
At this time I do not believe it's possible to prevent a vehicle from reducing it's speed.
There are ways to make a vehicle maintain it's speed, but it can be over run by pressing the brake.


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Banana_Ghost - 02.07.2015

Use SetVehicleVelocity and detect when they hit their braking key (whether it be their Spacebar or S by default).


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Sime30 - 02.07.2015

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
Use SetVehicleVelocity and detect when they hit their braking key (whether it be their Spacebar or S by default).
Not sure if that would work, but if it does you will have some sort of "not smooth driving". Car stopping for a sec, then accelerating. That will look awkward


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Banana_Ghost - 02.07.2015

Quote:
Originally Posted by Sime30
Посмотреть сообщение
Not sure if that would work, but if it does you will have some sort of "not smooth driving". Car stopping for a sec, then accelerating. That will look awkward
It'll work to serve it's purpose (it will look awkward though).


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Dokins - 02.07.2015

I was hoping to detect when they press 'S' or the decelerate key.


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Lynn - 02.07.2015

Quote:
Originally Posted by Dokins
Посмотреть сообщение
I was hoping to detect when they press 'S' or the decelerate key.
The only solution is the one listed above, though it'll be very glitched and look bad which is why I didn't suggest doing it.


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Dokins - 02.07.2015

I was hoping something like, if they press 's' nothing happens? or their decelerate key.


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - rymax99 - 03.07.2015

Turn the engine off using SetVehicleParamsEx (https://sampwiki.blast.hk/wiki/SetVehicleParamsEx). That will of course prevent accelaration as well.


Re: Prevent a car from braking? (decelerate) (Stopping, not breaking). - Lynn - 03.07.2015

Quote:
Originally Posted by Dokins
Посмотреть сообщение
I was hoping something like, if they press 's' nothing happens? or their decelerate key.
Nope, there is no way to bypass it.
I do have an idea though, I will test it out then post the code here if it works.

Quote:
Originally Posted by rymax99
Посмотреть сообщение
Turn the engine off using SetVehicleParamsEx (https://sampwiki.blast.hk/wiki/SetVehicleParamsEx). That will of course prevent accelaration as well.
This will make it decelerate as-well, as the engine is off.