27.01.2016, 19:22
Nothing happends when i choose a radio station
PHP код:
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);
PHP код:
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;
}