Quantcast
Channel: SA-MP Forums - Filterscripts
Viewing all articles
Browse latest Browse all 595

[FilterScript] DJ System

$
0
0
Introduction
hello guys i made this second filterscript name : A DJ System

Credits
ZCMD >Zeex
sscanf > Y_Less

Codes
PHP Code:

/*         Credits
 RoyalEmpire

What's new?
> Added : Commands
> Admins CMD: /setdj, /kickdj
> /playsong
> /stopsong
> /dc
> /djsay
*/
#define FILTERSCRIPT

//Includes
#include <a_samp>
#include <zcmd>
#include <sscanf2>

//New defines
new djlvl[MAX_PLAYERS];

//Colours
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_RED 0xFF0000FF
#define COLOR_LBLUE 0x99FFFFFF
#define COLOR_WHITE 0xFFFFFFFF

//Credits
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Dj System by Royal Empire");
    print(
"--------------------------------------\n");
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    return 
1;
}

public 
OnPlayerDeath(playeridkilleridreason)
{
    return 
1;
}

public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}

public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}

public 
OnPlayerText(playeridtext[])
{
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
0;
}

public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}

public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}

public 
OnRconCommand(cmd[])
{
    return 
1;
}

public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}

public 
OnObjectMoved(objectid)
{
    return 
1;
}

public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}

public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}

public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}

public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}

public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}

public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}

public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}

public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}

public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}

public 
OnPlayerUpdate(playerid)
{
    return 
1;
}

public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}

public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}

public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    return 
1;
}

