Song cannot be hear by everyone -
L0zaix - 17.02.2012
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.
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;
}
and one question after the song stop how can i set IsSongPlaying to 0 again? i try using
pawn Code:
if(StopAudioStreamForPlayer(playerid)) return IsSongPlaying[playerid] = 0;
in OnPlayerUpdate but it didn't work.
Re: Song cannot be hear by everyone -
L0zaix - 17.02.2012
Sorry to bump. up up!
Re: Song cannot be hear by everyone -
L0zaix - 17.02.2012
someone? i swear
Re: Song cannot be hear by everyone -
emokidx - 17.02.2012
https://sampforum.blast.hk/showthread.php?tid=45235
b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is
at least 48 hours old, and it needs to have
useful information about your problem.
PlayAudioStreamForPlayer just streams for one player, use a loop
Re: Song cannot be hear by everyone -
L0zaix - 17.02.2012
sorry. ok trying
Re: Song cannot be hear by everyone -
L0zaix - 17.02.2012
pawn Code:
CMD:youaremyno1(playerid, params[])
{
new string[128],pname[MAX_PLAYER_NAME];
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);
SendClientMessage(playerid, COLOR_GREEN, "You played the song You're my number one by S CLUB 7");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (i != playerid))
{
PlayAudioStreamForPlayer(i, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3");
IsSongPlaying[i] = 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);
SendClientMessage(playerid, COLOR_RED, "You stop playing the song You're my number one by S CLUB 7");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (i != playerid))
{
StopAudioStreamForPlayer(i);
IsSongPlaying[i] = 0;
}
}
}
return 1;
}
they can hear the song. except me but they cannot stop the song. i think its wrong loop
Re: Song cannot be hear by everyone -
Madd Kat - 17.02.2012
you bumped it again
always try to edit your last post instead of bumping bumping
now if you want to hear it too
pawn Code:
if(IsPlayerConnected(i) && (i != playerid))
should be
its skipping whoever used the command the old way,
this way it will play for anyone connected.
Re: Song cannot be hear by everyone -
L0zaix - 17.02.2012
ok i'm not bumping
this is last. how can i prevent the spam
it spamming the word
"%s has played the song You're my number one S CLUB 7"
it spam SendClientMessageToAll and SendClientMessage
can you fix it for me? when i stop the song it says i played it again lol
but the song aren't playing when i stop the "played song" message just sent
Re: Song cannot be hear by everyone -
Madd Kat - 17.02.2012
its not a bump after someone replyed
and this code is sending to all
pawn Code:
SendClientMessageToAll(COLOR_RED, string);
this one send only to 1 player
also to stop it for everyone
pawn Code:
if(IsPlayerConnected(i) && (i != playerid))
{
StopAudioStreamForPlayer(i);
IsSongPlaying[i] = 0;
}
should be
pawn Code:
if(IsPlayerConnected(i))
{
StopAudioStreamForPlayer(i);
IsSongPlaying[i] = 0;
}
Re: Song cannot be hear by everyone -
L0zaix - 17.02.2012
no not that i mean this
pawn Code:
CMD:youaremyno1(playerid, params[])
{
new string[128],pname[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerName(playerid, pname, sizeof(pname));
if(IsSongPlaying[i] == 0)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "%s has played the song You're my number one by S CLUB 7", pname);
SendClientMessageToAll(COLOR_RED, string);
SendClientMessage(playerid, COLOR_GREEN, "You played the song You're my number one by S CLUB 7");
PlayAudioStreamForPlayer(i, "http://k002.kiwi6.com/hotlink/04gp2006f8/s_club_7_you_re_my_number_one.mp3");
IsSongPlaying[i] = 1;
}
}
else
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "%s has stop playing the song You're my number one by S CLUB 7", pname);
SendClientMessageToAll(COLOR_RED, string);
SendClientMessage(playerid, COLOR_RED, "You stop playing the song You're my number one by S CLUB 7");
StopAudioStreamForPlayer(i);
IsSongPlaying[i] = 0;
}
}
}
return 1;
}