HU/setSoundMaxDistance

From Multi Theft Auto: Wiki
Revision as of 19:46, 21 July 2018 by Surge (talk | contribs) (Created page with "__NOTOC__ {{Client function hu}} Sets a custom sound max distance at which the sound stops. ==Syntax== <syntaxhighlight lang="lua">bool setSoundMaxDistance ( element so...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Syntax

bool setSoundMaxDistance ( element sound, int distance )

OOP Syntax Help! I don't understand this!

Method: sound:setMaxDistance(...)
Variable: .maxDistance
Counterpart: getSoundMaxDistance


Required Arguments

  • sound: a sound element.
  • distance: the default value for this is 20

Returns

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

Example

Click to collapse [-]
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)

See Also