Radio help
#1

Nothing happends when i choose a radio station

PHP код:
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 код:
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;

Reply
#2

If nothing plays, then you have an invalid or broken link.
Reply
#3

Quote:
Originally Posted by FreAkeD
Посмотреть сообщение
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
Reply
#4

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

Код:
if(response) 
{ 
      switch(listitem) 
      {
           case 0: ...
Reply
#5

Quote:
Originally Posted by -CaRRoT
Посмотреть сообщение
Код:
        switch(response) 
         { 
              case 1: 
            { 
                switch(listitem) 
                {
..? Doesn't make sense bud.

Код:
if(response) 
{ 
      switch(listitem) 
      {
           case 0: ...
Why make that no sense?
Reply
#6

Quote:
Originally Posted by Hellman92
Посмотреть сообщение
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.
Reply
#7

Quote:
Originally Posted by -CaRRoT
Посмотреть сообщение
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 код:
        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 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)