if(dialogid == DIALOG_CARRADIO)
{
switch(response)
{
case 1:
{
switch(listitem)
{
case 0: 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", "");
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", 5000, 6);
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", 5000, 6);
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 0: DeletePVar(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(playerid, COLOR_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);
stock LoadRadio(playerid,songid)
{
switch(songid)
{
case 1: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=556684"); //Non stop
case 2: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=88086"); //Old school rap
case 3: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=396275"); //Katy Perry loop
case 4: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=772151"); //Radio Nemo
case 5: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=121874"); //Caminoweb Radio
case 6: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=203721"); //PlayHab.de
case 7: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=457678"); //2Pac FanLoop Radio
case 9: PlayAudioStreamForPlayerEx(playerid, PlayerInfo[playerid][pRUrl]);
}
return true;
}
switch(response) { case 1: { switch(listitem) {
if(response) { switch(listitem) { case 0: ...
Код:
switch(response) { case 1: { switch(listitem) { Код:
if(response) { switch(listitem) { case 0: ... |
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. |
if(dialogid == DIALOG_CARRADIO2)
{
if(response)
{
if(listitem == 0)
{
GameTextForPlayer(playerid, "~w~Radio ~g~On", 5000, 6);
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=556684"); //Non stop
}
else if(listitem == 1)
{
GameTextForPlayer(playerid, "~w~Radio ~g~On", 5000, 6);
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", 5000, 6);
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", 5000, 6);
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=772151"); //Radio Nemo
}
else if(listitem == 4)
{
GameTextForPlayer(playerid, "~w~Radio ~g~On", 5000, 6);
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=121874"); //Caminoweb Radio
}
else if(listitem == 5)
{
GameTextForPlayer(playerid, "~w~Radio ~g~On", 5000, 6);
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=203721"); //PlayHab.de
}
else if(listitem == 6)
{
GameTextForPlayer(playerid, "~w~Radio ~g~On", 5000, 6);
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=457678"); //2Pac FanLoop Radio