- Скриншоты
Система радио, управление (start|stop - кликабельные TextDraw), выбор станций в диалогах.
Взят с американского сайта.
Код: Выделить всё
#include <a_samp>
new
Text:radiomenu,
Text:stopradio,
Text:playradio
;
public OnFilterScriptInit(){
radiomenu = TextDrawCreate(320.000000, 143.000000, "~n~Radio Menu~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~_");
TextDrawAlignment(radiomenu, 2);
TextDrawBackgroundColor(radiomenu, 255);
TextDrawFont(radiomenu, 2);
TextDrawLetterSize(radiomenu, 0.500000, 1.000000);
TextDrawColor(radiomenu, -1);
TextDrawSetOutline(radiomenu, 0);
TextDrawSetProportional(radiomenu, 1);
TextDrawSetShadow(radiomenu, 1);
TextDrawUseBox(radiomenu, 1);
TextDrawBoxColor(radiomenu, 255);
TextDrawTextSize(radiomenu, 45.000000, 115.000000);
stopradio = TextDrawCreate(320.000000, 180.000000, "Stop~n~Radio");
TextDrawAlignment(stopradio, 2);
TextDrawBackgroundColor(stopradio, 255);
TextDrawFont(stopradio, 2);
TextDrawLetterSize(stopradio, 0.260000, 0.799999);
TextDrawColor(stopradio, -1);
TextDrawSetOutline(stopradio, 0);
TextDrawSetProportional(stopradio, 1);
TextDrawSetShadow(stopradio, 1);
playradio = TextDrawCreate(305.000000, 205.000000, "Play~n~Radio");
TextDrawAlignment(playradio, 0);
TextDrawBackgroundColor(playradio, 255);
TextDrawFont(playradio, 2);
TextDrawLetterSize(playradio, 0.260000, 0.799999);
TextDrawColor(playradio, -1);
TextDrawSetOutline(playradio, 0);
TextDrawSetProportional(playradio, 1);
TextDrawSetShadow(playradio, 1);
TextDrawSetSelectable(radiomenu, false);
TextDrawSetSelectable(stopradio, true);
TextDrawSetSelectable(playradio, true);
return 1;
}
public OnFilterScriptExit(){
TextDrawDestroy(radiomenu);
TextDrawDestroy(stopradio);
TextDrawDestroy(playradio);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]){
if (!strcmp("/radio", cmdtext, true)){
TextDrawShowForPlayer(playerid, radiomenu);
TextDrawShowForPlayer(playerid, playradio);
TextDrawShowForPlayer(playerid, stopradio);
SelectTextDraw(playerid, 0xA3B4C5FF);
return 1;
}
return 0;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid){
if(_:clickedid != INVALID_TEXT_DRAW) {
if(clickedid == playradio){
ShowPlayerDialog(playerid, 4568, DIALOG_STYLE_LIST, "Vehicle Radio", "{FFFF00}Sky Plus FM \n{FFFFFF}Capital FM \n{FFFF00}Planet Rock \n{FFFFFF}Choice FM \n{FFFF00}100% FM \n{FFFFFF}Click2Dance FM \n{FFFF00}Hard FM \n{FFFFFF}Smash Hits \n{FFFF00}Hit Radio\n{FFFFFF}Star FM","Select", "Cancel");}
else if(clickedid == stopradio){
StopAudioStreamForPlayer(playerid);}
TextDrawHideForPlayer(playerid, radiomenu);
TextDrawHideForPlayer(playerid, stopradio);
TextDrawHideForPlayer(playerid, playradio);
CancelSelectTextDraw(playerid);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
if(dialogid == 4568){
if(response){
if(listitem == 0){
PlayAudioStreamForPlayer(playerid, "http://player.stream.akaver.com/streamgen.php?stream=skyplus&format=mp3&quality=hi");}
if(listitem == 1){
PlayAudioStreamForPlayer(playerid, "http://media-ice.musicradio.com/CapitalMP3.m3u");}
if(listitem == 2){
PlayAudioStreamForPlayer(playerid, "http://tx.sharp-stream.com/icecast.php?i=planetrock.mp3");}
if(listitem == 3){
PlayAudioStreamForPlayer(playerid, "http://media-ice.musicradio.com/ChoiseFMMP3.m3u");}
if(listitem == 4){
PlayAudioStreamForPlayer(playerid, "http://stream.100pl.nl/100pctne.mp3");}
if(listitem == 5){
PlayAudioStreamForPlayer(playerid, "http://icecast.clickfm.co.il:8002/click2dance");}
if(listitem == 6){
PlayAudioStreamForPlayer(playerid, "http://files.hard.fm/128.pls");}
if(listitem == 7){
PlayAudioStreamForPlayer(playerid, "http://icy-e-01.sharp-stream.com/smashhits.m3u");}
if(listitem == 8){
PlayAudioStreamForPlayer(playerid, "http://mp3stream7.apasf.apa.at:8000");}
if(listitem == 9){
PlayAudioStreamForPlayer(playerid, "http://stream.power.ee/StarFM.m3u");}
}
return 1;
}
return 0;
}