29.06.2018, 15:21
Hey guyss..!! I really need your help.
What's wrong with this code? this code is not working (Can not get data from link)
For example I use converter from convertmp3.io and Alan Walker - The Spectre song
it would be like this
The page works well and shows like this
And how to be able to play a song with links on that page?
This is the code to play songs from *******. This from my Gamemode
And this code is from *******_stream.inc
What's wrong with this code? this code is not working (Can not get data from link)
For example I use converter from convertmp3.io and Alan Walker - The Spectre song
Код:
convertmp3.io/fetch/?format=text&video=LINK
The page works well and shows like this
Код:
Title: Alan Walker - The Spectre Length: 207 Link: https://www.convertmp3.io/download/get/?i=0KZqUN4qjeKFopUxwyYY1VoEeWAjteG9&e=78
This is the code to play songs from *******. This from my Gamemode
PHP код:
//PLAY ******* FUNCTION (GAMEMODE)
if(dialogid == DIALOG_AUDIOB1)
{
if(response == 1)
{
if(isnull(inputtext))
{
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "[SERVER-AUDIO] {FFFFFF}Masukkan URL Audio!");
}
if(strlen(inputtext))
{
for(new i; i < MAX_PLAYERS; i ++)
{
Play*******StreamForPlayer(i, inputtext);
format(string, sizeof(string), "[SERVER-AUDIO] {FF0000}%s {FFFFFF}telah memutar sebuah lagu dari *******! Enjoy the song!", GetPlayerNameEx(playerid));
SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
}
SVR******* = 1;
}
}
}
PHP код:
stock Play*******StreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
{
if(!IsPlayerConnected(playerid))
return false;
#if defined USE_REGEX
if(!IsValid*******Url(url))
{
if(!Convert*******Url(url, 256))
return false;
}
#else
if(strfind(url, "*********/") != -1)
if(!Convert*******Url(url, 256))
return false;
#endif
static string[256];
format(string, sizeof(string), "convertmp3.io/fetch/?format=text&video=%s", url);
HTTP(playerid, HTTP_GET, string, "", "*******Response");
*******_posX[playerid] = posX;
*******_posY[playerid] = posY;
*******_posZ[playerid] = posZ;
*******_distance[playerid] = distance;
*******_usepos[playerid] = usepos;
*******_title[playerid]{0} = '\0';
*******_len[playerid] = 0;
return true;
}
forward *******Response(playerid, response, data[]);
public *******Response(playerid, response, data[])
{
if(response == 200)
{
if(strfind(data, "No video was found") != -1 || strfind(data, "<meta http-equiv=") != -1)
{
#if defined OnPlay*******Url
OnPlay*******Url(playerid, "\0", 0, -1);
#endif
return;
}
new
title[60],
len[5],
Find
;
Find = strfind(data, "<br/>");
strmid(title, data, 7, Find-1);
strdel(data, 0, Find+5);
Find = strfind(data, "<br/>");
strmid(len, data, 8, Find-1);
strdel(data, 0, Find+11);
strpack(*******_title[playerid], title);
*******_len[playerid] = strval(len);
PlayAudioStreamForPlayer(playerid, data, *******_posX[playerid], *******_posY[playerid], *******_posZ[playerid], *******_distance[playerid], *******_usepos[playerid]);
#if defined *******_USE_TEXTDRAW
PlayerTextDrawSetString(playerid, *******_textdraw[playerid], title);
PlayerTextDrawShow(playerid, *******_textdraw[playerid]);
print("Show");
#endif
#if defined USE_TIMER
*******_timer[playerid] = SetTimerEx("intern_OnStopUrl", strval(len)*1000, false, "d", playerid);
#endif
#if defined OnPlay*******Url
OnPlay*******Url(playerid, title, strval(len), 1);
#endif
}
else
{
#if defined OnPlay*******Url
OnPlay*******Url(playerid, "\0", 0, -2);
#endif
}
}