IsSoundPlaying

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

isSoundPlaying

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.

Checks whether an owned client sound is actively playing.

Syntax

bool isSoundPlaying(number sound)

Parameters

Name Type Required Description
sound number yes The resource-owned handle returned by playSound or playSound3D.

Returns

Returns true while the owned sound is actively playing; otherwise returns false.

Examples

Release a finished one-shot handle:

if sound and not isSoundPlaying(sound) then
    sound = nil
end

Notes

  • Available only in client-side resource scripts.
  • Invalid, foreign, stopped, finished, and paused sounds return false.