You could check to see if the brake key is being pressed and if so change a variable that shuts down the velocity part.
Brake key for me is "S"
save as init.sqf
Code:
disableSerialization;
sleep 1;
brake = 0;
_display = (findDisplay 46);
_display displayAddEventHandler ["KeyDown","if ((_this select 1) == 31) then {brake = 1} else {brake = 0}"];
modified code to check for the brake variable.
Code:
#define SPEEDX 0.1
quit_this = true;
while {quit_this} do {
sleep 0.001;
if (vehicle player != player) then {
_veh = vehicle player;
if (speed _veh > 20 and brake == 0 ) then {
_vel = velocity _veh;
_dir = getdir _veh;
_veh setvelocity [
(((_vel select 0) + SPEEDX * (sin _dir)) min 200) max -200,
(((_vel select 1) + SPEEDX * (cos _dir)) min 200) max -200,
(_vel select 2) - SPEEDX
];
};
};
};
also included is a variable named quit_this, if you now place this in a trigger and set it to false it should end the script