SetVehicleAudioSetting: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Invalid and missing properties)
 
Line 11: Line 11:
*'''vehicle:''' The vehicle element to modify audio settings for
*'''vehicle:''' The vehicle element to modify audio settings for
*'''property:''' The audio property to set. Valid properties are:
*'''property:''' The audio property to set. Valid properties are:
**"doorSound" - Door sound effects
**"door-sound" - Door sound effects
**"engineOffSoundBankID" - Engine off sound bank ID (0-410)
**"engine-off-soundbank-id" - Engine off sound bank ID (0-410). Used when the player *is not* in the vehicle
**"engineOnSoundBankID" - Engine on sound bank ID (0-410)
**"engine-on-soundbank-id" - Engine on sound bank ID (0-410). Used when the player *is* in the vehicle
**"hornHigh" - Horn high frequency
**"horn-high" - Horn high frequency
**"hornTon" - Horn tone
**"horn-ton" - Horn tone
**"hornVolumeDelta" - Horn volume delta
**"horn-volume-delta" - Horn volume delta
**"radioNum" - Radio number
**"radio-num" - Radio station number
**"radioType" - Radio type
**"radio-type" - Radio type
**"sound-type" - Sound type
**"bass-setting" - Bass value (0-2)
**"bass-eq"
**"field-c"
**"engine-upgrade"
**"vehicle-type-for-audio"
*'''value:''' The numerical value to set for the specified property
*'''value:''' The numerical value to set for the specified property



Latest revision as of 20:52, 7 September 2026

ADDED/UPDATED IN VERSION 1.6.0 r23140:
This function sets audio properties for a specific vehicle instance. It allows customization of various vehicle sound settings such as engine sounds, horn characteristics, door sounds, and radio settings.

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:
    • "door-sound" - Door sound effects
    • "engine-off-soundbank-id" - Engine off sound bank ID (0-410). Used when the player *is not* in the vehicle
    • "engine-on-soundbank-id" - Engine on sound bank ID (0-410). Used when the player *is* in the vehicle
    • "horn-high" - Horn high frequency
    • "horn-ton" - Horn tone
    • "horn-volume-delta" - Horn volume delta
    • "radio-num" - Radio station number
    • "radio-type" - Radio type
    • "sound-type" - Sound type
    • "bass-setting" - Bass value (0-2)
    • "bass-eq"
    • "field-c"
    • "engine-upgrade"
    • "vehicle-type-for-audio"
  • value: The numerical value to set for the specified property

Returns

Returns true if the audio setting was successfully applied, false otherwise.


[[{{{image}}}|link=|]] 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.
[[{{{image}}}|link=|]] Note: Sound bank IDs for engine sounds must be 410 or lower. Values above this limit will be rejected. Changes only affect the specified vehicle instance. Other vehicles of the same model will retain their original audio settings. This function only works with standard vehicle models and cannot modify audio settings for vehicles that are already spawned.

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)

See Also