play sound arg


function ccPlaySound( ply, cmd, args )
	
	ply:EmitSound(".. arg", 350, 100);
	
end
concommand.Add( "rp_playsound", ccPlaySound )

if I run

in console it will play this sound.


function ccPlaySound( ply, cmd, arg )
    ply:EmitSound(arg[1], 350, 100)
end
concommand.Add("rp_playsound", ccPlaySound)

I’m the only one who can hear the sound and others can’t.
I mean who around me can’t hear it.

I tried to change the code to

Doesnt working at all

Is your file on the server or the client?

server.

Because if it stopped working when you added the “if SERVER” statement, then it isn’t on the server.

With SERVER I dont hear it and anyone dont hear it.
Without SERVER Only I can hear it.

Then it isn’t on the server. You need to upload it to your server and put it in autorun, but even then, only you will hear it.

[lua]
function ccPlaySound( ply, cmd, arg )
for _,pl in pairs(player.GetAll()) do
pl:EmitSound(arg[1], 350, 100)
end
end
concommand.Add(“rp_playsound”, ccPlaySound)
[/lua]

This should make everyone hear it, assuming they all have the sound file, and it’s uploaded to autorun on the server.

I dont from all to hear it, Only who near me.

Oh gotcha. Then use the code posted above by Freemaan, and upload it to the server.