setSoundMinDistance | Multi Theft Auto: Wiki Skip to content

setSoundMinDistance

Client-side
Server-side
Shared

Pair: getSoundMinDistance

Sets a custom sound minimum distance at which the sound stops getting louder.

OOP Syntax Help! I don't understand this!

  • Method: sound:setMinDistance(...)
  • Variable: .minDistance

Syntax

bool setSoundMinDistance ( sound theSound, int distance )
Required Arguments
  • theSound: A sound element.
  • distance: An integer representing the distance the sound stops getting louder. The default value for this is 5.

Returns

  • bool: result

Returns a true if the minimum distance was set, false otherwise.

Code Examples

client
local sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, true)
function distanceFunc(command, param)
setSoundMinDistance(sound, tonumber(param))
end
addCommandHandler("setdistance", distanceFunc)