Jump to content
  • 0

pomoc Youtube


Mivčo

Dotaz

Sojte ;)

Stiahol som si youtube system a že ho dam do modu ale zistil som že to iba podporuje .mp3 ale ja bz som to chcel spravit že ked sa mi na servery zobrazí tabulka tam vložim toto:

a že mi to bude hrat

Zde je cod:

 

 

//==============================================================================

// Youtube Player v1.0 by usrb1n !

// http://forum.sa-mp.c...er.php?u=122322

//==============================================================================

// Includes & Defines

//==============================================================================

#include

#include

#include

#define U2BDIAG 6958 //DialogID used

new PlayerU2B[MAX_PLAYERS];

new PlayerU2BLink[MAX_PLAYERS][32];

new U2BRadius[MAX_PLAYERS][16];

forward U2BInfo(playerid, response_code, data[]);

#define WHOMADETHIS "Youtube Player v1.0"

 

CMD:stop(playerid, params[])

{

PlayAudioStreamForPlayer(playerid, "Music was stoped by player.");

return 1;

}

 

CMD:youtube(playerid, params[])

{

ShowPlayerDialog(playerid, U2BDIAG, DIALOG_STYLE_LIST, WHOMADETHIS, "{46BEE6}Play for yourself\n", "Select", "Cancel");

return 1;

}

//==============================================================================

// Dialogs

//==============================================================================

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

{

if(dialogid == U2BDIAG && response)

{

switch(listitem)

{

case 0:

{

PlayerU2B[playerid] = 1;

ShowPlayerDialog(playerid,U2BDIAG+1,DIALOG_STYLE_INPUT,WHOMADETHIS,"Paste the youtube link you want to play for yourself:","Play","Cancel");

return 1;

}

}

}

if(dialogid == U2BDIAG+1 && response)

{

if(strlen(inputtext))

{

new result[128], videostr[128];

strmid(result,inputtext,31,44,strlen(inputtext));

format(videostr,sizeof(videostr),"https://www.youtube....Nw7Cdbg",result);

strmid(PlayerU2BLink[playerid], result, 0, 32);

if (PlayerU2B[playerid] == 1)

{

PlayerU2B[playerid] = 11;

HTTP(playerid,HTTP_GET,videostr,"","U2BInfo");

}

else if (PlayerU2B[playerid] == 2)

{

PlayerU2B[playerid] = 22;

ShowPlayerDialog(playerid,U2BDIAG+2,DIALOG_STYLE_INPUT,WHOMADETHIS,"Enter the player id you want to play the song for:","Play","Cancel");

new string[128];

format(string, sizeof(string), "%s", PlayerU2BLink[playerid]);

}

else if (PlayerU2B[playerid] == 3)

{

PlayerU2B[playerid] = 33;

ShowPlayerDialog(playerid,U2BDIAG+3,DIALOG_STYLE_INPUT,WHOMADETHIS,"Enter the radius in which you want the song to be heard:","Play","Cancel");

}

else if (PlayerU2B[playerid] == 4)

{

PlayerU2B[playerid] = 44;

HTTP(playerid,HTTP_GET,videostr,"","U2BInfo");

}

}

return 1;

 

}

return 0;

}

 

//==============================================================================

// Functions

//==============================================================================

 

public U2BInfo(playerid, response_code, data[])

{

if(response_code == 200)

{

new result[33], u2bstr[33]; new streamedurl[128];

new crypted = strfind(data, "\"h\"", true, -1);

strmid(result,data,crypted+7,crypted+39,strlen(data));

format(u2bstr,sizeof(u2bstr), "%s", result);

format(streamedurl, sizeof(streamedurl), "https://www.youtube....",PlayerU2BLink[playerid], u2bstr);

if(PlayerU2B[playerid] == 11)

{

PlayAudioStreamForPlayer(playerid, streamedurl);

return 1;

}

else if(PlayerU2B[playerid] == 22)

{

PlayAudioStreamForPlayer(playerid, streamedurl);

return 1;

}

else if(PlayerU2B[playerid] == 33)

{

 

PlayAudioStreamForPlayer(playerid, streamedurl);

return 1;

}

else if(PlayerU2B[playerid] == 44)

{

for(new i = 0; i < MAX_PLAYERS; i++)

{

if(IsPlayerConnected(i))

{

PlayAudioStreamForPlayer(i, streamedurl);

return 1;

}

else return 1;

}

}

else if(PlayerU2B[playerid] == 333)

{

new Float:X, Float:Y, Float:Z;

GetPlayerPos(playerid, X, Y, Z);

new radius = strval(U2BRadius[playerid]);

for(new i = 0; i < MAX_PLAYERS; i++)

{

if(IsPlayerConnected(i))

{

if(IsPlayerInRangeOfPoint(i, radius , X, Y, Z))

{

PlayAudioStreamForPlayer(i, streamedurl, X, Y, Z, radius, 1);

return 1;

}

else return 1;

}

}

}

 

}

else

{

 

new u2bstring[128];

format(u2bstring,sizeof(u2bstring),"{FF0000}Youtube link error\n\n{FFFFFF}This youtube link is broken or uses some copyright protection, we can't convert it to mp3 for streaming. Try another link please. ");

ShowPlayerDialog(playerid,61,DIALOG_STYLE_MSGBOX ,WHOMADETHIS,u2bstring, "Exit", "");

}

return 1;

}

 

 

 

Tu je aj video čo mi to robý ked tam dam tuto pesničku

http://www.youtube.com/watch?v=ORDLt26e2oM

Zde je Video: http://www.youtube.com/watch?v=Yqt7SBK9exw

Link to comment
Share on other sites

11 odpovědí na tuto otázku

Recommended Posts

  • 0

Ja to nechcem mat cez mp3 ja to chcem mat iba cez youtube že si dam copy link a vložim do tabulky

 

Sám sis odpověděl. Když to podporuje jen mp3 a ty to nechceš mít přes mp3 tak ti to asi těžko pojde :/

Link to comment
Share on other sites

  • 0

Ten plugin funguje. Youtube stránku si tam zadal zle! Počíta to 31 až 44 či tak nejakao znakov čiže aj as Http://www.youtube... to je až po watch=? alebo tak nejako 31-33 znakov.. a končí to pri 44 takže ten kód ten plugin potrebuje.. a keď tam nedáš tie 2 predpony tak to nevypočíta presne to čo potrebuje :)

Link to comment
Share on other sites

  • 0

Ale ja som to na jednom servery vydel napisal som si /youtube otovrila sa mi tabulka tam som z youtube vložil URL a dal som enter a pesnička mi hrala na servery

 

Ten plugin funguje. Youtube stránku si tam zadal zle! Počíta to 31 až 44 či tak nejakao znakov čiže aj as Http://www.youtube... to je až po watch=? alebo tak nejako 31-33 znakov.. a končí to pri 44 takže ten kód ten plugin potrebuje.. a keď tam nedáš tie 2 predpony tak to nevypočíta presne to čo potrebuje :)

 

Tak ako to spravim?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...