inCar = 0
speed = 0
maxSpeed = 1000.0
turnSpeed = 250
waitForKeyRelease = 0

function car_init(e)

end

function car_main(e)

	if GetPlayerDistance(e) < 150 and inCar == 0 and waitForKeyRelease == 0 then
		Prompt ( "Press E to Enter" )
		if g_KeyPressE == 1 then
			inCar = 1
			waitForKeyRelease = 1
		end
	end
	
	if inCar == 1 then
		TransportToIfUsed(e)
		CollisionOff(e)
		
		if g_KeyPressW == 1 then
			speed = speed + 10
		else
			speed = speed - 5
		end		
			
		if g_KeyPressA == 1 then
			RotateY(e,-turnSpeed)
		end	

		if g_KeyPressD == 1 then
			RotateY(e,turnSpeed)
		end				

		if g_KeyPressS == 1 then
			speed = speed - 10
		end	

		if speed < 0 then
			speed = 0
		end
		
		if speed > maxSpeed then
			speed = maxSpeed
		end			
		
		MoveForward ( e , speed )
				
		if g_KeyPressE == 1 and waitForKeyRelease == 0 then
			inCar = 0
			waitForKeyRelease = 1
		end
				
	end
	
	if g_KeyPressE == 0 then
		waitForKeyRelease = 0
	end		
	
end