Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===========================[DJ SYSTEM BY DH240473]==========================//
- //THANKS FOR ZEEX FOR ZCMD INCLUDE AND DRACO FOR DINI INCLUDE //
- //============================================================================//
- #include <a_samp>
- #include <dini>
- #include <zcmd>
- #include <sscanf2>
- #define PATH_1 "Dj/%s.ini"
- new Deejay[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n==========================");
- print(" DJ SYSTEM V1.0 BY DH240473");
- print("============================/n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- main()
- {
- }
- public OnPlayerConnect(playerid)
- {
- new file[MAX_PLAYERS];
- format(file, sizeof(file), PATH_1, IsPlayerName(playerid));
- if(!fexist(file))
- {
- dini_Create(file);
- dini_IntSet(file, "Deejay", 0);
- Deejay[playerid] = dini_Int(file, "Deejay");
- } else {
- Deejay[playerid] = dini_Int(file, "Deejay");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new file[MAX_PLAYERS];
- format(file, sizeof(file), PATH_1, IsPlayerName(playerid));
- dini_IntSet(file, "Deejay", Deejay[playerid]);
- Deejay[playerid] = 0;
- return 1;
- }
- stock IsPlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- cmd(stream, playerid,params[])
- {
- if(Deejay[playerid] == 1)
- {
- new url[200], pname[124], string[250];
- GetPlayerName(playerid, pname, sizeof(pname));
- if(sscanf(params, "s[200]", url)) return SendClientMessage(playerid,-1,"Usage : /stream [Url]") &&
- SendClientMessage(playerid,-1,"Function : Will stream a music for all player.");
- format(string, sizeof(string), "%s(%d) has streamed a music | Url : %s", pname, playerid, url);
- SendClientMessageToAll(-1, string);
- SendClientMessageToAll(-1, "======================================");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- PlayAudioStreamForPlayer(i, url);
- }
- SendClientMessageToAll(-1, "======================================");
- SendClientMessageToAll(-1, "Use /shh if you lagging or you don't want to hear this song");
- return 1;
- }
- else return SendClientMessage(playerid,-1,"ERROR: You're not DJ to use this command.");
- }
- cmd(shh, playerid,params[])
- {
- StopAudioStreamForPlayer(playerid);
- return 1;
- }
- cmd(shhall, playerid,params[])
- {
- if(Deejay[playerid] == 1)
- {
- new reason[200], pname[124], string[250];
- GetPlayerName(playerid, pname, sizeof(pname));
- if(sscanf(params, "s[200]", reason)) return SendClientMessage(playerid,-1,"Usage : /stopstream [Reason]") &&
- SendClientMessage(playerid,-1,"Function : Will stop the streamed music for all players.");
- for(new i = 0; i < MAX_PLAYERS; i++)
- StopAudioStreamForPlayer(i);
- format(string, sizeof(string), "Administrator %s(%d) has stopped the streamed music | Reason : %s", pname, playerid,reason );
- SendClientMessageToAll(-1, string);
- return 1;
- }
- else return SendClientMessage(playerid,-1,"You're not an admin / not enough level.");
- }
- cmd(setdj, playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new string[MAX_PLAYERS], targetid, license;
- if(sscanf(params, "ud", targetid, license)) return SendClientMessage(playerid, -1, "{FF9900}Usage: /dj [playerid] [1 - enable 0 - disable (Deejay license)]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{FF9900}Error: That player is not connected!");
- if(license == 1)
- {
- Deejay[targetid] = 1;
- format(string, sizeof(string), "{FFFF00}• You have promote the Deejay license to %s •", IsPlayerName(targetid));
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{FFFF00}• Administrator » %s has promote you the Deejay license •", IsPlayerName(playerid));
- SendClientMessage(targetid, -1, string);
- } else {
- Deejay[targetid] = 0;
- format(string, sizeof(string), "{FFFF00}• You have demote the Deejay license to %s •", IsPlayerName(targetid));
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{FFFF00}• Administrator » %s has demote you the Deejay license •", IsPlayerName(playerid));
- SendClientMessage(targetid, -1, string);
- }
- return 1;
- } else return 0;
- }
Add Comment
Please, Sign In to add comment