GetSoundVolume

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 19:29, 4 September 2026 by QCherry (talk | contribs) (Document client audio API for update 0.1.2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.