Jump to content
  • 0

Problema PlayAudioStreamForPlayer


teudan

Question

Am creat un script pentru radio online si nu merge decat decat un tip de radio adica acel radio care are extensia .mp3, extensia .pls care este cea mai folosita la radio nu merge, sau extensia .m3u. Daca stie cineva de ce sau cum se rezolva sa posteze, multumesc.

[pawn]

#define DIALOG_RADIO_CATEGORIES 6345 // Radio categories

#define DIALOG_RADIO_STATIONS 6346 // Radio stations

#define MAX_ST_TYPE 31

#define MAX_ST_NAME 30

#define MAX_ST_URL 130

enum e_Audio_Stations

{

st_name[MAX_ST_NAME],

st_type[MAX_ST_TYPE],

st_url[MAX_ST_URL]

};

new Audio_Stations[][e_Audio_Stations] =

{

// STATION NAME // CATEGORY // URL

{ "Turn radio off", "{AA3333}Turn radio off{FFFFFF}", "Turn radio off" }, // Leave this one in to allow disabling the radio

{ "ProFm", "ProFm", "http://stream.profm.ro:8012/profm.mp3" }, //.mp3 merge

{ "RadioZu", "RadioZu", "www.radiozu.ro/live.m3u" }, // .m3u nu merge

{ "VideFM", "VideFM", "http://89.238.252.146:9000/listen.pls" } // .pls nu merge

};

public OnPlayerCommandText(playerid, cmdtext[])

{

    if(strcmp(cmd, "/radio", true) == 0)

{

    if(IsPlayerInAnyVehicle(playerid))

    {

new szRadioCategories[500];

for(new i; i < sizeof(Audio_Stations); i++)

{

if(strfind(szRadioCategories, Audio_Stations[st_type], true) != -1)

continue;

format(szRadioCategories, sizeof(szRadioCategories), "%s%s\n", szRadioCategories, Audio_Stations[st_type]);

}

ShowPlayerDialog(playerid, DIALOG_RADIO_CATEGORIES, DIALOG_STYLE_LIST, "Radio categories", szRadioCategories, "Select", "Close");

}

else

{

SendClientMessage(playerid,COLOR_GREY,"You should be in a car to start radio");

}

return 1;

}

return 0;

}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

if(dialogid == DIALOG_RADIO_CATEGORIES)

{

if(!response)

return 0;

if(!strcmp(inputtext, "Turn radio off"))

{

StopAudioStreamForPlayer(playerid);

SendClientMessage(playerid, COLOR_GREEN, "Radio turned off.");

return 1;

}

new

szRadioStations[250];

for(new i; i < sizeof(Audio_Stations); i++)

{

if(strfind(inputtext, Audio_Stations[st_type], true) == -1)

continue;

format(szRadioStations, sizeof(szRadioStations), "%s%s\n", szRadioStations, Audio_Stations[st_name]);

}

ShowPlayerDialog(playerid, DIALOG_RADIO_STATIONS, DIALOG_STYLE_LIST, "Radio stations", szRadioStations, "Tune in", "Close");

return 1;

}

if(dialogid == DIALOG_RADIO_STATIONS)

{

if(!response)

return 0;

for(new i; i < sizeof(Audio_Stations); i++)

{

if(strfind(inputtext, Audio_Stations[st_name], true) == -1)

continue;

StopAudioStreamForPlayer(playerid);

PlayAudioStreamForPlayer(playerid, Audio_Stations[st_url]);

new

szString[22 + MAX_ST_NAME];

format(szString, sizeof(szString), "Tuned in to station: %s", Audio_Stations[st_name]);

SendClientMessage(playerid, COLOR_GREEN, szString);

return 1;

}

}

return 1;

}[/pawn]

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.