GetSoundVolume
Jump to navigation
Jump to search
getSoundVolume
AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Returns the current linear volume of a sound owned by the current client resource.
Syntax
number|false getSoundVolume(number sound)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
sound |
number |
yes | The resource-owned handle returned by playSound or playSound3D.
|
Returns
Returns a number from 0 to 1, or false when the handle is invalid or belongs to another resource.
Examples
Read the current volume:
local volume = getSoundVolume(sound)
if volume ~= false then
outputDebugString("Volume: " .. tostring(volume))
end
Notes
- Available only in client-side resource scripts.