IP Ban system
#6

still with the BanReason not showing..
pawn Код:
dcmd_ban(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason[100];
    new pname[MAX_PLAYER_NAME];
    new tname[MAX_PLAYER_NAME];
    if(sscanf(params,"us[100]",ID,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"[USAGE] /ban (Player Name/ID) (Reason)");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"[ERROR] The player ID you entered is not connected to the server.");
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    if(PlayerInfo[ID][pAdmin] > PlayerInfo[playerid][pAdmin])
    {
        format(string,sizeof(string),"[ERROR] You cannot use this command on a higher administration level.");
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    GetPlayerName(playerid,pname,sizeof(pname));
    GetPlayerName(ID,tname,sizeof(tname));
    if(PlayerInfo[ID][pBanned] == 1)
    {
        format(string,sizeof(string),"[ERROR] %s(%d) is already banned from the server. [Reason: %s]",tname,ID,PlayerInfo[ID][pBanReason]);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    if(InAdminMode[ID] == 1)
    {
        format(string,sizeof(string),"[ERROR] Admin %s(%d) is currently in admin mode.",tname,ID);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    format(string, sizeof(string), "~r~BANNED!");
    GameTextForPlayer(ID, string, 3000, 1);

    new pIPp[16];
    GetPlayerIp(playerid, pIPp, sizeof(pIPp));
    PlayerInfo[ID][pIP] =pIPp;
    new INI:File = INI_Open(UserPath(ID));
    INI_SetTag(File,"Player's Data");
    INI_WriteString(File,"IP",pIPp);
    INI_WriteString(File,"BanReason",cmdreason);
    INI_Close(File);
    PlayerInfo[ID][pBanned] =1;

    format(string,sizeof(string),"[BANNED] An Administrator has banned you from the server. [Reason: %s]",cmdreason);
    SendClientMessage(ID,COLOR_RED,string);
    SetTimerEx("KickPlayer",1000,false,"i",ID);
   
    format(string,sizeof(string),"[ADMIN BAN] Administrator has banned %s(%d). [Reason: %s]",tname,ID,cmdreason);
    SendClientMessageToAll(COLOR_PINK,string);

    format(string,sizeof(string),"1[ADMIN BAN] Administrator has kicked banned. [Reason: %s]",tname,ID,cmdreason);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);

    format(string,sizeof(string),"[ADMIN RADIO] Administrator %s(%d) has banned %s(%d). [Reason: %s]",pname,playerid,tname,ID,cmdreason);
    SendAdminMessage(COLOR_PINK,string);
    IRC_GroupSay(gGroupID,IRC_ADMINCHANNEL,string);
    return 1;
}
//=======================================================================//
public OnPlayerConnect(playerid)
{
    new string[128];
    new pname[24];
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        if(PlayerInfo[playerid][pBanned] == 1)
        {
          format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: %s]",PlayerInfo[playerid][pBanReason]);  //Reason isn't shown, and in the .ini it's written normally
          SendClientMessage(playerid, COLOR_RED,string);
          SendClientMessage(playerid, COLOR_RED,"[BANNED] Please Ban Appeal on our forums at www.trd.com");
          SetTimerEx("KickPlayer",1000,false,"i",playerid);
          return 1;
        }
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FF0000}The Real Deathmactch","{FFFFFF}Welcome back to the server! \n Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_WELCOMERULES, DIALOG_STYLE_MSGBOX, "{FF0000}Server Rules", "{FF0000}1.{FFFFFF}Listen to and obey admins.\n\n{FF0000}2.{FFFFFF}Don't spam.\n\n{FF0000}3.{FFFFFF}Team-Killing is forbidden.\n\n{FF0000}4.{FFFFFF}Never shoot Air-To-Ground missles.\n\n{FF0000}5.{FFFFFF}Do not hack or use cheats.\n\n{FF0000}6.{FFFFFF}Respect all players and admins.\n\n{FF0000}7.{FFFFFF}Never abuse a bug.\n\n{FF0000}8.{FFFFFF}Army & Gang should NEVER attack Medics.","Accept","Decline");
    }
    //OTHER CODES
    return 1;
}
Reply


Messages In This Thread
IP Ban system - by _Khaled_ - 29.06.2013, 20:53
Re: IP Ban system - by Firewire - 29.06.2013, 23:21
Re: IP Ban system - by _Khaled_ - 29.06.2013, 23:35
Re: IP Ban system - by _Khaled_ - 30.06.2013, 01:50
Re: IP Ban system - by _Khaled_ - 30.06.2013, 01:54
Re: IP Ban system - by _Khaled_ - 30.06.2013, 02:40
Re: IP Ban system - by Lordzy - 30.06.2013, 04:02
Re: IP Ban system - by _Khaled_ - 30.06.2013, 12:45
Re: IP Ban system - by _Khaled_ - 30.06.2013, 18:57

Forum Jump:


Users browsing this thread: 1 Guest(s)