19.03.2009, 07:43
PlayerPlaySound - is it possible to play to all?
Like:
SencClientMessageToAll ?
I mean all players will hear it?
Like:
SencClientMessageToAll ?
I mean all players will hear it?
for(new i=0; i<MAX_PLAYERS; i++)
{
if(isPlayerConnected(i))
{
PlayerPlaySound();
}
}
forward PlaySoundForAll(soundid);
public PlaySoundForAll(soundid)
{
for(new i; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(i))PlayerPlaySound(i,soundid);
}
// 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);
}
}
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;
}