Autocheck if a person was banned previously
#8

Well I don't know what does the /kick command have to do with anything here but in /ban just change the native Ban() to BanIp if you want to ban his IP or too BanIp AND BanName to ban both:

pawn Код:
CMD:ban(playerid, params[])
{
    new id, reason[128];
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
    else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id/name][reason]");
    else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not ban yourself!");
    else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_WHITE,"Error: You can not ban another admin!");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else {
        new Name3[MAX_PLAYER_NAME], BanMessage[128];
        new Name4[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name3, sizeof(Name3));
        GetPlayerName(id, Name4, sizeof(Name4));
        format(BanMessage, sizeof(BanMessage), "%s(%d) has Banned player %s(%d). Reason: %s", Name3, playerid, Name4, id);
        SendClientMessageToAll(COLOR_WHITE, BanMessage);
        BanName(Name4);
                GetPlayerIp(id, Name4, sizeof(Name4));
                BanIp(Name4);
    }
    return 1;
}
This code will ban both by name AND by ip.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)