Scripting Admin Commands.
#5

pawn Код:
CMD:a(playerid, params[])
{ //First Bracket open
    if(IsPlayerAdmin(playerid)) //Check if is player admin, you can change it with your variable
    { //Second Bracket Open
        new string[256]; //String Variable
        new CName[24]; //Name
        if(isnull(params)) return SendClientMessage(playerid, -1, "Syntax: /a [text]"); //if The Input chat is nothing then this message will send
        GetPlayerName(playerid, CName, 24); //Get the name of the player
        for(new x=0; x < MAX_PLAYERS; x++) //Get All ID's
        { //3rd Bracket open
            if(IsPlayerConnected(x))//Is the ID is being Used by anyone?
            { //fourth Bracket Open
               if(IsPlayerAdmin(x)) //Get if that id that being used is admin.
               { //Fifth Brack Open
                     format(string, sizeof(string), "[Admin Chat] %s(%d) Says: %s", CName,playerid,params); //Making a string..
                     SendClientMessage(x, 0xFF0000AA, string); //Send all admin client message...
               } //Fifth Bracket Closed
            } //Fourth Bracked Closed
        } //Third Bracket Closed
    } //Second Bracket Closed
    else SendClientMessage(playerid,0xFF0000AA,"You do not have the right admin permissions for this command!"); //if not admin send him this.
    return 1; //Return 0 = False, 1 = True
} //First bracket Closed
pawn Код:
CMD:aweaps(playerid, params[])
{ //First Bracket open
    if(IsPlayerAdmin(playerid)) //Check if is player admin, you can change it with your variable
    { //Second Bracket Open
          GivePlayerWeapon(playerid,31,1000); //Giving him a  m4
          GivePlayerWeapon(playerid,16,1000); //Giving him a  Grenade
          GivePlayerWeapon(playerid,34,1000); //Giving him a  Sniper Rifle
          GivePlayerWeapon(playerid,28,1000); //Giving him a  Uzi
          GivePlayerWeapon(playerid,24,1000); //Giving him a  Deagle
          GivePlayerWeapon(playerid,26,1000); //Giving him a  Sawn Off
          GivePlayerWeapon(playerid,42,1000); //Giving him a  Fire Extinguisher
          GivePlayerWeapon(playerid,14,1000); //Giving him a  Flowers
          GivePlayerWeapon(playerid,46,1000);//Giving him a  Parachute
          //GivePlayerWeapon 1st option is Weapon id and second is there ammo, you can get weapon ids here https://sampwiki.blast.hk/wiki/Weapons
          else SendClientMessage(playerid,0xFF0000AA,"You do not have the right admin permissions for this command!"); //if not admin send him this.
    }
    return 1; //Return 0 = False, 1 = True
} //First bracket Closed
pawn Код:
CMD:kick(playerid,params[])
{ //First Bracket open
    if(IsPlayerAdmin(playerid)) //Check if is player admin, you can change it with your variable
    { //Second Bracket Open
        new targetid,string[256],pname[50],tname[50]; //String and Targetid Variable, player/targetplayer name variable
        if(isnull(params)) return SendClientMessage(playerid, -1, "Syntax: /kick [playerid]"); //if The Input chat is nothing then this message will send
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player is not online"); //If That Player Is Connected
        GetPlayerName(playerid, pname, 24); //Get the name of the player
        GetPlayerName(targetid, tname, 24); //Get the name of the player
        format(string, sizeof(string), "Admin %s(%d) has kicked %s(%d)",pname,playerid,tname,targetid);
        SendClientMessageToAll(COLOR_BLUE,string);
        Kick(targetid); //Kick That Player
    } //Second Brack Closed
    else SendClientMessage(playerid,0xFF0000AA,"You do not have the right admin permissions for this command!"); //if not admin send him this.
    return 1; //Return 0 = False, 1 = True
} //First bracket Closed
Reply


Messages In This Thread
Scripting Admin Commands. - by CesarLT - 04.06.2014, 19:01
Re: Scripting Admin Commands. - by MacT - 04.06.2014, 19:19
Re: Scripting Admin Commands. - by CesarLT - 04.06.2014, 19:20
Re: Scripting Admin Commands. - by MacT - 04.06.2014, 19:43
Re: Scripting Admin Commands. - by ReD_HunTeR - 04.06.2014, 19:48
Re: Scripting Admin Commands. - by CesarLT - 04.06.2014, 19:50
Re: Scripting Admin Commands. - by Johnson_Brooks - 04.06.2014, 19:54
Re: Scripting Admin Commands. - by CesarLT - 04.06.2014, 22:22
Re: Scripting Admin Commands. - by CesarLT - 05.06.2014, 12:46
Re: Scripting Admin Commands. - by MacT - 05.06.2014, 12:57

Forum Jump:


Users browsing this thread: 2 Guest(s)