/unban doesn't work
#1

Hello ,when i do /unban it says
Код:
"AdmCmd: %s (IP:%s) was unbanned by %s. (%d-%d-%d)"
but when the banned player try to login after he gets unbanned it says that he is still banned.
Here are some codes of the /ban and /unban commands
pawn Код:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
    {
        new string[128];
        if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

        if(doesAccountExist(params))
        {
            OnPlayerOfflineLogin(params);
            if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 )
            {
                SendClientMessageEx( playerid, COLOR_WHITE, "Permanently banned accounts can only be unbanned via FTP." );
            }
            else
            {
                if( PlayerInfo[MAX_PLAYERS][pBanned] >= 0)
                {
                    PlayerInfo[MAX_PLAYERS][pBanned] = 0;
                    PlayerInfo[MAX_PLAYERS][pWarns] = 0;
                    PlayerInfo[MAX_PLAYERS][pDisabled] = 0;
                    RemoveBan(PlayerInfo[MAX_PLAYERS][pIP]);
                    print("OnPlayerOfflineLogin: Saving variables to file");
                    OnPlayerOfflineSave(params);
                    print("OnPlayerOfflineLogin: Variables saved properly");
                    format(string, 128, "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    ABroadCast(COLOR_LIGHTRED,string,2);
                    new year, month,day;
                    getdate(year, month, day);
                    format(string, sizeof(string), "AdmCmd: %s (IP:%s) was unbanned by %s. (%d-%d-%d)", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid),month,day,year);
                    Log("logs/ban.log", string);
                    print(string);
                }
                else
                {
                    SendClientMessageEx( playerid, COLOR_WHITE, "Not a banned account!" );
                }
            }
        }
        else
        {
            SendClientMessageEx( playerid, COLOR_WHITE, "That account doesn't exist." );
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
pawn Код:
CMD:unbanip(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
    {
        if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /unbanip [ip]");
        if(IsValidIP(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "That is not a valid IP address!");

        new string[128], year, month,day;
        getdate(year, month, day);
        RemoveBan(params);
        format(string, 128, "AdmCmd: %s has unbanned IP %s", GetPlayerNameEx(playerid), params);
        ABroadCast(COLOR_LIGHTRED,string,2);
        format(string, sizeof(string), "AdmCmd: %s has unbanned IP %s (%d-%d-%d)", GetPlayerNameEx(playerid), params, month, day, year);
        Log("logs/ban.log", string);
        print(string);
    }

    return 1;
}
pawn Код:
CMD:banaccount(playerid, params[])
{
    if(!PlayerInfo[playerid][pAdmin]) return Error(playerid, "You are not authorized to use this command!");
    new playername[24], length, reason[64];
    if(sscanf(params, "s[24]is[64]", playername, length, reason)) return Syntax(playerid, "banaccount", "[playername] [length (days) 0 = perm] [reason]");
    new giveplayerid = ReturnUser(playername);
    new string[128];
    format(STRING, "That player is currently on the server. Use /ban. (ID: %d)", giveplayerid);
    if(IsPlayerConnected(giveplayerid)) return Error(playerid, string);
    if(!doesAccountExist(playername)) return Error(playerid, "Could not find account specified. Check the name and try again.");
    OnPlayerOfflineLogin(playername);
    if(PlayerInfo[MAX_PLAYERS][pAdmin] > PlayerInfo[playerid][pAdmin]) return Error(playerid, "You cannot ban a higher level admin.");
    new ip[16];
    format(ip, sizeof(ip), "%s", PlayerInfo[MAX_PLAYERS][pIP]);
    BanAccount(playerid, playername, length, reason, ip);
    //PlayerInfo[MAX_PLAYERS][pBanned] = 1;
    OnPlayerOfflineSave(playername);
    new year, month,day;
    getdate(year, month, day);
    format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline banned for %d days by %s, reason: %s (%d-%d-%d)", playername, PlayerInfo[MAX_PLAYERS][pIP], length, GetPlayerNameEx(playerid), reason, month, day, year);
    Log("logs/ban.log", string);
    /*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], length;
    if(sscanf(params, "sis", playername, length, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /banaccount [playername] [reason]");

    new giveplayerid = ReturnUser(playername);
    if(IsPlayerConnected(giveplayerid))
    {
        if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin])
        {
            SendClientMessage(playerid, COLOR_RED, "You cannot ban a higher level admin.");
        }
        else
        {
            BanPlayer(playerid, giveplayerid, length, reason);
            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;
}
pawn Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return Error(playerid, "You are not authorized to use this command");
    new giveplayerid, time, reason[64], string[128];
    if(sscanf(params, "iis[64]", giveplayerid, time, reason)) return Syntax(playerid, "ban", "[playerid/PartOfName] [time(days) 0 = perm] [reason]");
    if(!IsPlayerConnected(giveplayerid)) return Error(playerid, "Invalid player specified!");
    if(playerid == giveplayerid) return Error(playerid, "You cannot ban youself, Chris McLeary.");
    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) return Error(playerid, "You cannot ban a equal or higher level admin.");
    //PlayerInfo[giveplayerid][pBanned] = 1;
    BanPlayer(playerid, giveplayerid, time, reason);
    format(string, sizeof(string), "AdmCmd: %s was banned by %s for %s, reason: %s ", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), time, reason);
    Log("logs/ban.log", string);
    return 1;
}
pawn Код:
stock BanPlayer(playerid, giveplayerid, time, reason[])
{
    new name[24], namegive[24];
    if(playerid == 501) format(name, sizeof(name), "Squidward (Anti-Cheat)");
    else GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(giveplayerid, namegive, sizeof(namegive));
    new curtime = gettime();
    new expire;
    if(!time)
    {
        expire = 1577836800;
    }
    else
    {
        new Float:banminutes = time * 24 * 60 * 60;
        new bantime = floatround(banminutes);
        expire = curtime + bantime;
    }
    new q[400];
    new ip[16];
    GetPlayerIp(giveplayerid, ip, sizeof(ip));
    //AddBan(ip);
    format(q, sizeof(q), "INSERT INTO bans (name, reason, ban_time, issue_time, expiry_time, admin, ip) VALUES ('%s', '%s', %d, %d, %d, '%s', '%s')", namegive, reason, time, curtime, expire, name, ip);
    mysql_query(q, THREAD_INSERT_BAN);
    new banid = mysql_insert_id();
    new string[128];
    if(time)
    format(STRING, "AdmCmd: %s was banned for %d days by %s: %s", GetPlayerNameEx(giveplayerid), time, GetPlayerNameEx(playerid), reason);
    else
    format(STRING, "AdmCmd: %s was banned permanently by %s: %s", GetPlayerNameEx(giveplayerid), name, reason);
    SendClientMessageToAllEx(COLOR_LIGHTRED, string);
    if(time)
    format(STRING, "You were banned by Admin %s for %d days: %s", GetPlayerNameEx(playerid), time, reason);
    else
    format(STRING, "You were banned permanently by Admin %s: %s", name, reason);
    SendClientMessage(giveplayerid, 0x00FF00FF, string);
    new dialogstring[512];
    format(dialogstring, sizeof(dialogstring), "You have been banned from this server for the following reason:\n\n%s\n\nIf you think that this ban was in error, please go to http://shockroleplay.net and appeal it.\nYou will need the following info to appeal the ban:\n\nBan ID: %d\nAdmin that banned you: %s\nReason of the ban: %s\n\n{00ff00}PLEASE TAKE A SCREENSHOT USING F8 RIGHT NOW, AND INCLUDE IT IN YOUR BAN APPEAL!", reason, banid, name, reason);
    ShowPlayerDialog(giveplayerid, 4564, DIALOG_STYLE_MSGBOX, "Banned!", dialogstring, "Close", "");
    Ban(giveplayerid);
    SetTimerEx("SendToKick", 1500, 0, "i", giveplayerid);
    return 1;
}

stock BanAccount(playerid, giveplayerid[24], time, reason[], ip[])
{
    new name[24];
    if(playerid == 501) format(name, sizeof(name), "Squidward (Anti-Cheat)");
    else GetPlayerName(playerid, name, sizeof(name));
    new curtime = gettime();
    new expire;
    if(!time)
    {
        expire = 1577836800;
    }
    else
    {
        new Float:banminutes = time * 24 * 60 * 60;
        new bantime = floatround(banminutes);
        expire = curtime + bantime;
    }
    new q[400];
    format(q, sizeof(q), "INSERT INTO bans (name, reason, ban_time, issue_time, expiry_time, admin, ip) VALUES ('%s', '%s', %d, %d, %d, '%s', '%s')", giveplayerid, reason, time, curtime, expire, name, ip);
    mysql_query(q, THREAD_INSERT_BAN);
    new string[128];
    if(time)
    format(string,sizeof(string), "AdmCmd: %s was offline banned for %d days by %s: %s", giveplayerid, time, GetPlayerNameEx(playerid), reason);
    else
    format(string,sizeof(string), "AdmCmd: %s was offline banned permanently by %s: %s", giveplayerid, name, reason);
    ABroadCast(COLOR_LIGHTRED, string, 2);
    return 1;
}
++ REP
Reply
#2

Thy this.
Код:
command(unbanip, playerid, params[])
{
	new string[128], PlayersIP[21];
	if(sscanf(params, "z", PlayersIP))
	{
	    if(Player[playerid][AdminLevel] >= 4)
	    {
			SendClientMessage(playerid, WHITE, "SYNTAX: /unbanip [IP]");
		}
	}
	else
	{
		if(Player[playerid][AdminLevel] >= 4)
		{
		    if(strlen(PlayersIP) >= 5)
		    {
		    	format(string, sizeof(string), "unbanip %s", PlayersIP);
		    	SendRconCommand(string);
		    	format(string, sizeof(string), "WARNING: %s has un-banned IP %s.", GetName(playerid), PlayersIP);
		    	SendToAdmins(ADMINORANGE, string, 0);
		    	SendRconCommand("reloadbans");

				new hour, minute, second, day, year, month, string2[128];
			    gettime(hour, minute, second);
			    getdate(year, month, day);
				format(string2, sizeof(string2), "%d/%d/%d | %d:%d | %s | %s (IP unbanned)", day, month, year, hour, minute, PlayersIP, GetName(playerid));
				UnbanLog(string2);
		    }
		    else
		    {
		        SendClientMessage(playerid, WHITE, "Invalid IP.");
		    }
		}
	}
	return 1;
}
Reply
#3

it was working Before so i dont think that the problem with the /unban command
Reply
#4

Bump'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)