setSoundMaxDistance | Multi Theft Auto: Wiki Skip to content

setSoundMaxDistance

Client-side
Server-side
Shared

Pair: getSoundMaxDistance

Sets a custom sound max distance at which the sound stops.

OOP Syntax Help! I don't understand this!

  • Method: sound:setMaxDistance(...)
  • Variable: .maxDistance

Syntax

bool setSoundMaxDistance ( sound theSound, int distance )
Required Arguments
  • theSound: A sound element.
  • distance: The default value for this is 20.

Returns

  • bool: result

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

Code Examples

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