Here is the script I have.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmdtext, "/radio", true))
{
if(Audio_IsClientConnected(playerid))
{
new tmp[128];
tmp = strtok(cmdtext, idx);
new option = strval(tmp);
switch(option)
{
case 0:
{
SendClientMessage(playerid, COLOR_YELLOW, "Use /startradio [1-6] [0 = off]");
}
case 1:
{
if(StreamID[playerid] > 0)
{
Audio_Stop(playerid, StreamID[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, "Radio Switched Off.");
StreamID[playerid] = 0;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: You're not currently listening to any streams!");
}
}
case 2:
{
if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
StreamID[playerid] = 1;
Audio_PlayStreamed(playerid, "http://listen.di.fm/public5/trance.asx", false, false, true);
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: Now playing: Digitally Imported - Trance.");
SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - Listen to the hottest, freshest Trance music from around the globe!", COLOR_LIGHTBLUE, 25.0, 10000);
return 1;
}
case 3:
{
if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
StreamID[playerid] = 2;
Audio_PlayStreamed(playerid, "http://www.di.fm/wma/club.asx", false, false, true);
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: Now playing: Digitally Imported - Club Sounds.");
SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - The hottest club and dance tunes 24/7!", COLOR_LIGHTBLUE, 25.0, 10000);
return 1;
}
case 4:
{
if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
StreamID[playerid] = 3;
Audio_PlayStreamed(playerid, "http://www.di.fm/wma/dubstep.asx", false, false, true);
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: Now playing: Digitally Imported - Dubstep.");
SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - The sounds of dubstep all day long!", COLOR_LIGHTBLUE, 25.0, 10000);
return 1;
}
case 5:
{
if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
StreamID[playerid] = 4;
Audio_PlayStreamed(playerid, "http://www.di.fm/wma/classictrance.asx", false, false, true);
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: Now playing: Digitally Imported - Classic Trance.");
SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - The sounds of classic trance all day long!", COLOR_LIGHTBLUE, 25.0, 10000);
return 1;
}
case 6:
{
if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
StreamID[playerid] = 5;
Audio_PlayStreamed(playerid, "http://www.di.fm/wma/drumandbass.asx", false, false, true);
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: Now playing: Digitally Imported - DnB.");
SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - Tasty assortment to satisfy your Drum n' Bass needs.", COLOR_LIGHTBLUE, 25.0, 10000);
return 1;
}
case 7:
{
if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
StreamID[playerid] = 6;
Audio_PlayStreamed(playerid, "http://www.di.fm/wma/house.asx", false, false, true);
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: Now playing: Digitally Imported - House.");
SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - Silky, sexy, deep house music straight from the heart of New York City!", COLOR_LIGHTBLUE, 25.0, 10000);
return 1;
}
default:
{
SendClientMessage(playerid, COLOR_YELLOW, "Use /startradio [1-6] [0 = off]");
}
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Audio Bot: You are not connected to the audio server.");
SendClientMessage(playerid, COLOR_YELLOW, "You may need to install the audio client, please visit the forums.");
return 1;
}