Advertisement
dh240473

[Filterscript] DJ System

Sep 26th, 2015
2,953
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.25 KB | None | 0 0
  1. //===========================[DJ SYSTEM BY DH240473]==========================//
  2. //THANKS FOR ZEEX FOR ZCMD INCLUDE AND DRACO FOR DINI INCLUDE                 //
  3. //============================================================================//
  4. #include <a_samp>
  5. #include <dini>
  6. #include <zcmd>
  7. #include <sscanf2>
  8. #define PATH_1 "Dj/%s.ini"
  9. new Deejay[MAX_PLAYERS];
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     print("\n==========================");
  14.     print(" DJ SYSTEM V1.0 BY DH240473");
  15.     print("============================/n");
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     return 1;
  22. }
  23. main()
  24. {
  25. }
  26. public OnPlayerConnect(playerid)
  27. {
  28.     new file[MAX_PLAYERS];
  29.     format(file, sizeof(file), PATH_1, IsPlayerName(playerid));
  30.     if(!fexist(file))
  31.     {
  32.     dini_Create(file);
  33.     dini_IntSet(file, "Deejay", 0);
  34.     Deejay[playerid] = dini_Int(file, "Deejay");
  35.     } else {
  36.     Deejay[playerid] = dini_Int(file, "Deejay");
  37.     }
  38.     return 1;
  39. }
  40.  
  41. public OnPlayerDisconnect(playerid, reason)
  42. {
  43.     new file[MAX_PLAYERS];
  44.     format(file, sizeof(file), PATH_1, IsPlayerName(playerid));
  45.     dini_IntSet(file, "Deejay", Deejay[playerid]);
  46.     Deejay[playerid] = 0;
  47.     return 1;
  48. }
  49. stock IsPlayerName(playerid)
  50. {
  51.     new name[MAX_PLAYER_NAME];
  52.     GetPlayerName(playerid, name, sizeof(name));
  53.     return name;
  54. }
  55. cmd(stream, playerid,params[])
  56. {
  57.     if(Deejay[playerid] == 1)
  58.     {
  59.         new url[200], pname[124], string[250];
  60.         GetPlayerName(playerid, pname, sizeof(pname));
  61.         if(sscanf(params, "s[200]", url)) return SendClientMessage(playerid,-1,"Usage : /stream [Url]") &&
  62.         SendClientMessage(playerid,-1,"Function : Will stream a music for all player.");
  63.         format(string, sizeof(string), "%s(%d) has streamed a music | Url : %s", pname, playerid, url);
  64.         SendClientMessageToAll(-1, string);
  65.         SendClientMessageToAll(-1, "======================================");
  66.         for(new i = 0; i < MAX_PLAYERS; i++)
  67.         {
  68.             PlayAudioStreamForPlayer(i, url);
  69.         }
  70.         SendClientMessageToAll(-1, "======================================");
  71.         SendClientMessageToAll(-1, "Use /shh if you lagging or you don't want to hear this song");
  72.         return 1;
  73.     }
  74.     else return SendClientMessage(playerid,-1,"ERROR: You're not DJ to use this command.");
  75. }
  76. cmd(shh, playerid,params[])
  77. {
  78.     StopAudioStreamForPlayer(playerid);
  79.     return 1;
  80. }
  81. cmd(shhall, playerid,params[])
  82. {
  83.     if(Deejay[playerid] == 1)
  84.     {
  85.         new reason[200], pname[124], string[250];
  86.         GetPlayerName(playerid, pname, sizeof(pname));
  87.         if(sscanf(params, "s[200]", reason)) return SendClientMessage(playerid,-1,"Usage : /stopstream [Reason]") &&
  88.         SendClientMessage(playerid,-1,"Function : Will stop the streamed music for all players.");
  89.         for(new i = 0; i < MAX_PLAYERS; i++)
  90.         StopAudioStreamForPlayer(i);
  91.         format(string, sizeof(string), "Administrator %s(%d) has stopped the streamed music | Reason : %s", pname, playerid,reason );
  92.         SendClientMessageToAll(-1, string);
  93.         return 1;
  94.     }
  95.     else return SendClientMessage(playerid,-1,"You're not an admin / not enough level.");
  96. }
  97. cmd(setdj, playerid, params[])
  98. {
  99.     if(IsPlayerAdmin(playerid))
  100.     {
  101.         new string[MAX_PLAYERS], targetid, license;
  102.         if(sscanf(params, "ud", targetid, license)) return SendClientMessage(playerid, -1, "{FF9900}Usage: /dj [playerid] [1 - enable 0 - disable (Deejay license)]");
  103.         if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{FF9900}Error: That player is not connected!");
  104.         if(license == 1)
  105.         {
  106.         Deejay[targetid] = 1;
  107.         format(string, sizeof(string), "{FFFF00}• You have promote the Deejay license to %s •", IsPlayerName(targetid));
  108.         SendClientMessage(playerid, -1, string);
  109.         format(string, sizeof(string), "{FFFF00}• Administrator » %s has promote you the Deejay license •", IsPlayerName(playerid));
  110.         SendClientMessage(targetid, -1, string);
  111.         } else {
  112.         Deejay[targetid] = 0;
  113.         format(string, sizeof(string), "{FFFF00}• You have demote the Deejay license to %s •", IsPlayerName(targetid));
  114.         SendClientMessage(playerid, -1, string);
  115.         format(string, sizeof(string), "{FFFF00}• Administrator » %s has demote you the Deejay license •", IsPlayerName(playerid));
  116.         SendClientMessage(targetid, -1, string);
  117.         }
  118.         return 1;
  119.     } else return 0;
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement