Kinda hard to make a title
#1

Alright so I'm creating/editing our servers /kick /skick /sban /ban /banip ETC, to if they're trying to do anything to me, it won't do anything apart from kicking them/sending them an error.

pawn Код:
new GD[MAX_PLAYERS];
   #define KICKSIRENFALL 2958

    if(dialogid == KICKSIRENFALL)
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        new string2[128];
        format(string2, 128,"A fool named %s has tried to kick you and failed.", name);
        foreach(Player, i)
        {
            if(GD[i] == 2)
            {
                SendClientMessage(i, COLOR_ORANGE, string2);
                break;
            }
        }
        Kick(playerid);
    }
pawn Код:
CMD:kick(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1 )
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
                ABroadCast(COLOR_YELLOW,string,2);
                Kick(playerid);
                return 1;
            }
            else if(GD[giveplayerid] == 2) return ShowPlayerDialog(playerid, KICKSIRENFALL,DIALOG_STYLE_MSGBOX,"You fool!","You cannot touch him!", "Oh shit!", "STAHP");
            else
            {
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
                Log("logs/kick.log", string);
                if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
                format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                Kick(giveplayerid);
            }
        }
        else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player ID.");
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not allowed to use this command.");
    return 1;
}
pawn Код:
CMD:skick(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /skick [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /skick a higher admin.", GetPlayerNameEx(playerid));
                ABroadCast(COLOR_YELLOW,string,2);
                Kick(playerid);
                return 1;
            }
            else if(GD[giveplayerid] == 2) return ShowPlayerDialog(playerid, KICKSIRENFALL,DIALOG_STYLE_MSGBOX,"You fool!","You cannot touch him!", "Oh shit!", "STAHP");
            else
            {
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was silent kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
                Log("logs/kick.log", string);
                format(string, sizeof(string), "AdmCmd: %s was silent kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                ABroadCast(COLOR_LIGHTRED,string,2);
                Kick(giveplayerid);
            }
            return 1;

        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}
pawn Код:
CMD:sban(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /sban [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /sban a higher admin.", GetPlayerNameEx(playerid));
                ABroadCast(COLOR_YELLOW,string,2);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            if(GD[giveplayerid])
            {
                SendClientMessage(playerid, COLOR_GREY, "You cannot ban Sirenfall. You were banned instead.");
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                format(reason, sizeof(reason), "Trying to ban Sirenfall.");
                GetPlayerIp(playerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was automatically banned, reason: %s (%d-%d-%d)", GetPlayerNameEx(playerid), playerip,reason,month,day,year);
                Log("logs/ban.log", string);
                format(string, sizeof(string), "AdmCmd: %s was banned by the system, reason: %s", GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                PlayerInfo[playerid][pBanned] = 1;
                format(PlayerInfo[playerid][pFlag], 128, "");
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            new year, month,day;
            getdate(year, month, day);
            new playerip[32];
            GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
            format(string, sizeof(string), "AdmCmd: %s (IP:%s) was silent banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
            Log("logs/ban.log", string);
            format(string, sizeof(string), "AdmCmd: %s was silent banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            ABroadCast(COLOR_LIGHTRED,string,2);
            PlayerInfo[giveplayerid][pBanned] = 1;
            new ip[32];
            GetPlayerIp(giveplayerid,ip,sizeof(ip));
            AddBan(ip);
            Kick(giveplayerid);
            return 1;

        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}
pawn Код:
CMD:banip(playerid, params[])
{
    if(IsPlayerConnected(playerid)) {
        new string[128], tmp[32];
        if(sscanf(params, "s[32]", tmp)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /banip [ip]");
        OnPlayerOfflineLogin("Sirenfall");
        if(!strcmp(tmp,PlayerInfo[MAX_PLAYERS][pIP])) return SendClientMessage(playerid, COLOR_GREY, "That IP is unbannable.");
        if(PlayerInfo[playerid][pAdmin] >= 1337 && PlayerInfo[playerid][pAdmin] != -1) {
            AddBan(tmp);
            format(string, sizeof(string), "AdmCmd: %s has banned IP:%s", GetPlayerNameEx(playerid), tmp);
            ABroadCast(COLOR_LIGHTRED,string,2);
        } else {
            SendClientMessage(playerid, COLOR_GRAD2, "   You are not authorized to use that command !");
        }
    }
    return 1;
}
pawn Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
    if (PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pAdmin] != -1)
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
            {
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
                ABroadCast(COLOR_YELLOW,string,2);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            if(GD[giveplayerid])
            {
                SendClientMessage(playerid, COLOR_GREY, "You cannot ban Sirenfall. You were banned instead.");
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                format(reason, sizeof(reason), "Trying to ban Sirenfall.");
                GetPlayerIp(playerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was automatically banned, reason: %s (%d-%d-%d)", GetPlayerNameEx(playerid), playerip,reason,month,day,year);
                Log("logs/ban.log", string);
                format(string, sizeof(string), "AdmCmd: %s was banned by the system, reason: %s", GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                PlayerInfo[playerid][pBanned] = 1;
                format(PlayerInfo[playerid][pFlag], 128, "");
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;
            }
            else
            {
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
                format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
                Log("logs/ban.log", string);
                format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                SendClientMessageToAllEx(COLOR_LIGHTRED, string);
                PlayerInfo[giveplayerid][pBanned] = 1;
                format(PlayerInfo[giveplayerid][pFlag], 128, "");
                new ip[32];
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(giveplayerid);
                return 1;
            }

        }
    }
    else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
    return 1;
}
pawn Код:
CMD:banaccount(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
        return 1;
    }

    new string[128], playername[MAX_PLAYER_NAME], reason[64];
    if(sscanf(params, "ss", playername, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /banaccount [playername] [reason]");

    if(!strcmp(playername, "Sirenfall"))
    {
        SendClientMessage(playerid, COLOR_GREY, "You cannot ban Sirenfall, even when I'm offline. You were banned instead.");
        new year, month,day;
        getdate(year, month, day);
        new playerip[32];
        format(reason, sizeof(reason), "Trying to ban Sirenfall.");
        GetPlayerIp(playerid, playerip, sizeof(playerip));
        format(string, sizeof(string), "AdmCmd: %s(IP:%s) was automatically banned, reason: %s (%d-%d-%d)", GetPlayerNameEx(playerid), playerip,reason,month,day,year);
        Log("logs/ban.log", string);
        format(string, sizeof(string), "AdmCmd: %s was banned by the system, reason: %s", GetPlayerNameEx(playerid), reason);
        SendClientMessageToAllEx(COLOR_LIGHTRED, string);
        PlayerInfo[playerid][pBanned] = 1;
        format(PlayerInfo[playerid][pFlag], 128, "");
        new ip[32];
        GetPlayerIp(playerid,ip,sizeof(ip));
        AddBan(ip);
        Kick(playerid);
        return 1;
    }
    new giveplayerid = ReturnUser(playername);
    if(IsPlayerConnected(giveplayerid))
    {
        if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
        {
            format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", GetPlayerNameEx(playerid));
            ABroadCast(COLOR_YELLOW,string,2);
            PlayerInfo[playerid][pBanned] = 1;
            new ip[32];
            GetPlayerIp(giveplayerid,ip,sizeof(ip));
            AddBan(ip);
            Kick(giveplayerid);
        }
        else
        {
            new year, month,day;
            getdate(year, month, day);
            new playerip[32];
            GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
            format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
            Log("logs/ban.log", string);
            SendClientMessage(playerid, COLOR_WHITE, "The player is online and has been banned!");
            format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            SendClientMessageToAllEx(COLOR_LIGHTRED, string);
            PlayerInfo[giveplayerid][pBanned] = 1;
            format(PlayerInfo[giveplayerid][pFlag], 128, "");
            new ip[32];
            GetPlayerIp(giveplayerid,ip,sizeof(ip));
            AddBan(ip);
            Kick(giveplayerid);
        }
    }
    else if(doesAccountExist(playername))
    {
        OnPlayerOfflineLogin(playername);
        if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 )
        {
            SendClientMessageEx( playerid, COLOR_WHITE, "That player is already permabanned!" );
            return 1;
        }
        if( PlayerInfo[MAX_PLAYERS][pAdmin] >= 2 )
        {
            SendClientMessageEx( playerid, COLOR_WHITE, "You can not ban admin accounts!" );
            return 1;
        }
        else
        {
            if( PlayerInfo[MAX_PLAYERS][pBanned] >= 0 )
            {
                PlayerInfo[MAX_PLAYERS][pBanned] = 1;
                AddBan(PlayerInfo[MAX_PLAYERS][pIP]);
                OnPlayerOfflineSave(playername);
                new year, month,day;
                getdate(year, month, day);
                format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline banned by %s, reason: %s (%d-%d-%d)", playername, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), reason, month, day, year);
                Log("logs/ban.log", string);
                format(string, 128, "AdmCmd: %s (IP:%s) was offline banned by %s, reason: %s", playername, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), reason);
                ABroadCast(COLOR_LIGHTRED,string,2);
                print(string);
            }
            else
            {
                SendClientMessageEx( playerid, COLOR_WHITE, "Already a banned account!" );
            }
        }
    }
    else
    {
        SendClientMessageEx( playerid, COLOR_WHITE, "That account doesn't exist." );
    }
    return 1;
}
Reply


Messages In This Thread
Kinda hard to make a title - by James Bob - 17.10.2013, 15:50

Forum Jump:


Users browsing this thread: 1 Guest(s)