Weired bug at my server -__-
#1

I tried to ban myself.. and myban got banned too.. then when players come it saying their ip are banned too but they arent banned their ip arent listed before in scriptfiles/ban.cfg then after its now randomly listed. in short when i ban a player and when a new players come at my server it will randomly ban their ip

I dont know wheres the problem caming from.

Код:
CMD:ban(playerid, params[])
{
	if(CheckGMX(playerid)) return 1;
    if(PlayerInfo[playerid][pAdmin] >= 2 || IsPlayerAdmin(playerid))
    {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]");

        if(IsPlayerConnected(giveplayerid))
        {
            if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][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,1);
                PlayerInfo[playerid][pBanned] = 1;
                new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second;
                GetPlayerIp(playerid,ip,sizeof(ip));
                AddBan(ip);
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]);
				ABroadCast(COLOR_LIGHTRED, string, 1);
                SendClientMessage(playerid, COLOR_REALRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(playerid, COLOR_WHITE, cw);
                SendClientMessage(playerid, COLOR_WHITE, "Staff: Server");
                SendClientMessage(playerid, COLOR_WHITE, "Reason: Tried to ban a higher admin");
                SendClientMessage(playerid, COLOR_WHITE, tstring);
                SendClientMessage(playerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                SendClientMessage(playerid, COLOR_REALRED, "Feel free to post a ban appeal at www."WEBSITE". Have a nice day!");
                SendClientMessage(playerid, COLOR_REALRED, "-------------------------------------------------------");
                KickWithMessage(playerid, COLOR_REALRED, "Your Banned from Philippines Roleplay");

                return 1;
            }
            else
            {
                new playerip[32];
                GetPlayerIp(giveplayerid, playerip, sizeof(playerip));

                if(AdminDuty[giveplayerid] == 1)
                {
                  	new username[MAX_PLAYER_NAME];
                    GetPVarString(giveplayerid, "TempNameName", username, sizeof(username));
                    SetPVarInt(giveplayerid, "TempName", 0);
                    SetPlayerName(giveplayerid, username);

           
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s",  GetPlayerNameEx(giveplayerid),playerip, PlayerInfo[playerid][pAdminName], reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s",  GetPlayerNameEx(giveplayerid), PlayerInfo[playerid][pAdminName], reason);
                }
                else
                {
                    format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, PlayerInfo[playerid][pAdminName], reason);
                    Log("logs/ban.log", string);
                    format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), PlayerInfo[playerid][pAdminName], reason);
                }


         
                ABroadCast(COLOR_LIGHTRED, string, 1);
                PlayerInfo[giveplayerid][pBanned] = 1;
                new ip[32];
                GetPlayerIp(giveplayerid,ip,sizeof(ip));
                AddBan(ip);
                new cw[64], tstring[128], sstring[128], rstring[128], aname[pAdminName], year, month, day, hour, minute, second;
                GetPlayerName(playerid, aname, sizeof(aname));
                getdate(year, month, day);
                gettime(hour, minute, second);
                format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second);
                format(sstring, sizeof(sstring), "Staff: %s", PlayerInfo[playerid][pAdminName]);
                format(rstring, sizeof(rstring), "Reason: %s", reason);
				format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[giveplayerid][pWarns]);
                SendClientMessage(giveplayerid, COLOR_REALRED, "--------------------- Ban Report ---------------------");
                SendClientMessage(giveplayerid, COLOR_WHITE, cw);
                SendClientMessage(giveplayerid, COLOR_WHITE, sstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, rstring);
                SendClientMessage(giveplayerid, COLOR_WHITE, tstring);
                SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)");
                KickWithMessage(giveplayerid, COLOR_REALRED, "Feel free to post a ban appeal at [www."WEBSITE"]");
                

     			return 1;
            }

        } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
    } else SendClientMessage(playerid, COLOR_GRAD1, "You are not autorized to use that command!");
    return 1;
}
Код:
public OnPlayerConnect(playerid) {
	new szPlayerIP[16];

	// Code to patch a SA-MP exploit where you can connect to a SA-MP server multiple times with a bunch of names and completely rape the logs
	// We don't receive attacks like this very often, but I have produced the code so if we ever need it, we have it right in front of us. It requires testing though...
	/*new
 	szPlayerName[MAX_PLAYER_NAME],
	szPlayerIP[16],
 	szPlayerIPs[16],
	szPlayerNames[MAX_PLAYER_NAME];

	GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
	GetPlayerIp(playerid, szPlayerIP, sizeof(szPlayerIP));

	foreach(Player, x) {
        GetPlayerName(x, szPlayerNames, MAX_PLAYER_NAME);
        GetPlayerIp(playerid, szPlayerIPs, sizeof(szPlayerIPs));
        if(strfind(szPlayerName, szPlayerNames, true) != -1 && !strcmp(szPlayerIPs, szPlayerIP, true) && IsStringAlphaNumeric(szPlayerNames) == 0)
			return BanEx(playerid, "NieXrlaM client spam attack attempt");
	}*/



//==================================
	for(new i=0;i<MAX_PLAYERS;i++)
	{
	     if(AdminDuty[i] == 1 || BigEar[i] == 1)
	     {
	        new connectstring[64], cname[MAX_PLAYER_NAME];
	        GetPlayerName(playerid,cname,MAX_PLAYER_NAME);
	        format(connectstring,sizeof (connectstring),"%s(ID %d) has joined Philippines Roleplay....",cname, playerid);
	        SendClientMessage(i, COLOR_YELLOW, connectstring);
	     }
	}

	TotalLogin++;
	GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
	if(PlayerInfo[playerid][pBanned] >= 1)
	{
		new string[128];
		format(string, sizeof(string), "WARNING: %s (IP:%s) tried to login whilst banned and has been auto-banned.", GetPlayerNameEx(playerid), PlayerInfo[playerid][pIP]);
		ABroadCast(COLOR_YELLOW, string, 1);
		AddBan(PlayerInfo[playerid][pIP]);
		Log("logs/ban.log", string);
		SetPlayerName(playerid, "BannedPlayer");
		KickWithMessage(playerid, COLOR_REALRED,  "You are banned from Philippines Roleplay. You may appeal this ban at "WEBSITE"");
		return 1;
	}

	if(PlayerInfo[playerid][pPermaBanned] >= 1)
	{
		new string[128];
		format(string, sizeof(string), "WARNING: %s (IP:%s) tried to login whilst Permanent banned and has been auto-banned.", GetPlayerNameEx(playerid), PlayerInfo[playerid][pIP]);
		ABroadCast(COLOR_YELLOW, string, 1);
		AddBan(PlayerInfo[playerid][pIP]);
		SetPlayerName(playerid, "BannedPlayer");
		KickWithMessage(playerid, COLOR_REALRED,  "Sorry but you are permanently banned fron Philippines Roleplay. You cannot Appeal this ban anymore!");
		return 1;
	}

	GetPlayerIp(playerid, szPlayerIP, sizeof(szPlayerIP));
	if(CheckBan(szPlayerIP) >= 1)
	{
		new string[128];
		format(string, sizeof(string), "WARNING: %s (IP:%s) tried to login whilst his/her IP is banned from server and has been auto kicked.", GetPlayerNameEx(playerid), PlayerInfo[playerid][pIP]);
		SetPlayerName(playerid, "BannedPlayer");
		ABroadCast(COLOR_YELLOW, string, 1);
		KickWithMessage(playerid, COLOR_REALRED,  "You IP address are banned from Philippines Roleplay. You may appeal this ban at "WEBSITE"");
		return 1;
	}


	new explicitmess[128];
	format(explicitmess, sizeof(explicitmess), "This server may contain explicit content. It requires 18+ age to join at this server");
	SendClientMessage(playerid, COLOR_REALRED, explicitmess);
	SendClientMessage(playerid, COLOR_NEWS, "Welcome sa Philippine Server. We hope you will enjoy your gaming here");
Код:
stock CheckBan(ip[])
{
	new string[20];
    new File: file = fopen("ban.cfg", io_read);
	while(fread(file, string))
	{
	    if(strcmp(ip, string, true, strlen(ip)) == 0)
	    {
	        fclose(file);
	        return 1;
	    }
	}
	fclose(file);
	return 0;
}
Код:
stock AddBan(ip[])
{
	if(CheckBan(ip) == 0)
	{
		new File: file = fopen("ban.cfg", io_append);
		new string[20];
		format(string, sizeof(string), "\n%s", ip);
	 	fwrite(file, string);
	 	fclose(file);
		return 1;
	}
	return 0;
}
I HOPE THIS PROBLEM WILL SOLVED WITH YOUR HELP
Reply
#2

Anyone please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)