admin script
#3

pawn Код:
CMD:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1) {
        new targetid, reason;
        new VBName[MAX_PLAYER_NAME];
        new VBName1[MAX_PLAYER_NAME];
        GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
        GetPlayerName(targetid, VBName1, MAX_PLAYER_NAME);
        if(sscanf(params, "ri", targetid, reason)) return SendClientMessage(playerid, COLOR_PURPLE,"Usage: /kick [playerid] [reason]");
        if(targetid == playerid) return SendClientMessage(playerid, COLOR_DRED, "You Can't Kick Yourself!");
        if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_DRED, "You Can't Kick Higher Administrators!");
        else {
            new str[128];
            format(str, sizeof(str), "Administrator %s Has Kicked %s Reason: %d!", VBName, VBName1, reason);
            SendClientMessageToAll(COLOR_DRED,str);
            Kick(targetid);
        }
    }
    else return SendClientMessage(playerid, COLOR_DRED, "You Need To Be A Administrator!");
    return 1;
}

CMD:warn(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid) || PlayerInfo[playerid][pVip] >= 3)
    {
        new reason[32];
        new targetid;
        if(sscanf(params, "rs[32]", targetid, reason))
            return SendClientMessage(playerid, COLOR_PURPLE,"Usage: /warn [playerid] [reason]");
        if(targetid == playerid) return SendClientMessage(playerid, COLOR_DRED, "You Can't Warn Yourself!");


        new str[128],Name[MAX_PLAYER_NAME],Name1[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(targetid, Name1, MAX_PLAYER_NAME);
        format(str, sizeof(str), "Administrator %s Has Warned %s Reason: %s!", Name, Name1, reason);
        SendClientMessageToAll(COLOR_DRED,str);
        Warns[targetid] ++;
    }
    return true;
}
       

CMD:setlevel(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || IsPlayerAdmin(playerid)) {
        new VBName[MAX_PLAYER_NAME];
        new VBName1[MAX_PLAYER_NAME];
        new targetid;
        GetPlayerName(playerid, VBName, MAX_PLAYER_NAME);
        GetPlayerName(targetid, VBName1, MAX_PLAYER_NAME);
        new
            iAdminValue,
            iTargetID;

        if(sscanf(params, "di", iTargetID, iAdminValue)) {
            SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /setlevel [playerid] [level]");
        }
        else if(IsPlayerConnected(iTargetID)) {
            new
                szMessage[47 + (MAX_PLAYER_NAME * 2)];

            if(iAdminValue < 0 || iAdminValue > 5) return SendClientMessage(playerid, COLOR_PURPLE, "Valid range is 0 - 5.");
            PlayerInfo[iTargetID][pAdmin] = iAdminValue;
            format(szMessage, sizeof(szMessage), "Administrator %s has promoted %s to a level %d admin.", VBName, VBName1, iAdminValue);
            SendStaffMessage(COLOR_PURPLE,szMessage);
            format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, VBName);
            SendClientMessage(iTargetID, COLOR_PURPLE, szMessage);
            format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", VBName1,iAdminValue);
            SendClientMessage(playerid, COLOR_PURPLE, szMessage);
        }
        else SendClientMessage(playerid, COLOR_PURPLE, "Invalid player specified.");
    }
    return 1;
}
Reply


Messages In This Thread
admin script - by royriky123 - 18.06.2012, 20:07
Re: admin script - by thefatshizms - 18.06.2012, 20:10
Re: admin script - by Audi_Quattrix - 18.06.2012, 20:13
Re: admin script - by WagnerPM - 18.06.2012, 20:16
Re: admin script - by royriky123 - 18.06.2012, 20:18
Re: admin script - by mickos - 18.06.2012, 20:22
Re: admin script - by thefatshizms - 18.06.2012, 20:28
Re: admin script - by mickos - 18.06.2012, 20:46
Re: admin script - by royriky123 - 18.06.2012, 20:50
Re: admin script - by thefatshizms - 18.06.2012, 20:53

Forum Jump:


Users browsing this thread: 2 Guest(s)