pawn Код:
new Radio[MAX_PLAYERS]; //At the top of your script
public OnPlayerConnect(playerid)
{
Radio[playerid] = 0;
return 1;
}
CMD:xmradio(playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"XM Radio menu - Page 1","{FF0000}Category: Hip-Hop(Rap) & RnB:\r\n{FFFFFF}1. Hot 108\r\n2. Flow 103\r\n3. DefJay (RnB)\r\n4. West Coast Radio\r\n5. Hot 97 New York\r\n6. G'd Up Radio\r\n{FF0000}Category: Dubstep:\r\n{FFFFFF}1. Dubstep FM\r\n2. Filth FM\r\n3. Musik Drumstep\r\n{FF0000}Category: Classic Rock:\r\n1. Canada Classic Rock Radio\r\n2. 181.FM- The Eagle","Select", "Cancel");
return 1;
}
CMD:stopradio(playerid, params[])
{
if(Radio[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You do not have your radio turned on.");
SendClientMessage(playerid, 0x42F3F198, "You have switched off your radio.");
StopAudioStreamForPlayer(playerid);
Radio[playerid] = 0;
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 90:
{
if(!response) return SendClientMessage(playerid, 0x42F3F198, "You've closed the XM Radio menu.");//
switch(listitem)//
{
case 0: //
{
ShowPlayerDialog(playerid,91,DIALOG_STYLE_LIST,"Category: Hip-Hop(Rap) & RnB","1. Hot 108\r\n2. Flow 103\r\n3. DefJay (RnB)\r\n4. West Coast Radio\r\n5. Hot 97 New York\r\n6. G'd Up Radio","Select", "Cancel");
}
case 1: //
{
PlayAudioStreamForPlayer(playerid, "http://www.hot108.com/hot108.pls");
Radio[playerid] = 1;
}
case 2: //
{
PlayAudioStreamForPlayer(playerid, "http://173.245.71.186:80");
Radio[playerid] = 2;
}
case 3: //
{
PlayAudioStreamForPlayer(playerid, "http://he-srv1.defjay.com:80");
Radio[playerid] = 3;
}
case 4: //
{
PlayAudioStreamForPlayer(playerid, "http://212.117.39.164:8000");
Radio[playerid] = 4;
}
case 5: //
{
PlayAudioStreamForPlayer(playerid, "http://6093.live.streamtheworld.com:80/WQHTFM_SC");
Radio[playerid] = 5;
}
case 6: //
{
PlayAudioStreamForPlayer(playerid, "http://174.36.206.217:8577");
Radio[playerid] = 6;
}
case 7: //
{
ShowPlayerDialog(playerid,92,DIALOG_STYLE_LIST,"Category: Dubstep","1. Dubstep FM\r\n2. Filth FM\r\n3. Musik Drumstep","Select", "Cancel");
}
case 8: //
{
PlayAudioStreamForPlayer(playerid, "http://72.13.91.147:80");
Radio[playerid] = 7;
}
case 9: //
{
PlayAudioStreamForPlayer(playerid, "http://75.125.130.122:8062");
Radio[playerid] = 8;
}
case 10: //
{
PlayAudioStreamForPlayer(playerid, "http://178.77.93.190:21000");
Radio[playerid] = 9;
}
case 11: //
{
ShowPlayerDialog(playerid,93,DIALOG_STYLE_LIST,"Category: Classic Rock","1. Canada Classic Rock Radio\r\n2. 181.FM- The Eagle","Select", "Cancel");
}
case 12: //
{
PlayAudioStreamForPlayer(playerid, "http://173.192.224.123:8651");
Radio[playerid] = 10;
}
case 13: //
{
PlayAudioStreamForPlayer(playerid, "http://66.197.229.245:8082");
Radio[playerid] = 11;
}
}
}
case 91:
{
switch(listitem)
{
case 0: //
{
PlayAudioStreamForPlayer(playerid, "http://www.hot108.com/hot108.pls");
Radio[playerid] = 1;
}
case 1: //
{
PlayAudioStreamForPlayer(playerid, "http://173.245.71.186:80");
Radio[playerid] = 2;
}
case 2: //
{
PlayAudioStreamForPlayer(playerid, "http://he-srv1.defjay.com:80");
Radio[playerid] = 3;
}
case 3: //
{
PlayAudioStreamForPlayer(playerid, "http://212.117.39.164:8000");
Radio[playerid] = 4;
}
case 4: //
{
PlayAudioStreamForPlayer(playerid, "http://6093.live.streamtheworld.com:80/WQHTFM_SC");
Radio[playerid] = 5;
}
case 5: //
{
PlayAudioStreamForPlayer(playerid, "http://174.36.206.217:8577");
Radio[playerid] = 6;
}
}
}
case 92:
{
switch(listitem)
{
case 0: //
{
PlayAudioStreamForPlayer(playerid, "http://72.13.91.147:80");
Radio[playerid] = 7;
}
case 1: //
{
PlayAudioStreamForPlayer(playerid, "http://75.125.130.122:8062");
Radio[playerid] = 8;
}
case 2: //
{
PlayAudioStreamForPlayer(playerid, "http://178.77.93.190:21000");
Radio[playerid] = 9;
}
}
}
case 93:
{
switch(listitem)
{
case 0: //
{
PlayAudioStreamForPlayer(playerid, "http://173.192.224.123:8651");
Radio[playerid] = 10;
}
case 1: //
{
PlayAudioStreamForPlayer(playerid, "http://66.197.229.245:8082");
Radio[playerid] = 11;
}
}
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(oldstate == PLAYER_STATE_ONFOOT)
{
PlayRadioStationForPlayer(playerid);
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
StopAudioStreamForPlayer(playerid);
}
}
return 1;
}
stock PlayRadioStationForPlayer(playerid)
{
switch(Radio[playerid])
{
case 0: return 0;
case 1: return PlayAudioStreamForPlayer(playerid, "http://www.hot108.com/hot108.pls");
case 2: return PlayAudioStreamForPlayer(playerid, "http://173.245.71.186:80");
case 3: return PlayAudioStreamForPlayer(playerid, "http://he-srv1.defjay.com:80");
case 4: return PlayAudioStreamForPlayer(playerid, "http://212.117.39.164:8000");
case 5: return PlayAudioStreamForPlayer(playerid, "http://6093.live.streamtheworld.com:80/WQHTFM_SC");
case 6: return PlayAudioStreamForPlayer(playerid, "http://174.36.206.217:8577");
case 7: return PlayAudioStreamForPlayer(playerid, "http://72.13.91.147:80");
case 8: return PlayAudioStreamForPlayer(playerid, "http://75.125.130.122:8062");
case 9: return PlayAudioStreamForPlayer(playerid, "http://178.77.93.190:21000");
case 10: return PlayAudioStreamForPlayer(playerid, "http://173.192.224.123:8651");
case 11: return PlayAudioStreamForPlayer(playerid, "http://66.197.229.245:8082");
}
return 1;
}