SetInteriorSoundsEnabled: Difference between revisions
Jump to navigation
Jump to search
m (Improving) |
(Added example and better description of the function) |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
{{Server client function}} | {{Server client function}} | ||
This function | This function disables or enables the ambient sounds played by GTA in most interiors, like restaurants, casinos, clubs, houses, etc. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setInteriorSoundsEnabled ( bool enabled ) | bool setInteriorSoundsEnabled ( bool enabled ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | *'''enabled:''' set to ''true'' to enable the interior ambient sounds, ''false'' to disable them. By default they're enabled. | ||
==Returns== | |||
If a boolean was passed to the function, it always succeeds and returns ''true''. | |||
==Example== | |||
<section name="Client" class="client" show="true"> | |||
This example disables the dancing club ambient music, without disabling other interiors' ambient sounds. | |||
<syntaxhighlight lang="lua"> | |||
function disableClubMusic() | |||
if getElementInterior(localPlayer) == 17 and getDistanceBetweenPoints3D(493.39, -22.72, 1000.68, getElementPosition(localPlayer)) < 50 and getInteriorSoundsEnabled() then | |||
setInteriorSoundsEnabled(false) | |||
elseif not getInteriorSoundsEnabled() then | |||
setInteriorSoundsEnabled(true) | |||
end | |||
end | |||
addEventHandler("onClientPreRender", root, disableClubMusic) | |||
</syntaxhighlight> | |||
</section> | |||
==See also== | |||
{{World functions}} | {{World functions}} |
Latest revision as of 08:49, 15 June 2014
This function disables or enables the ambient sounds played by GTA in most interiors, like restaurants, casinos, clubs, houses, etc.
Syntax
bool setInteriorSoundsEnabled ( bool enabled )
- enabled: set to true to enable the interior ambient sounds, false to disable them. By default they're enabled.
Returns
If a boolean was passed to the function, it always succeeds and returns true.
Example
Click to collapse [-]
ClientThis example disables the dancing club ambient music, without disabling other interiors' ambient sounds.
function disableClubMusic() if getElementInterior(localPlayer) == 17 and getDistanceBetweenPoints3D(493.39, -22.72, 1000.68, getElementPosition(localPlayer)) < 50 and getInteriorSoundsEnabled() then setInteriorSoundsEnabled(false) elseif not getInteriorSoundsEnabled() then setInteriorSoundsEnabled(true) end end addEventHandler("onClientPreRender", root, disableClubMusic)
See also
- areTrafficLightsLocked
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getSkyGradient
- getPlayerBlurLevel
- getZoneName
- isGarageOpen
- removeWorldModel
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity
- setJetpackMaxHeight
- setPlayerBlurLevel