SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 27/01/2016, 07:22 PM   #1
Hellman92
Big Clucker
 
Hellman92's Avatar
 
Join Date: Oct 2011
Posts: 188
Reputation: 31
Default Radio help

Nothing happends when i choose a radio station

PHP Code:
if(dialogid == DIALOG_CARRADIO)
    {
        switch(
response)
         {
              case 
1:
            {
                switch(
listitem)
                {
                    case 
0ShowPlayerDialog(playerid,DIALOG_CARRADIO2,DIALOG_STYLE_LIST,"Radio Stations","Non stop\nOld school rap\nKaty Perry fanloop radio\nRadio Nemo\nCaminoweb Radio\nPlayHab.de\n2Pac FanLoop Radio\nBack","Play""");
                    case 
1:
                    {
                        
SetPVarInt(playerid,"YTType",1);
                        
ShowPlayerDialog(playerid,DIALOG_CARRADIO3,DIALOG_STYLE_INPUT,"Radio - Direct Link","Enter in a direct .mp3 link and it will play on the radio\n{FF0000}Do not enter a link that will not respond.","Enter""Close");
                    }
                    case 
2:
                    {
                        
ShowPlayerDialog(playerid,DIALOG_CARRADIO,DIALOG_STYLE_LIST,"Vehicle Radio","Play Radio Stations\nPlay Direct Link\nTurn Off","Select""Exit");
                        
GameTextForPlayer(playerid"~w~Radio ~r~Off"50006);
                          foreach (
Player,i)
                        {
                            if(
GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid) && IsPlayerInAnyVehicle(i))
                            {
                                if(
GetPVarInt(i"CarRadio") != 0)
                                {
                                    
StopAudioStreamForPlayerEx(i);
                                    
DeletePVar(i,"CarRadio");
                                }
                            }
                        }
                    }
                }
            }
        }
        if(
dialogid == DIALOG_CARRADIO2)
        {
            switch(
response)
            {
                case 
1:
                {
                    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_WHITE,"You must be in a vehicle to use this.");
                    if(
listitem == 8) return ShowPlayerDialog(playerid,DIALOG_CARRADIO3,DIALOG_STYLE_LIST,"Vehicle Radio","Play Radio Stations\nPlay Direct Link\nTurn Off","Select""Exit");
                    
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                    
SetPVarInt(playerid"Delay"5);
                    
ShowPlayerDialog(playerid,DIALOG_CARRADIO2,DIALOG_STYLE_LIST,"Radio Stations","Non stop\nOld school rap\nKaty Perry fanloop radio\nRadio Nemo\nCaminoweb Radio\nPlayHab.de\n2Pac FanLoop Radio\nBack","Play""");
                    foreach (
Player,i)
                    {
                        if(
GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid) && IsPlayerInAnyVehicle(i))
                        {
                            
SetPVarInt(i"CarRadio"listitem+1);
                            
LoadRadio(i,listitem+1);
                        }
                    }
                }
            }
        }
        if(
dialogid == DIALOG_CARRADIO3)
        {
            switch(
response)
            {
                case 
0DeletePVar(playerid"YTType");
                case 
1:
                {
                    if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_CARRADIO3,DIALOG_STYLE_INPUT,"Radio - Direct Link","Enter in a direct .mp3 link and it will play on the radio\n{FF0000}Do not enter a link that will not respond.","Enter""Close");
                    if(
strlen(inputtext) >= 120)
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"Link is too long (120 Chars max).");
                        return 
ShowPlayerDialog(playerid,DIALOG_CARRADIO3,DIALOG_STYLE_INPUT,"Radio - Direct Link","Enter in a direct .mp3 link and it will play on the radio\n{FF0000}Do not enter a link that will not respond.","Enter""Close");
                    }
                    switch(
GetPVarInt(playerid"YTType"))
                    {
                        case 
1:
                        {
                            foreach (
Player,i)
                               {
                                if(
IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
                                {
                                    
format(PlayerInfo[i][pRUrl], 128,"%s"inputtext);
                                       
SetPVarInt(i"CarRadio"9);
                                       
LoadRadio(i,9); 
PHP Code:
stock LoadRadio(playerid,songid)
{
    switch(
songid)
    {
        case 
1PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=556684"); //Non stop
        
case 2PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=88086"); //Old school rap
        
case 3PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=396275"); //Katy Perry loop
        
case 4PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=772151"); //Radio Nemo
        
case 5PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=121874"); //Caminoweb Radio
        
case 6PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=203721"); //PlayHab.de
        
case 7PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=457678"); //2Pac FanLoop Radio
        
case 9PlayAudioStreamForPlayerEx(playeridPlayerInfo[playerid][pRUrl]);
    }
    return 
true;

Hellman92 is offline   Reply With Quote
Old 27/01/2016, 07:27 PM   #2
FreAkeD
Gangsta
 
FreAkeD's Avatar
 
Join Date: May 2012
Location: Australia
Posts: 630
Reputation: 87
Default Re: Radio help

If nothing plays, then you have an invalid or broken link.
FreAkeD is offline   Reply With Quote
Old 27/01/2016, 07:30 PM   #3
Hellman92
Big Clucker
 
Hellman92's Avatar
 
Join Date: Oct 2011
Posts: 188
Reputation: 31
Default Re: Radio help

Quote:
Originally Posted by FreAkeD View Post
If nothing plays, then you have an invalid or broken link.
No already tried them the link is working fine.

Wont load it in game
Hellman92 is offline   Reply With Quote
Old 27/01/2016, 07:44 PM   #4
-CaRRoT
High-roller
 
-CaRRoT's Avatar
 
Join Date: Jul 2011
Location: CA, Los Angeles.
Posts: 1,275
Reputation: 344
Default Re: Radio help

Code:
        switch(response) 
         { 
              case 1: 
            { 
                switch(listitem) 
                {
..? Doesn't make sense bud.

Code:
if(response) 
{ 
      switch(listitem) 
      {
           case 0: ...
-CaRRoT is offline   Reply With Quote
Old 27/01/2016, 07:51 PM   #5
Hellman92
Big Clucker
 
Hellman92's Avatar
 
Join Date: Oct 2011
Posts: 188
Reputation: 31
Default Re: Radio help

Quote:
Originally Posted by -CaRRoT View Post
Code:
        switch(response) 
         { 
              case 1: 
            { 
                switch(listitem) 
                {
..? Doesn't make sense bud.

Code:
if(response) 
{ 
      switch(listitem) 
      {
           case 0: ...
Why make that no sense?
Hellman92 is offline   Reply With Quote
Old 27/01/2016, 07:55 PM   #6
-CaRRoT
High-roller
 
-CaRRoT's Avatar
 
Join Date: Jul 2011
Location: CA, Los Angeles.
Posts: 1,275
Reputation: 344
Default Re: Radio help

Quote:
Originally Posted by Hellman92 View Post
Why make that no sense?
Try the fixed code I posted above.

(response) is to check whether there was response to the dialog or not (if they pressed enter) so you'd use if, switch is used to switch between different situations/cases so that would be for the items listed (listitem).

I don't see the need for the first case 1: at all, correct me if I am missing something.
-CaRRoT is offline   Reply With Quote
Old 27/01/2016, 08:35 PM   #7
Hellman92
Big Clucker
 
Hellman92's Avatar
 
Join Date: Oct 2011
Posts: 188
Reputation: 31
Default Re: Radio help

Quote:
Originally Posted by -CaRRoT View Post
Try the fixed code I posted above.

(response) is to check whether there was response to the dialog or not (if they pressed enter) so you'd use if, switch is used to switch between different situations/cases so that would be for the items listed (listitem).

I don't see the need for the first case 1: at all, correct me if I am missing something.
Change it abit but still not working :/

PHP Code:
        if(dialogid == DIALOG_CARRADIO2)
        {
             if(
response)
            {
                if(
listitem == 0)
                {
                       
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                    
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=556684"); //Non stop
                
}
                else if(
listitem == 1)
                {
                    
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                     
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=88086"); //Old school rap
                
}
                else if(
listitem == 2)
                {
                      
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                      
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=396275"); //Katy Perry loop
                
}
                else if(
listitem == 3)
                {
                      
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                      
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=772151"); //Radio Nemo
                
}
                else if(
listitem == 4)
                {
                      
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                      
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=121874"); //Caminoweb Radio
                
}
                else if(
listitem == 5)
                {
                      
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                      
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=203721"); //PlayHab.de
                
}
                else if(
listitem == 6)
                {
                      
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
                      
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=457678"); //2Pac FanLoop Radio 
Hellman92 is offline   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
[FilterScript] OPICR(On Player In Car Radio) Stream Internet Radio! Spazz1219 Filterscripts 4 24/11/2013 07:10 PM
Help! Ive made an IG radio streaming, but if leaving car the radio keeps playing! PazG Scripting Help 8 11/01/2013 02:48 PM
What good radio hosting for game radio would you suggest? pasha97 Scripting Help 2 27/11/2012 03:30 PM
[FilterScript] [CB Radio] Citizens Band Radio System (Walkie Talkie) Glint Filterscripts 23 01/11/2012 12:30 PM
[FilterScript] [Audio Plugin] GTA III Radio with type of GTA IV Radio SDraw Filterscripts 9 21/10/2012 06:22 AM


All times are GMT. The time now is 10:28 PM.


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