Global/Sound

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=Sound
+
|Description=Runs {{LibraryFunction|util|PrecacheSound}} and returns the string.
|Parent=Global
+
 
|Description=Runs {{LibraryFunction|util|PrecacheSound}} and returns the string
+
{{Bug|{{LibraryFunction|util|PrecacheSound}} does nothing and therefore so does this function}}
 
|Realm=Shared and Menu
 
|Realm=Shared and Menu
 
|IsClass=No
 
|IsClass=No

Latest revision as of 18:27, 9 January 2020

 Sound( )

Contents

Description

Runs util.PrecacheSound and returns the string.

BUG

util.PrecacheSound does nothing and therefore so does this function

Arguments

string soundPath

The soundpath to precache

Returns

string

The string passed as the first argument

Examples

Example

From entities/sent_ball.lua

local BounceSound = Sound( "garrysmod/balloon_pop_cute.wav" )
function ENT:PhysicsCollide( data, physobj )
 -- Play sound on bounce
 if ( data.Speed > 60 && data.DeltaTime > 0.2 ) then
 sound.Play( BounceSound, self:GetPos(), 75, math.random( 90, 120 ), math.Clamp( data.Speed / 150, 0, 1 ) )
 ...


Personal tools
Navigation