rcar $car = get local car
rcar $localcar = get local car
float $finalbrake
float $corrected_braking
int $gear
float $brake
int $fam = 1
int $urgence = 50
int $compteur
float $speed
shared int $hazon
while 1
{
	if $car == $localcar
	{
		$gear = get $car gear
		$speed=get $car tachovelocity
		$brake = get $car brake
		if $brake > 0.30 and $gear > 3
		{
			$compteur++
			if $compteur < $urgence and $brake > 0.60
			{
				$finalbrake+=0.10
				$hazon = 1
			}
		}
		else
		{
			$compteur = 0
			$finalbrake = 0.0
		}
		$corrected_braking = $brake + $finalbrake
		if $corrected_braking > 1.0
		{
			$corrected_braking = 1.0
		}
		set $car brake $corrected_braking
	}
	interrupt
}
		
	