ItsMods

Full Version: PlaySoundOnPlayer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
PlaySoundOnPlayer(GetClient(0), "mp_bomb_plant");

Function plays a sound player client 0 ?

How to play the sound of all clients ?
CSHARP Code
  1. List<ServerClient> clientlist = GetClients()
  2. foreach(ServerClient c in clientlist)
  3. {
  4. PlaySoundOnPlayer(c, "mp_bomb_plant");
  5. }
read plugin documentation
http://cod6hmod.itshax.com/mw3_addon/doc...ndonplayer
Code:
PlaySoundOnPlayer(): Play a sound to the client.
ARGUMENTS
ServerClient Client:    Pplayer to play the sound on
String Sound:    Sound name

RETURNS
None

EXAMPLE
PlaySoundOnPlayer(GetClient(0), "mp_bomb_plant");

also, @Nukem , we can use Client.ClientNum there ??like
PlaySoundOnPlayer(Client.ClientNum, "mp_bomb_plant");
@jaydi ClientNum - int
Client - ServerClient

so... No.
Essentially, the function get's the client's ClientNum.... I guess Nukem just made it like that for simplicity's sake.

Code:
public unsafe void PlaySoundOnPlayer(ServerClient Client, string Sound)
{
    IntPtr hglobal = Marshal.StringToHGlobalAnsi(Sound);
    Server.CGSCFunc.PlaySoundToPlayer(GetSCClientByNum(Client.ClientNum), (sbyte modopt(IsSignUnspecifiedByte)*) hglobal.ToPointer());
    Marshal.FreeHGlobal(hglobal);
}
Nice derail.

His question was "How to play the sound of all clients ?" and I answered.