PlayerPlaySound - is it possible to play to all?
#1

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

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

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

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
Reply
#5

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.
Reply
#6

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
Reply
#7

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
Reply
#8

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 ..
Reply
#9

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)