public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
CMD:setdj(playeridparams[])
{
    new 
giveplayeridgiveplayer[25], playername[25], string[256];
    if (
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /setdj [playerid]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive player id!");
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    if(
djlvl[giveplayerid] > 0)
    {
        
format(string64"%s is already DJ"giveplayer);
        
SendClientMessage(playeridCOLOR_WHITEstring);
        return 
1;
    }
    else
    {
        
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
        
djlvl[playerid] = 1;
        
format(string64"You have been set as DJ.Use /djcmds for commands");
        
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
        
format(string64"You have set %s as a DJ member",giveplayer);
        
SendClientMessage(playerid,COLOR_YELLOW,string);
     }
    return 
1;
}

CMD:kickdj(playeridparams[])
{
    new 
giveplayeridgiveplayer[25], playername[25], string[256];
    if (
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /kickdj [playerid]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive player id!");
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    if(
djlvl[giveplayerid] < 1)
    {
        
format(string64"%s is already kicked from DJ"giveplayer);
        
SendClientMessage(playeridCOLOR_WHITEstring);
        return 
1;
    }
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
djlvl[playerid] = 0;
    
format(string64"You have been kicked from a DJ");
    
SendClientMessage(giveplayeridCOLOR_REDstring);
    
format(string64"You have kicked %s from a DJ",giveplayer);
    
SendClientMessage(playerid,COLOR_YELLOW,string);
    return 
1;
}


CMD:dc(playeridparams[])
{
    new 
playername[25],tmp[256];
    if(
djlvl[playerid] < 1) return 1;
    if(
sscanf(params"s[256]"tmp)) return SendClientMessage(playerid, -1"[Usage]: /dc [message]");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
format(tmpsizeof(tmp), "{99FFFF}[DJ Chat]{FFFFFF} %s: %s"playernametmp);
    for(new 
MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && djlvl[i] != 0SendClientMessage(i,COLOR_WHITE,tmp);
    }
    return 
1;
}

CMD:djsay(playeridparams[])
{
    new 
tmp[256], playername[25], tmp2[256],string[256];
    if (
djlvl[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"Error: You aren't a DJ member.");
    if (
sscanf(params"s[128]"tmp)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /djsay [message]");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if (
djlvl[playerid] == 1)
    {
    
format(tmp2sizeof(tmp2), "say %s"tmp);
    
format(stringsizeof(string), "* DJ Member: %s"tmp);
    
SendClientMessageToAll(COLOR_LBLUEstring);
    }
    
printf("[ssay] %s: %s"playernametmp);
    return 
1;
}

CMD:djcmds(playeridparams[])
{
    if(
djlvl[playerid] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"|||||===== DJ COMMANDS =====|||||");
        
SendClientMessage(playerid,COLOR_LBLUE,"/playsong, /stopsong, /dc, /djsay");
    }
    return 
1;
}

CMD:requestsong(playeridparams[])
{
    new 
playername[25],tmp[256];
    if(
sscanf(params"s[256]"tmp)) return SendClientMessage(playerid, -1"[Usage]: /requestsong [Song name]");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
format(tmpsizeof(tmp), "{99FFFF}[ Song Request ]%s: %s"playernametmp);
    for(new 
MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && djlvl[i] != 0SendClientMessage(i,COLOR_WHITE,tmp);
    }
    return 
1;
}

CMD:stopsong(playeridparams[])
{
        new 
string[256], playername[25];
        if(
djlvl[playerid] < 1) return 0;
        
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
        
format(stringsizeof(string), "{99FFFF}[DJ]{FFFFFF} %s: Stoped a song."playername);
        if(
adlvl[playerid]> 1)
        {
            
format(stringsizeof(string), "{99FFFF}[Admin]{FFFFFF} %s Had Stoped The Song."playername);
        }
        
SendClientMessageToAll2(0xFFFFFFAA,string);
        for(new 
0PLAYERSi++)
        {
             if(
IsPlayerConnected(i))
            {
                
StopAudioStreamForPlayer(i);
            }
        }
        return 
1;
}
CMD:playsong(playeridparams[])
{
        new 
string[256], playername[25], song[256];
        if(
djlvl[playerid] < 1) return 0;
        if(
sscanf(params"s[256]"song)) return SendClientMessage(playerid, -1"Usage: /playsong [url]");
        
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
        
format(stringsizeof(string), "{99FFFF}[DJ]{FFFFFF} %s has played a song."playername);
           if(
adlvl[playerid]> 1)
        {
            
format(stringsizeof(string), "{99FFFF}%s has played a song."playername);
        }
        
SendClientMessageToAll2(0xFFFFFFAA,string);
        for(new 
PLAYERSi++)
        {
                if(
IsPlayerConnected(i))
                {
                    
PlayAudioStreamForPlayer(isong);
                }
        }
        return 
1;
}
CMD:setdj(playeridparams[]) 

    new 
playerdjlvl
    else if(
sscanf(params"ui"playeriddjlvl)) return SendClientMessage(playerid, -1"Usage: /setdj [id] [0 - remove, 1-setdj]"); 
    else if(
djlvl || djlvl 1) return SendClientMessage(playerid, -1"Only levels 0-1"); 
    else if(
player == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Player Is Not Currently Connected"); 
    else 
    { 
        new 
string[128], string1[128], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME]; 
        
GetPlayerName(playerpNamesizeof(pName)); 
        
GetPlayerName(playeridtargetsizeof(target)); 
        
format(stringsizeof(string), "You have set %s DJ Member to %i"targetdjlvl); 
        
SendClientMessage(playerid, -1string); 
        
format(stringsizeof(string), "You has been set as DJ %i by %s"djlvlpName); 
        
SendClientMessage(player, -1string1); 
        
PlayerInfo[player][pDJ] = djlvl
    } 
    return 
1


Commands Help
Code:

* /setdj = To set player DJ
* /kickdj = To kick player from DJ
* /playsong = DJ can play song by this command
* /stopsong = DJ can stop the song by this command
* /dc = DJ's can chat with this command
* /djsay = DJ's can announce by this command
* /requestsong = players can request song with this command
* /setdj = new Dj with saving


*= New
*Added /stopsong
*Added /playsong
I hope this script will good for you guys
+Rep if you like it

Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>