SA-MP Forums Archive
PlayerPlaySound - 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 (/showthread.php?tid=148818)



PlayerPlaySound - iJumbo - 19.05.2010

how to give a range in PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0);

like this PlayerPlaySound(playerid, 1130, 0.0, 0.0, 10.0,range);


Re: PlayerPlaySound - ettans - 19.05.2010

Make a loop, check if any player is withing a certain range of the coordinates used in PlayerPlaySound and then play the sound for the player.


Re: PlayerPlaySound - iJumbo - 19.05.2010

with a timers?? and IsPlayerInRangeOfPoint ??


Re: PlayerPlaySound - ettans - 19.05.2010

Yes, that way.


Re: PlayerPlaySound - iJumbo - 19.05.2010

Код:
dcmd_startsongforall(playerid, params[])
{
	for(new b; b<GetMaxPlayers(); b++) if(IsPlayerInRangeOfPoint(b,50.0,-703.0861,963.7906,12.4002))
	{
		for(new a; a<GetMaxPlayers(); a++) PlayerPlaySound(a, 1057, 0.0, 0.0, 0.0);
		}
	return 1;
}
dont work <.<


Re: PlayerPlaySound - Desert - 19.05.2010

pawn Код:
stock PlaySoundEx(soundid,Float:x,Float:y,Float:z,Float:range)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,range,x,y,z))
{
PlayerPlaySound(i,soundid,0,0,0);
}
}
}
}
Not tested


Re: PlayerPlaySound - iJumbo - 19.05.2010

look at new topic i try the code


Re: PlayerPlaySound - iJumbo - 19.05.2010

dont work ... i have to set a timer?


Re: PlayerPlaySound - DaneAMattie - 19.05.2010

Quote:
Originally Posted by [ZDM
jumbo ]
dont work ... i have to set a timer?
Код:
forward CheckPlaySoundEx(soundid,Float:x,Float:y,Float:z,Float:range);
public CheckPlaySoundEx(soundid,Float:x,Float:y,Float:z,Float:range)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,range,x,y,z))
{
PlayerPlaySound(i,soundid,0,0,0);
}
}
}
}
now on init type:

SetTimerEx(CheckPlaySoundEx,50,1,"i",soundid,Float ,Float:y,Float:z,Float:range);


Re: PlayerPlaySound - DaneAMattie - 19.05.2010

Quote:
Originally Posted by DaneAMattie
Quote:
Originally Posted by [ZDM
jumbo ]
dont work ... i have to set a timer?
Код:
forward CheckPlaySoundEx(soundid,Float:x,Float:y,Float:z,Float:range);
public CheckPlaySoundEx(soundid,Float:x,Float:y,Float:z,Float:range)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,range,x,y,z))
{
PlayerPlaySound(i,soundid,0,0,0);
}
}
}
}
now on OnGamemodeInit type:

SetTimerEx(CheckPlaySoundEx,50,1,"i",soundid,Float ,Float:y,Float:z,Float:range);
u probly replace Float etc with ur value's

btw Not Tested