SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/02/2012, 02:32 AM   #1
Chrillzen
Gangsta
 
Chrillzen's Avatar
 
Join Date: Jul 2010
Location: Sweden
Posts: 747
Reputation: 112
Default AudioStream

How do I get AudioStream to play for all?
Chrillzen is online now   Reply With Quote
Old 29/02/2012, 02:34 AM   #2
Nuke547
Big Clucker
 
Join Date: Dec 2011
Posts: 172
Reputation: 16
Default Re: AudioStream

[php]
for(new i = 0;i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "url");
}
Nuke547 is offline   Reply With Quote
Old 29/02/2012, 02:53 AM   #3
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,849
Reputation: 323
Default Re: AudioStream

Quote:
Originally Posted by Nuke547 View Post
[php]
for(new i = 0;i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "url");
}
You need to end the /php also but you should use the tag [ pawn ][ /pawn ]

Btw the above code will play an audio stream for every player!

EDIT : I have a much better code
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)//loops through all players
{
   if(IsPlayerConnected(i))//checks if player is connected
   {
   StopAudioStreamForPlayer(i);//stops the audio stream if any is playing.If none is playing nothing will happen.
   PlayAudioStreamForPlayer(i, "http://somafm.com/tags.pls");//plays the music.U can put any link.Just change somafm.com/tags.pls
}
}
__________________


I will take half payment as an advance to script for you.
Click here to request my Scripting Service.


Last edited by Ballu Miaa; 29/02/2012 at 06:18 AM.
Ballu Miaa is offline   Reply With Quote
Old 29/02/2012, 02:36 PM   #4
Chrillzen
Gangsta
 
Chrillzen's Avatar
 
Join Date: Jul 2010
Location: Sweden
Posts: 747
Reputation: 112
Default Re: AudioStream

Fixed, thanks guys!
Chrillzen is online now   Reply With Quote
Old 29/02/2012, 02:57 PM   #5
Ballu Miaa
High-roller
 
Ballu Miaa's Avatar
 
Join Date: Apr 2010
Location: New Delhi,India
Posts: 1,849
Reputation: 323
Default Re: AudioStream

Fixed!

EDIT: All good mate!
__________________


I will take half payment as an advance to script for you.
Click here to request my Scripting Service.

Ballu Miaa is offline   Reply With Quote
Old 01/03/2012, 03:52 PM   #6
Chrillzen
Gangsta
 
Chrillzen's Avatar
 
Join Date: Jul 2010
Location: Sweden
Posts: 747
Reputation: 112
Default Re: AudioStream

One problem, only ID 0 hears the radio.
Chrillzen is online now   Reply With Quote
Old 01/03/2012, 03:54 PM   #7
FalconX
Gangsta
 
FalconX's Avatar
 
Join Date: Mar 2011
Location: Kuwait
Posts: 633
Reputation: 103
Default Re: AudioStream

Quote:
Originally Posted by Chrillzen View Post
One problem, only ID 0 hears the radio.
No It makes the loop and everyone in the SERVER, who are CONNECTED, can hear the AudioStream.

-FalconX
__________________
^
FalconX is offline   Reply With Quote
Old 01/03/2012, 03:58 PM   #8
Chrillzen
Gangsta
 
Chrillzen's Avatar
 
Join Date: Jul 2010
Location: Sweden
Posts: 747
Reputation: 112
Default Re: AudioStream

Not for me, I tested with 4 players that were connected, only id 0 hears the radio. Somethign wrong with the code I guess?

My code:
Code:
for(new i = 0; i < MAX_PLAYERS; i++)//loops through all players
{
   if(IsPlayerConnected(i))//checks if player is connected
   {
		if (PlayerInfo[playerid][pRadiouse] == 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: "COL_WHITE"Du har redan lagt ner en radio.");
		{
		 		new Float:Distance = 17.0;
				PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2147127", radioX[playerid], radioY[playerid], radioZ[playerid], Distance, 1);//plays the music.U can put any link.Just change somafm.com/tags.pls
			   	GetPlayerPos(playerid, radioX[playerid], radioY[playerid], radioZ[playerid]);
				GetPlayerFacingAngle(playerid, radioA[playerid]);
				boombox[playerid] = CreateObject(2103, radioX[playerid], radioY[playerid] +1, radioZ[playerid] -1, 0.0, 0.0, radioA[playerid] + 90);
				PlayerInfo[playerid][pRadiouse] = 1;
}
 			}
 			}
 			}
Chrillzen is online now   Reply With Quote
Old 01/03/2012, 04:00 PM   #9
FalconX
Gangsta
 
FalconX's Avatar
 
Join Date: Mar 2011
Location: Kuwait
Posts: 633
Reputation: 103
Default Re: AudioStream

Quote:
Originally Posted by Chrillzen View Post
Not for me, I tested with 4 players that were connected, only id 0 hears the radio. Somethign wrong with the code I guess?
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)//loops through all players
{
   if(IsPlayerConnected(i))//checks if player is connected
   {
      StopAudioStreamForPlayer(i);//stops the audio stream if any is playing.If none is playing nothing will happen.
      PlayAudioStreamForPlayer(i, "http://somafm.com/tags.pls");//plays the music.U can put any link.Just change somafm.com/tags.pls
   }
}

Put this in the OnPlayerConnect, and try. Ths code is not wrong it will work you might have been doing something wrong.

-FalconX
__________________
^
FalconX is offline   Reply With Quote
Old 01/03/2012, 04:02 PM   #10
Chrillzen
Gangsta
 
Chrillzen's Avatar
 
Join Date: Jul 2010
Location: Sweden
Posts: 747
Reputation: 112
Default Re: AudioStream

I think I might have fixed it, I had something wrong in my code. I can't test it now tought.
Chrillzen is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audiostream for all players? TheTale Scripting Help 5 31/12/2011 04:43 PM
About AudioStream, Lags? ZiPoNz Scripting Help 1 12/12/2011 10:08 AM
Audiostream won't play Awesome™ Scripting Help 4 04/12/2011 11:55 AM
[DUVIDA] Sobre o AudioStream Douglas_prt Português/Portuguese 3 15/09/2011 02:32 PM


All times are GMT. The time now is 03:19 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.