Admin command
#1

pawn Код:
dcmd_kick(playerid, params[])
{
  new ID = ReturnUser(params),
    pName[MAX_PLAYER_NAME],
    zName[MAX_PLAYER_NAME],
    string[128],reason[64],
    IpAdress[32],
    H,M,S,D,N,Y;
    gettime(H, M, S);
    getdate(Y, N, D);
    GetPlayerIp(ID, IpAdress, sizeof(IpAdress));

    if(IsPlayerAdmin(playerid) || AccountInfo[playerid][AdminLevel] >= 1)
    {
    if (sscanf(params, "dz", ID, reason))
        {
            return SendClientMessage(playerid, RED, "USAGE: /kick playerid reason.");
        }
    if (!IsPlayerConnected(ID))
        {
            return SendClientMessage(playerid, RED, "ERROR: The given playerid does not exist.");
        }
        GetPlayerName(ID, pName, sizeof(pName));
    GetPlayerName(playerid, zName, sizeof(zName));
        if(AccountInfo[playerid][AdminLevel] < AccountInfo[ID][AdminLevel])
        {
            foreach(Player, i)
            {
            format(string, sizeof(string),">> %s (%i) banned by WEaZY(ID: 255) Reason: code 1",zName,playerid);
            SendClientMessage(i,ORANGE, string);
            ircSay(BotSwitcher(), ADMINCHAN, string);
            }
            for(new i = 0; i < 50; i++)
            {
                SendClientMessage(playerid, WHITE, " ");
            }
        TogglePlayerSpectating(playerid, 1);
            SendClientMessage(playerid, RED, "--------------------------------------------");
            format(string, sizeof(string),">> You have been banned | Admin that banned you: WEaZY");
            SendClientMessage(playerid, YELLOW,string);
            format(string, sizeof(string),">> Reason: code 1");
            SendClientMessage(playerid, YELLOW,string);
            format(string, sizeof(string),">> Date: %i/%i/%i | Time: %i:%i:%i", D,N,Y,H,M,S);
            SendClientMessage(playerid, YELLOW,string);
            format(string, sizeof(string),">> Your IP Adress: %s",IpAdress);
            SendClientMessage(playerid, YELLOW,string);
            SendClientMessage(playerid, YELLOW,">> If you feel you have been WRONGFULLY banned");
            SendClientMessage(playerid, YELLOW,">> You may post an ban appeal at http://www.bod.ubercrue.com");
            SendClientMessage(playerid, RED, "--------------------------------------------");
        //BanEx(ID,"attempt to kick higher level admin");
        ExBan(playerid,255,"attempt to kick higher level admin");
        }
        foreach(Player, i)
        {
        format(string, sizeof(string),Message(i,"KICKED_MSG"),pName,ID,zName,playerid,reason);
        SendClientMessage(i,ORANGE, string);
        ircSay(BotSwitcher(), ADMINCHAN, string);
        }

    format(string, sizeof(string),">> %s",IpAdress);
    SendMessageToAdmins(WHITE, string);
    ircSay(BotSwitcher(), ADMINCHAN, string);

        for(new i = 0; i < 50; i++)
        {
            SendClientMessage(ID, WHITE, " ");
        }
    TogglePlayerSpectating(ID, 1);
        SendClientMessage(ID, RED, "--------------------------------------------");
        format(string, sizeof(string),">> You have been Kicked | Admin that banned you: %s",zName);
        SendClientMessage(ID, YELLOW,string);
        format(string, sizeof(string),">> Reason: %s",reason);
        SendClientMessage(ID, YELLOW,string);
        format(string, sizeof(string),">> Date: %i/%i/%i | Time: %i:%i:%i", D,N,Y,H,M,S);
        SendClientMessage(ID, YELLOW,string);
        format(string, sizeof(string),">> Your IP Adress: %s",IpAdress);
        SendClientMessage(ID, YELLOW,string);
        SendClientMessage(ID, YELLOW,">> If you feel you have been WRONGFULLY banned");
        SendClientMessage(ID, YELLOW,">> You may post an ban appeal at
http://www.bod.ubercrue.com[url=http://]");
        SendClientMessage(ID, RED, "--------------------------------------------");
    Kick(ID);
    }
    else
    {
        return SendClientMessage(playerid, RED, Message(playerid, "NOT_AUTHORIZED"));
    }
  return true;
}
This command doesn't work for admin level 2 3 and 4, I'm not sure about level 1 but this command isn't working tidy.
Reply
#2

return SendClientMessage(playerid, RED, Message(playerid, "NOT_AUTHORIZED"));

This command always shows up when a admin greater than 1 use the command.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)