SA-MP Forums Archive
[HELP] PlayerPlaySound - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] PlayerPlaySound (/showthread.php?tid=129534)



[HELP] PlayerPlaySound - FreddeN - 22.02.2010

Hello, I'm just thinking of making a /playsound command that will start a track from GTA SA like this:

Код:
if (strcmp(cmd, "/startsong", true) == 0)
	{
	  if(PlayerInfo[playerid][pAdmin] >= 1337)
	  {
			GetPlayerName(playerid, sendername, sizeof(sendername));
	    format(string, sizeof(string), "AdmCmd: %s started a random song.",sendername);
      SendClientMessageToAll(COLOR_ADMINCHAT, string);
			PlayerPlaySound(playerid, 1187, 0.0, 0.0, 0.0);
	    return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "  You are not authorized to use that command.");
			return 1;
		}
	}
This is not tested on other players yet, will this play the track to all players, if not, is it possible to make it play for all players on the server?

NOTE: I got a /stopsong with the ID 1188.

Thanks


Re: [HELP] PlayerPlaySound - Fedee! - 22.02.2010

pawn Код:
PlaySoundForAll(soundid, Float:x, Float:y, Float:z)
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
      if (IsPlayerConnected(i))
      {
          PlayerPlaySound(i, soundid, x, y, z);
      }
    }
}
pawn Код:
PlaySoundForAll(1185, 0.0, 0.0, 0.0);//soundID, x, y, z