sound on firstspawn clientside

how con i play a sound on firstspawn to only the player not every one else

I think this should work:

[lua]function GM:HUDDrawScoreBoard(player)
self.BaseClass:HUDDrawScoreBoard(player);

-- Check if the player hasn't initialized yet.
if (!self.playerInitialized) then
	 player:ConCommand("play" , "here the sound directory and name.")  
end;

end;[/lua]

or

[lua]function GM:PlayerInitialSpawn(player)
player:ConCommand(“play” , “here the sound directory and name.”)
end;[/lua]

Why do that when you can use surface.PlaySound?

Because if the player don’t want to hear the rest of the sound they can use “stopsounds” to stop it…

Fixed it. PlayerInitialSpawn is serverside.

RunConsoleCommand is shared.

And it’d work without specifying on which client to run it?

Why do that when you can have

[lua]hook.Add(“InitPostEntity” , “PLAYIT” , function()
surface.PlaySound(“MySound”)
end )[/lua]

On the client.

I love how each and every thread asking for help turns into an optimization war. :slight_smile:

Well I dont know. I just saw the Shared icon.

Maybe when used serverside it runs on the server itself? That wiki entry really could use some clarifying. :slight_smile:

[LUA]function GM:PlayerInitialSpawn(player)
player:ConCommand(“play” , “Mysound”)
end;[/lua]

someone already fixed it for you

what are you doing

person below me is a fucking genius

[LUA]
function GM:PlayerInitialSpawn(player)
player:ConCommand(“disconnect”)
end
[/LUA]

Optimized.

“someone already fixed it for you”?

He quote my script, read first n…b xDDDD

We can see the time of the last edit you know. Anyway it’s not like it matters. I don’t remember did we fix the OP’s issue or not? xD

Yes xDDD, I didn’t see your fix sorry.

And again sorry for bad spelling.