You will use an if statement with the setWorldSoundEnabled function to set it to false when the player enters a vehicle, and to true when the player exits the vehicle. You can define these conditions using an if statement.
The events for controlling entering and exiting vehicles are:
addEventHandler("onClientVehicleEnter", root, onVehicleEnter) -- Listens for vehicle entry
addEventHandler("onClientVehicleExit", root, onVehicleExit) -- Listens for vehicle exit