Guest User

Mp3 Player with headphones object

a guest
May 14th, 2014
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.21 KB | None | 0 0
  1. // mp3 thingy with headphones object on player head...
  2.  
  3. // By Charlie Sanchez !
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7.  
  8. #define PASFP PlayAudioStreamForPlayer
  9. #define SASFP StopAudioStreamForPlayer
  10.  
  11. //-------- MP3 Dialog-------//
  12. #define DIALOG_MP3 21
  13.  
  14.  
  15. #define COLOR_RED 0xA10000AA
  16. #define COLOR_GREY 0xAFAFAFAA
  17.  
  18. //----------MP3 player--------//
  19. new Mp3Status[MAX_PLAYERS]; // Variable that is gonna hold the mp3 status.
  20.  
  21.  
  22.  
  23. CMD:mp3(playerid, params[])
  24. {
  25.     if(IsPlayerConnected(playerid))
  26.     {
  27.         SendClientMessage(playerid, COLOR_RED, "URL's must end in .mp3 / .pls");
  28.         SendClientMessage(playerid, COLOR_GREY, "[Usage:] /mp3off to remove headphones and stop the player");
  29.         Mp3Status[playerid] = 1;
  30.         ShowPlayerDialog(playerid, DIALOG_MP3, DIALOG_STYLE_INPUT, "MP3 /Radio Player", "Insert MP3/Radio URL here", "Play", "Cancel");
  31.         SetPlayerAttachedObject(playerid, 4, 19421, 2, 0.050000, -0.014999, 0.000000, 95.000000, 183.000000, 89.000000, 1, 1, 1, 0xffffffff);
  32.         //new sendername[MAX_PLAYER_NAME], string[200];
  33.         //GetPlayerName(playerid, sendername, sizeof(sendername));
  34.         //sendername[strfind(sendername,"_")] = ' ';
  35.         //format(string, sizeof(string), "*%s reaches for the mp3/radio player switches it on, and puts the headphones on.", sendername);
  36.         //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  37.         return 1;
  38.     }
  39.     return 1;
  40. }
  41. CMD:mp3off(playerid, params[])
  42. {
  43.     if(Mp3Status[playerid] == 1)
  44.     {
  45.         //new sendername[MAX_PLAYER_NAME], string[200];
  46.         //GetPlayerName(playerid, sendername, sizeof(sendername));
  47.         //sendername[strfind(sendername,"_")] = ' ';
  48.         //format(string, sizeof(string), "*%s reaches for the mp3/radio player switches it off, and takes the headphones off.", sendername);
  49.         //ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  50.         Mp3Status[playerid] = 0;
  51.         RemovePlayerAttachedObject(playerid, 4);
  52.         SASFP(playerid);
  53.         return 1;
  54.     }
  55.     return 1;
  56. }
  57.  
  58.  
  59.  
  60. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  61. {
  62.     if(dialogid == DIALOG_MP3)
  63.     {
  64.         PlayAudioStreamForPlayer(playerid, inputtext);
  65.         return 1;
  66.     }
  67.     return 1;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment