[Help] Question about 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: [Help] Question about PlayerPlaySound (
/showthread.php?tid=121631)
[Help] Question about PlayerPlaySound -
VonLeeuwen - 17.01.2010
Hey,
I want to use
Quote:
PlayerPlaySound(playerid, soundid, Float , Float:y, Float:z)
|
for a command, but only the cops may hear it.
So, I was thinking of this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/onduty", true))
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are now onduty");
//then some more actions, but this is just an example
PlayerPlaySound(playerid,21, 0, 0, 0);
//At Playerid, how do I say only if a player is a cop, hes able to hear it?
return 1;
}
return 0;
}
Thanks.
Re: [Help] Question about PlayerPlaySound -
Backwardsman97 - 17.01.2010
You would need to use a loop. Just check if player's are cops, then play the sound for them.
pawn Код:
if(!strcmp(cmdtext, "/onduty", true))
{
SendClientMessage(playerid, 0xFFFFFFFF, "You are now onduty");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
PlayerPlaySound(playerid, 21, X, Y, Z);
for(new i; i<MAX_PLAYERS; i++)
{
//Do your team check here. Here's an example with gTeam
if(gTeam[i] == TEAM_COPS)
{
GetPlayerPos(i,X,Y,Z);
PlayerPlaySound(i, 21, X, Y, Z);
}
}
return 1;
}
You could also maybe format a message to tell all the other cops that someone just came on duty so they would know why they heard that sound.
Re: [Help] Question about PlayerPlaySound -
VonLeeuwen - 17.01.2010
Okay, thanks for the help, im going to try it soon as my brother is on the pc now.