PlayerPlaySound for everybody? - 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 for everybody? (
/showthread.php?tid=123814)
PlayerPlaySound for everybody? -
Torran - 27.01.2010
How would i do PlayerPlaySound for everyone
Re: PlayerPlaySound for everybody? -
~Dangun! - 27.01.2010
pawn Код:
PlaySoundForAll(sound)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
}
}
and when you want to make a sound play for everyone simply put this:
pawn Код:
PlaySoundForAll(sound id);
Re: PlayerPlaySound for everybody? -
ғαιιοцт - 27.01.2010
Код:
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerPlaySound(i, ...);
}
}
Edit: hehe 6 seconds too late
Re: PlayerPlaySound for everybody? -
Mauzen - 27.01.2010
for example, this would do it:
Код:
public PlaySoundForEveryone(soundid, Float:x, Float:y, Float:z) {
for(new i = 0; i < MAX_PLAYERS; i ++) {
if(IsPlayerConnected(i)) PlayerPlaySound(i, soundid, x, y, z);
}
}
Dont know if everything is correct, but it shound work with this system...
Edit: Oops, too slow
Re: PlayerPlaySound for everybody? -
Torran - 27.01.2010
How about for within certain coords
Re: PlayerPlaySound for everybody? -
ғαιιοцт - 27.01.2010
that doesn't matter, it just plays always, wherever the coordinates are set.
Re: PlayerPlaySound for everybody? -
Correlli - 27.01.2010
Quote:
Originally Posted by Mauzen
for example, this would do it:
Код:
public PlaySoundForEveryone(soundid, Float:x, Float:y, Float:z) {
for(new i = 0; i < MAX_PLAYERS; i ++) {
if(IsPlayerConnected(i)) PlayerPlaySound(i, soundid, x, y, z);
}
}
Dont know if everything is correct, but it shound work with this system...
Edit: Oops, too slow
|
The function doesn't need to be a public.
Re: PlayerPlaySound for everybody? -
Torran - 27.01.2010
Код:
C:\Users\Torran\Desktop\sa-mp\gamemodes\b-cnr.pwn(848) : error 017: undefined symbol "PlaySoundForAll"
C:\Users\Torran\Desktop\sa-mp\gamemodes\b-cnr.pwn(852) : warning 217: loose indentation
C:\Users\Torran\Desktop\sa-mp\gamemodes\b-cnr.pwn(852) : error 017: undefined symbol "PlaySoundForAll"
C:\Users\Torran\Desktop\sa-mp\gamemodes\b-cnr.pwn(856) : error 017: undefined symbol "sound"
C:\Users\Torran\Desktop\sa-mp\gamemodes\b-cnr.pwn(859) : error 030: compound statement not closed at the end of file (started at line 845)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: PlayerPlaySound for everybody? -
Torran - 27.01.2010
Anyone?
Re: PlayerPlaySound for everybody? -
TheChaoz - 27.01.2010
u'b better put this when u want to play the sound
pawn Код:
for(new i; i<MAX_PLAYERS, i++){
if(IsPlayerConnected(i) PlayerPlaySound(i, soundid, 0.0, 0.0, 0.0);
}