SetVehicleAudioSetting
Jump to navigation
Jump to search
Syntax
bool setVehicleAudioSetting ( element vehicle, string property, float value )
Required Arguments
- vehicle: The vehicle element to modify audio settings for
- property: The audio property to set. Valid properties are:
- "doorSound" - Door sound effects
- "engineOffSoundBankID" - Engine off sound bank ID (0-410)
- "engineOnSoundBankID" - Engine on sound bank ID (0-410)
- "hornHigh" - Horn high frequency
- "hornTon" - Horn tone
- "hornVolumeDelta" - Horn volume delta
- "radioNum" - Radio number
- "radioType" - Radio type
- value: The numerical value to set for the specified property
Returns
Returns true if the audio setting was successfully applied, false otherwise.
Tip: This function modifies the audio settings for a specific vehicle instance, while setVehicleModelAudioSetting modifies the audio settings for all vehicles of a specific model. Changes made with setVehicleModelAudioSetting only affect newly created vehicles of that model, while changes made with setVehicleModelAudioSetting affect all newly created vehicles of that model. |
Examples
-- Modify the engine sound for a specific vehicle local vehicle = createVehicle(411, 0, 0, 3) setVehicleAudioSetting(vehicle, "engineOnSoundBankID", 150)
-- Customize horn settings for a specific vehicle local vehicle = createVehicle(560, 100, 100, 3) setVehicleAudioSetting(vehicle, "hornHigh", 1.5) setVehicleAudioSetting(vehicle, "hornTon", 0.8) setVehicleAudioSetting(vehicle, "hornVolumeDelta", 2.0)
-- Configure radio and door sounds for a specific vehicle local vehicle = createVehicle(562, 200, 200, 3) setVehicleAudioSetting(vehicle, "radioNum", 5) setVehicleAudioSetting(vehicle, "radioType", 2) setVehicleAudioSetting(vehicle, "doorSound", 1.2)