G.CreateSound

From GMod Wiki

(Redirected from CreateSound)
Jump to: navigation, search
Function
Syntax CreateSound( Entity target, String path )
Where is this used?
Description:
Creates a looping sound object.
Returns: Csoundpatch
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.CreateSound]G.CreateSound [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDemonstration of the steps required to play a sound.
Used onNewerShared.png
Code
 
local Thruster_Sound = Sound("PhysicsCannister.ThrusterLoop")
 
local mysound = CreateSound(myentity, Thruster_Sound )
mysound:Play() -- starts the sound
mysound:Stop() -- stops the sound
 
OutputN/A


Additional Info

 Let's say that an in game radio is playing music, the current sound is 60 sec long. 
 The player walks away from the radio so he/she can't hear the music, the player gets back to the radio after 40 seconds.
 The player will not hear the music even if there still is 20 seconds left of the song.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox