PlayerPlaySoundEx can i do it for all players?
#1

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

I think its not possible
Reply
#3

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

There's an example in rivershell IIRC.
Reply
#5

whats rivershell iirc?
Reply
#6

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

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

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 */
Reply
#9

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

oh ok thanks guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)