SetSoundMinDistance: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
Sets a custom sound Minimum distance at which the sound stops getting louder.
Sets a custom [[sound]] Minimum distance at which the sound stops getting louder.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setSoundMinDistance ( element sound, int distance )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setSoundMinDistance ( element sound, int distance )</syntaxhighlight>  
 
{{OOP||[[sound]]:setMinDistance|minDistance|getSoundMinDistance}}
===Required Arguments===  
===Required Arguments===  
*'''sound:''' a sound element.
*'''sound:''' a [[sound]] element.
*'''distance:''' an integer representing the distance the sound stops getting louder. the default value for this is 1
*'''distance:''' an integer representing the distance the sound stops getting louder. the default value for this is 5
===Returns===
===Returns===
Returns a ''bool'' ''true'' if the minimum distance was set, ''false'' if invalid arguements where passed.
Returns a ''true'' if the minimum distance was set, ''false'' otherwise.


==Example==  
==Example==  
TODO
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
local sound = playSound3D("sounds/song.mp3", 373.14, -125.21, 1001, true)
 
function distanceFunc(command, param)
  setSoundMinDistance(sound, tonumber(param))
end
addCommandHandler("setdistance", distanceFunc)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
Line 22: Line 26:
==See Also==
==See Also==
{{Client_audio_functions}}
{{Client_audio_functions}}
[[PT-BR:setSoundMinDistance]]
[[HU:setSoundMinDistance]]
[[AR:setSoundMinDistance]]

Latest revision as of 02:06, 19 August 2021

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

Syntax

bool setSoundMinDistance ( element sound, int distance )

OOP Syntax Help! I don't understand this!

Method: sound:setMinDistance(...)
Variable: .minDistance
Counterpart: getSoundMinDistance


Required Arguments

  • sound: a sound element.
  • distance: an integer representing the distance the sound stops getting louder. the default value for this is 5

Returns

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

Example

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

See Also