ABS Braking System Script help
#1

I am trying to create a ABS System for Vehicles like

When i press the buttom Brake(S) less then 3 seconds the car will break normaly
but when i hold the Brake(S) more then 3 seconds the car will use ABS like it will Brake and stop and brake in a fast time but i don't know how to code it. Can someone help?

i know that this section is the right one

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
Reply
#2

I have personally never attempted something like this however using vehicle velocity you should be able to do this, along with OnPlayerKeyStateChange.
Reply
#3

"using vehicle velocity"
i only want a simple thing like how i explained it nothing with velocity just with holding the brake key but i have no clue how to script it
Reply
#4

Try this function

Код:
stock SetVehicleSpeed(vehicleid, Float:speed)
{
	new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:a;
	GetVehicleVelocity(vehicleid, x1, y1, z1);
	GetVehiclePos(vehicleid, x2, y2, z2);
	GetVehicleZAngle(vehicleid, a); a = 360 - a;
	x1 = (floatsin(a, degrees) * (speed/100) + floatcos(a, degrees) * 0 + x2) - x2;
	y1 = (floatcos(a, degrees) * (speed/100) + floatsin(a, degrees) * 0 + y2) - y2;
	SetVehicleVelocity(vehicleid, x1, y1, z1);
}
from
https://sampforum.blast.hk/showthread.php?tid=307052
Reply
#5

Quote:
Originally Posted by BrightLeaN
Посмотреть сообщение
"using vehicle velocity"
i only want a simple thing like how i explained it nothing with velocity just with holding the brake key but i have no clue how to script it
If you don't want to "use velocity", then it will not be possible to script it as you "explained". What the other user meant, is that you will need to create a callback for when the brake key is pressed/held (your preference), and in that callback you should lower the velocity of the vehicle manually. This can all be found in the wiki. If that's too much work for you, then you should consider hiring a scripter or just give up since you don't want to put in any effort.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)