Ban command
#5

Use my code.

PHP код:
CMD:ban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || PlayerInfo[playerid][pBanAppealer] >= || PlayerInfo[playerid][pModerator] >= || PlayerInfo[playerid][pSecretAdmin] >= 1)
    {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ban [playerid/partofname] [reason]");
        
//if(AntiAdv(playerid, params)) return 1;
        
if(IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin])
            {
                
/*if(AdminDuty[playerid] == 1)
                {
                    new username[MAX_PLAYER_NAME];
                    GetPVarString(playerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(playerid, "TempName", 0);
                    SetPlayerName(playerid, username);
                }
                format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]);
                ABroadCast(COLOR_YELLOW,string,2);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                Kick(playerid);
                return 1;*/
                
SendClientMessageEx(playeridCOLOR_REALRED"You are not authorized to ban administrators.");
            }
            else
            {
                new 
playerip[32];
                
GetPlayerIp(giveplayeridplayeripsizeof(playerip));
                if(
AdminDuty[giveplayerid] == || PlayerInfo[playerid][pAdmin] >= 5)
                {
                    new 
username[MAX_PLAYER_NAME];
                    
GetPVarString(giveplayerid"TempNameName"usernamesizeof(username));
                    
SetPVarInt(giveplayerid"TempName"0);
                    
SetPlayerName(giveplayeridusername);
                    
format(stringsizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], playeripGetPlayerNameEx(playerid), reason);
                    
Log("logs/ban.log"string);
                    
format(stringsizeof(string), "AdmCmd: %s was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                    
ABroadCast(COLOR_LIGHTREDstring1);
                }
                else if(
PlayerInfo[playerid][pSecretAdmin] >= 1)
                {
                    new 
username[MAX_PLAYER_NAME];
                    
GetPVarString(giveplayerid"TempNameName"usernamesizeof(username));
                    
SetPVarInt(giveplayerid"TempName"0);
                    
SetPlayerName(giveplayeridusername);
                    
format(stringsizeof(string), "SecretAdmin: %s (IP:%s) was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], playeripGetPlayerNameEx(playerid), reason);
                    
Log("logs/ban.log"string);
                    
format(stringsizeof(string), "SecretAdmin: {FFFF00}%s was banned by %s, reason: %s"PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason);
                    foreach(
Playeri)
                    {
                        if(
PlayerInfo[i][pSecretAdmin] >= 1)
                        {
                            
SendClientMessage(iCOLOR_REALREDstring);
                        }
                    }
                }
                
ABroadCast(COLOR_LIGHTREDstring1);
                new 
ip[32], hourminuteseconddaymonthyear;
                
gettime(hourminutesecond);
                
getdate(yearmonthday);
                
GetPlayerIp(giveplayerid,ip,sizeof(ip));
                
SendClientMessageEx(giveplayeridCOLOR_REALRED"You're banned from Insidious Roleplay. You can appeal your ban at neverrest-rp.tk");
                
SendClientMessageEx(giveplayeridCOLOR_LIGHTRED"-------------------- BAN REPORT --------------------");
                
format(stringsizeof(string), "Reason: %s"reason);
                
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "Current Warnings: %d (3 for BAN)"PlayerInfo[giveplayerid][pWarns]);
                
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "Staff: %s"GetPlayerNameEx(playerid));
                
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "IP Address: %s"ip);
                
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "Time: %02d:%02d:%02d on %02d/%02d/%d"hourminuteseconddaymonthyear);
                
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                
SendClientMessageEx(giveplayeridCOLOR_LIGHTRED"It is strongly recommended that you keep this report for future reference (Press F8)");
                
SendClientMessageEx(giveplayeridCOLOR_LIGHTRED"You may appeal this ban at "WEBSITE".");
                
SetTimerEx("BanTimer"20000"ds"giveplayeridip);
                
format(stringsizeof(string), "(%02d:%02d:%02d on %02d/%02d/%d) BanLogs: %s has banned %s, reason: %s",hour,minute,seconddaymonthyearGetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), reason);
                 
//UpdateRecentBans(string);
                
return 1;
            }
        } else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    return 
1;

PHP код:
CMD:unban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= || PlayerInfo[playerid][pBanAppealer] >= 1)
    {
        new 
string[128];
        if(
isnull(params)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /unban [playername]");
        if(
doesAccountExist(params))
        {
            
OnPlayerOfflineLogin(params);
            if(
PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1)
            {
                
SendClientMessage(playeridCOLOR_WHITE"Permanently banned accounts can only be unbanned via FTP.");
            }
            else
            {
                if(
PlayerInfo[MAX_PLAYERS][pBanned] >= 1)
                {
                    
PlayerInfo[MAX_PLAYERS][pBanned] = 0;
                    if(
PlayerInfo[MAX_PLAYERS][pWarns] == 3// reset warnings if they're 3
                        
PlayerInfo[MAX_PLAYERS][pWarns] = 0;
                    
RemoveBan(PlayerInfo[MAX_PLAYERS][pIP]);
                    
OnPlayerOfflineSave(params);
                    
format(string128"AdmCmd: %s (IP:%s) was unbanned by %s."paramsPlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    
ABroadCast(COLOR_LIGHTRED,string,2);
                    
format(stringsizeof(string), "AdmCmd: %s (IP:%s) was unbanned by %s."paramsPlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    
Log("logs/ban.log"string);
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_WHITE"Not a banned account!");
                }
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_WHITE"That account doesn't exist.");
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    }
    return 
1;

Reply


Messages In This Thread
Ban command - by Jigsaw123 - 24.07.2015, 14:33
Re: Ban command - by xVIP3Rx - 24.07.2015, 14:37
Re: Ban command - by Jigsaw123 - 24.07.2015, 15:04
Re: Ban command - by xVIP3Rx - 24.07.2015, 15:55
Re: Ban command - by XBrianX - 24.07.2015, 23:48

Forum Jump:


Users browsing this thread: 1 Guest(s)