• Entity():EmitSound(), emit a sound only locally.
    2 replies, posted
Hello. Excuse me for any grammatical errors! I'm using the code: Entity( 1 ):EmitSound( "path/to/sound/wav" ) for emit a sound by a player. I used this code in the client-side: [CODE] function sound(ply) ply:EmitSound( Sound ("path/to/sound/wav") end [/CODE] And it works, but the sound can be heard only locally. On Gmod Wiki [URL="http://wiki.garrysmod.com/page/Entity/EmitSound"]http://wiki.garrysmod.com/page/Entity/EmitSound[/URL] is written: Plays a sound on an entity. If run clientside, the sound will only be heard locally. So I'm trying to use this code in the server side, but I don't know how to specify on which player the script have to emit the sound. I found only this code: Entity( 1 ):EmitSound( "path/to/sound/wav" ) This emits a sound on the first player joined into the server. Someone can help me?
Replace Entity( 1 ) with the player you want to have emit the sound.
[QUOTE=Bubbie;50567886]Replace Entity( 1 ) with the player you want to have emit the sound.[/QUOTE] I want to emit the sound of a player that start the script. [editline]22nd June 2016[/editline] I call the function using net.Start(), net.SendToServer() [CODE] util.AddNetworkString( "asd" ) net.Receive("asd", function() RunConsoleCommand("function") end) function LocalSounds() timer.Create("loop", 1, 0, function() Entity( 1 ):EmitSound( "path/to/sound/wav" ) end) end concommand.Add("function", LocalSounds) [/CODE] Do you understand?
Sorry, you need to Log In to post a reply to this thread.