a_http Help..
#1

Hi, guys!

I want to make a /mp3 System based on a_http.inc
What I want exactly is, after the player clicks on a PlayList, it will be automatically generated from a .txt file on my WebHost as a DIALOG_STYLE_LIST.

Ok, so this part of my code is working:

On‌DialogResponse => MP3 Dialog => Listitem 3:
Код:
case 2: // Playlist #1 - RullZ's Music
{
	if(response)  HTTP(playerid, HTTP_GET, "localhost/XSW/Others/Server%20MP3/The%20RullZ.txt", "", "HTTPResponse");
	if(!response) CallRemoteFunction("OnPlayerCommandText", "is", playerid, "/mp3");
}
And public HTTPResponse Part:

Код:
public HTTPResponse(index, response_code, data[])
{
    TxtData[0] = '\0';
    //--------------------------------------------------------------------------
    if(response_code == 200) format(TxtData, 1900, "%s", data), ShowPlayerDialog(index, MP3_D + 5, DIALOG_STYLE_LIST, "MP3 - {FF0000}RullZ's Music", TxtData, "Play", "Back");
    //--------------------------------------------------------------------------
    return 1;
}
The Dialog appears and shows me exactly what I have on The RullZ.txt.

Now there is MP3_D + 5:

Код:
case MP3_D + 5: // Playlist #1 - RullZ's Music
{
    if(response)
    {
	Str[0] = '\0'; format(Str, 1900, "localhost/XSW/Others/Server MP3/The RullZ/%s.mp3", TxtData); PlayAudioStreamForPlayer(playerid, Str);
    }
    else return CallRemoteFunction("OnPlayerCommandText", "is", playerid, "/mp3");
}
After I click a song from the PlayList automatically generated before, instead playing that song, it just tries to play all my .txt as in the example before:

A good result:
Код:
Audio stream: http://localhost/XSW/Others/Server MP3/The RullZ/Song No 1.mp3
And my result:
Код:
Audio stream: http://localhost/XSW/Others/ServerMP3/TheRullZ/SongNo1 SongNo2 SongNo3.mp3
How could I select just the Line 1 or 2 from the .txt ?
Thank you!
Reply
#2

Assuming that each song name is on separate line, use this code :
PHP код:
case MP3_D 5// Playlist #1 - RullZ's Music
{
    if(
response)
    {
    
Str[0] = '\0'
        
format(Str1900"localhost/XSW/Others/Server MP3/The RullZ/%s.mp3"inputtext);//inputtext contains name of listitem use it
        
PlayAudioStreamForPlayer(playeridStr);
    }
    else return 
CallRemoteFunction("OnPlayerCommandText""is"playerid"/mp3");

Reply
#3

Pf... I was thinking about this problem for about 2 weeks, and I realize again that the basics are killing me ).
Thank you very much, you solved my problem!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)