citromhun

Music library

Mar 30th, 2014
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.86 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define DIALOG_PLAYLIST         1
  5.  
  6. new str[512];
  7.  
  8. new Music[][][] = {
  9.  
  10.     {"Music name","http://yourwebsite.com/"}
  11. };
  12.  
  13. public OnFilterScriptInit() return print("Music library - Loaded...");
  14.  
  15. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  16. if(dialogid == DIALOG_PLAYLIST) {
  17.         if(response) {
  18.             PlayAudioStreamForPlayer(playerid, Music[listitem][1]);
  19.         }
  20.     }
  21. return 1;
  22. }
  23.  
  24. CMD:sm(playerid) return cmd_stopmusic(playerid);
  25. CMD:stopmusic(playerid) {
  26.     StopAudioStreamForPlayer(playerid);
  27.     return 1;
  28. }
  29.  
  30. CMD:playlist(playerid) {
  31.     new output[1024] = EOS;
  32.     for(new i = 0; i < sizeof(Music); i++) {
  33.         strcat(output, Music[i][0]);
  34.         strcat(output, "\n");
  35.     }
  36.     ShowPlayerDialog(playerid, DIALOG_PLAYLIST, DIALOG_STYLE_LIST, "Music list",output,"Play","Close");
  37.     return 1;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment