14.05.2014, 15:24
Hello this is my second release, it is a very simple Mp3 player that uses dialogs and also attaches the headphones object on to the players head has only 2 commands very simple and might inspire some people to improve i dont know but here it is ! so i apreciate contructive comments please and thank you for reading.
MP3 Player in dialogs with Headphones object : 
Code:
// mp3 thingy with headphones object on player head...
// By Charlie Sanchez !
#include <a_samp>
#include <zcmd>
#define PASFP PlayAudioStreamForPlayer
#define SASFP StopAudioStreamForPlayer
//-------- MP3 Dialog-------//
#define DIALOG_MP3 21
#define COLOR_RED 0xA10000AA
#define COLOR_GREY 0xAFAFAFAA
//----------MP3 player--------//
new Mp3Status[MAX_PLAYERS]; // Variable that is gonna hold the mp3 status.
CMD:mp3(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_RED, "URL's must end in .mp3 / .pls");
SendClientMessage(playerid, COLOR_GREY, "[Usage:] /mp3off to remove headphones and stop the player");
Mp3Status[playerid] = 1;
ShowPlayerDialog(playerid, DIALOG_MP3, DIALOG_STYLE_INPUT, "MP3 /Radio Player", "Insert MP3/Radio URL here", "Play", "Cancel");
SetPlayerAttachedObject(playerid, 4, 19421, 2, 0.050000, -0.014999, 0.000000, 95.000000, 183.000000, 89.000000, 1, 1, 1, 0xffffffff);
//new sendername[MAX_PLAYER_NAME], string[200];
//GetPlayerName(playerid, sendername, sizeof(sendername));
//sendername[strfind(sendername,"_")] = ' ';
//format(string, sizeof(string), "*%s reaches for the mp3/radio player switches it on, and puts the headphones on.", sendername);
//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
return 1;
}
CMD:mp3off(playerid, params[])
{
if(Mp3Status[playerid] == 1)
{
//new sendername[MAX_PLAYER_NAME], string[200];
//GetPlayerName(playerid, sendername, sizeof(sendername));
//sendername[strfind(sendername,"_")] = ' ';
//format(string, sizeof(string), "*%s reaches for the mp3/radio player switches it off, and takes the headphones off.", sendername);
//ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Mp3Status[playerid] = 0;
RemovePlayerAttachedObject(playerid, 4);
SASFP(playerid);
return 1;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_MP3)
{
PlayAudioStreamForPlayer(playerid, inputtext);
return 1;
}
return 1;
}
Dowload links (mediafire):
http://www.mediafire.com/download/es...MP3_Player.rar
Pastebin links :
http://pastebin.com/qrztxtku


