SA-MP Forums Archive
PlayerPlaySound - is it possible to play to all? - 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: PlayerPlaySound - is it possible to play to all? (/showthread.php?tid=69577)



PlayerPlaySound - is it possible to play to all? - Castle - 19.03.2009

PlayerPlaySound - is it possible to play to all?
Like:
SencClientMessageToAll ?
I mean all players will hear it?


Re: PlayerPlaySound - is it possible to play to all? - Delused - 19.03.2009

Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
  if(isPlayerConnected(i))
  {
    PlayerPlaySound();
  }
}



Re: PlayerPlaySound - is it possible to play to all? - CracK - 19.03.2009

pawn Код:
forward PlaySoundForAll(soundid);
public PlaySoundForAll(soundid)
{
 for(new i; i<MAX_PLAYERS; i++)
   if(IsPlayerConnected(i))PlayerPlaySound(i,soundid);
}



Re: PlayerPlaySound - is it possible to play to all? - Castle - 19.03.2009

Ok, But is it possible to make it that it will work like in a certain radius i give it?
like:
PlayerToPoint(Radius, playerid, Float:X, Float:Y, Float:Z)
Cuz i want it to be heard only at a certain spot


Re: PlayerPlaySound - is it possible to play to all? - SpiderPork - 19.03.2009

pawn Код:
// OnPlayerConnect
SetTimerEx("Timer", 500, true, "f", playerid);

// End of your script
forward Timer(playerid);
public Timer(playerid)
{
    if(PlayerToPoint(radius, playerid, x, y, z))
    {
        PlayerPlaySound(playerid, soundid);
    }
}
Easy.


Re: PlayerPlaySound - is it possible to play to all? - Castle - 19.03.2009

I meant that it will play not only for 1 player but for all and ina certain Radius I will write...
When a Player Writes a CMD like /gate or something


Re: PlayerPlaySound - is it possible to play to all? - Dujma - 19.03.2009

Well recently we had discussion about PlayerPlaySound and all of the sound can be played but there has to be some condtionts made. And if you want to player sound on specific location use X,Y,Z in PlayerPlaySound

https://sampwiki.blast.hk/wiki/PlayerPlaySound

And it should be played in that location.

And check this too...

http://forum.sa-mp.com/index.php?topic=92686.0


Re: PlayerPlaySound - is it possible to play to all? - Castle - 19.03.2009

Well, I know how it should work but I want it to be played not only for 1 player who uses a Command but to all player who are near the Radius of the cmd?
is It possible to Do ..


Re: PlayerPlaySound - is it possible to play to all? - Delused - 19.03.2009

Код:
new Float:userX, Float:userY, Float:userZ;
GetPlayerPos(playerid, X, Y, Z);
for(new i=0; i<=MAX_PLAYERS; i++)
{
	if(PlayerToPoint(i, userX, userY, userZ, [radius]))
	{
		new Float:X, Float:Y, Float:Z;
		GetPlayerPos(i, X, Y, Z);
		PlayerPlaySound(i, [soundid], X, Y, Z);
	}
}


PlayerToPoint(playerid,Float:x,Float:y,Float:z,radius)
{
	if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius)
	{
  		return 1;
	}
	return 0;
}