SA-MP Forums Archive
PlayerPlaySoundEx can i do it for all players? - 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: PlayerPlaySoundEx can i do it for all players? (/showthread.php?tid=65533)



PlayerPlaySoundEx can i do it for all players? - Drift_04 - 13.02.2009

ok i wan to make it so when you teleport to a location it plays a sound for you
and when i sue this command

PlayerPlaySoundEx

you have to do the playerid, and than the sound. which will only play it for that player

i want to make it so it plays for all the players. anyone know how to do that?


Re: PlayerPlaySoundEx can i do it for all players? - LibertyWorld - 13.02.2009

I think its not possible


Re: PlayerPlaySoundEx can i do it for all players? - Drift_04 - 13.02.2009

well i was thinking that if i could make it so i could #define all to make it a sign for all players than i could do PlayerPlaySound(all,106;


Re: PlayerPlaySoundEx can i do it for all players? - boylett - 13.02.2009

There's an example in rivershell IIRC.


Re: PlayerPlaySoundEx can i do it for all players? - Drift_04 - 13.02.2009

whats rivershell iirc?


Re: PlayerPlaySoundEx can i do it for all players? - Daren_Jacobson - 13.02.2009

again, done in reply box.
pawn Код:
for(new bob; bob < MAX_PLAYERS; bob++)
{
if (!IsPlayerConnected) continue;
PlayerPlaySound(bob, soundid);
}



Re: PlayerPlaySoundEx can i do it for all players? - Finn - 13.02.2009

Quote:
Originally Posted by Daren_Jacobson
again, done in reply box.
Why do you check if the player is NOT online? Ain't it easier to check if the player IS online and if true run the func?

pawn Код:
for(new bob; bob < MAX_PLAYERS; bob++) if(IsPlayerConnected(bob)) PlayerPlaySound(bob, soundid);
And... Who's Bob? lol


Re: PlayerPlaySoundEx can i do it for all players? - Yaheli_Faro - 13.02.2009

Quote:
Originally Posted by Daren_Jacobson
again, done in reply box.
pawn Код:
for(new bob; bob < MAX_PLAYERS; bob++)
{
if (!IsPlayerConnected) continue;
PlayerPlaySound(bob, soundid);
}
That won't work since you are missing the coords...

You can:

1. Make a function 'PlaySoundForAll' by adding this at the top of your script:
pawn Код:
#define PlaySoundForAll(%1) for(new i; i < MAX_PLAYERS; i++) PlayerPlaySound(i, %1, 0.0, 0.0, 0.0)
/*%1 is the sound ID... */
or 2. Use this everytime you want to play the sound (should work faster by a few milliseconds :P):

pawn Код:
for(new i; i < MAX_PLAYERS; i++) PlayerPlaySound(i, soundid, 0.0, 0.0, 0.0); /* Replace 'soundid' with the ID you want */



Re: PlayerPlaySoundEx can i do it for all players? - Nero_3D - 13.02.2009

Quote:
Originally Posted by Yaheli
or 2. Use this everytime you want to play the sound (should work faster by a few milliseconds :P):
I would say that they have the same speed
because if you use #define its just a macro
and macros will be replaced be the given code when you compile
also after you compiled it should be the same code


Re: PlayerPlaySoundEx can i do it for all players? - Drift_04 - 15.02.2009

oh ok thanks guys!