Klappt Leider nicht so ganz, ich habe diesen Schnippsel vor langer Zeit irgendwoher genommen und überarbeitet. Wollte das ganze mit Dialogen und TextDraws gestalten.
Erstmal OnGameModeInIt: Dies soll den Titel des YouTube Videos anzeigen, es zeigt aber garnichts an.
new stringa[100];
Textdraw16 = TextDrawCreate(270.000000, 439.000000, stringa);
format (stringa, sizeof(stringa),"Title: %s",GetVideoTitle());
TextDrawSetString(Textdraw16,stringa);
TextDrawBackgroundColor(Textdraw16, 255);
TextDrawFont(Textdraw16, 2);
TextDrawLetterSize(Textdraw16, 0.140000, 0.700000);
TextDrawColor(Textdraw16, -1);
TextDrawSetOutline(Textdraw16, 0);
TextDrawSetProportional(Textdraw16, 1);
TextDrawSetShadow(Textdraw16, 1);
dcmd_playyt(playerid,params[]) // **changed23
{
#pragma unused params
new link[128];
if (AccInfo[playerid][Level] >= 7)
{
format(link, sizeof(link),"Enter a valid Youtube Link below please.","Done","Abort");
ShowPlayerDialog(playerid, DIALOG_YOUTUBE_INPUT, DIALOG_STYLE_INPUT,"Youtube Stream",link,"Done","Abort");
return 1;
}
else return SendClientMessage(playerid,COLOR_GREY,"* You're not an Administrator to perform this command.");
}
if (dialogid == DIALOG_YOUTUBE_INPUT)
{
if (response)
{
new string[152], Titel[152], name[MAX_PLAYER_NAME];GetPlayerName(playerid,name,MAX_PLAYER_NAME);
for(new i = 0, j = GetMaxPlayers(); i < j; i++)
PlayYoutubeVideoForPlayer(i,inputtext);
format(string, sizeof(string),"* Admin %s (ID:%d) is now playing following song from YouTube: %s ", name, playerid, GetVideoTitle());
MessageToAdmins(COLOR_ADMIN,string);
format(Titel, sizeof(Titel),"%s",GetVideoTitle());
TextDrawSetString(Textdraw17, string);
TextDrawShowForAll(Textdraw17);
format(Titel, sizeof(Titel),"*Test %s ", GetVideoTitle());
TextDrawSetString(Textdraw16, Titel);
TextDrawShowForAll(Textdraw16);
}
else return SendClientMessage(playerid, COLOR_GREY,"* Dialog closed.");
}
Warum wird mir der Titel nicht angezeigt? Oh, und dann noch der Fehler hier:
dcmd_title(playerid,params[])
{
#pragma unused params
if(!IsYouTubeVideoPlaying())
{
SendClientMessage(playerid,COLOR_GREY,"* No song is currently being played.");
return 1;
}
new info[256];
format(info,sizeof(info),"%s\n\nLenght: %d Seconds\n\nLink: %s",GetVideoTitle(),GetLengthOfVideo(),GetVideoLink());
ShowPlayerDialog(playerid,DIALOG_SONGINFO,DIALOG_STYLE_MSGBOX,"Youtube - Song",info,"Got it","Close");
return 1;
}
Jedes Mal, wenn ich /title eingebe dann bekomme ich die Meldung 'No song is currently being played', obwohl etwas abgespielt wird..