Garry's Mod Wiki

Revision Difference

Global.Sound#517805

<function name="Sound" parent="Global" type="libraryfunc"> <description> Runs <page>util.PrecacheSound</page> and returns the string. <bug><page>util.PrecacheSound</page> does nothing and therefore so does this function</bug> </description> <realm>Shared and Menu</realm> <file line="123-L126">lua/includes/util.lua</file> <args> <arg name="soundPath" type="string">The soundpath to precache</arg> </args> <rets> <ret name="" type="string">The string passed as the first argument</ret> </rets> </function> <example> <description>From entities/sent_ball.lua</description> <code> local BounceSound = Sound( "garrysmod/balloon_pop_cute.wav" ) function ENT:PhysicsCollide( data, physobj ) -- Play sound on bounce if ( data.Speed &amp;gt; 60 &amp;&amp; data.DeltaTime &amp;gt; 0.2 ) then if ( data.Speed &gt; 60 && data.DeltaTime &gt; 0.2 ) then sound.Play( BounceSound, self:GetPos(), 75, math.random( 90, 120 ), math.Clamp( data.Speed / 150, 0, 1 ) ) ... </code> </example>