17.02.2012, 07:50
ok so i create PlayAudioStreamForPlayer.
i create a position and distance where the song can be only hear.
i want is when they are near to me they can hear the song if
they are far than Distance 10.0 from me they cannot hear the song.
they cannot hear the song, i'm the only one who can.
and one question after the song stop how can i set IsSongPlaying to 0 again? i try using
in OnPlayerUpdate but it didn't work.
i create a position and distance where the song can be only hear.
i want is when they are near to me they can hear the song if
they are far than Distance 10.0 from me they cannot hear the song.
they cannot hear the song, i'm the only one who can.
pawn Code:
new IsSongPlaying[MAX_PLAYERS];
CMD:youaremyno1(playerid, params[])
{
new string[128],pname[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
GetPlayerName(playerid, pname, sizeof(pname));
if(IsSongPlaying[playerid] == 0)
{
format(string, sizeof(string), "%s has played the song You're my number one by S CLUB 7", pname);
SendClientMessageToAll(COLOR_RED, string);
PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3", x, y, z, 20.5);
SendClientMessage(playerid, COLOR_GREEN, "You played the song You're my number one by S CLUB 7");
IsSongPlaying[playerid] = 1;
}
else
{
format(string, sizeof(string), "%s has stop playing the song You're my number one by S CLUB 7", pname);
SendClientMessageToAll(COLOR_RED, string);
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_RED, "You stop playing the song You're my number one by S CLUB 7");
IsSongPlaying[playerid] = 0;
}
return 1;
}
pawn Code:
if(StopAudioStreamForPlayer(playerid)) return IsSongPlaying[playerid] = 0;