Rcon attempts
#9

Quote:
Originally Posted by WizzardY
View Post
Code:
OnRconLoginAttempt(ip[], password[], success) {
	
	#pragma unused password
	
	if (!success) {
		
		new hasplayers = 0;
		
		new pip[16];
		for (new PlayerID=0; PlayerID < MAX_PLAYERS; PlayerID++) {
			
			if (!IsPlayerConnected(PlayerID))
				continue;
			
			GetPlayerIp(PlayerID, pip, sizeof(pip));
			
			if (!strcmp(ip, pip, true)) {
				
				hasplayers++;
				
				// protect nubs against their stupidity.
				new timex = TimeSincePvar(PlayerID, "last_rcon_attempt");
				
				if (timex > 1000) {
					
					SendPlayerMessage(PlayerID, COLOR_RED, "Do not abuse the rcon system, you will be banned if you fail to login again.");
										
				}
				
				SetPVarInt(PlayerID, "last_rcon_attempt", TickCount());
				
				new rla;
				rla = GetPVarInt(PlayerID, "rcon_login_attempts");
				
				rla = rla + 1;
				
				if (rla > 3) {
					
					// ban the ip via rcon
					makestrf(banipstr, 64, "banip %s", ip);
					SendRconCommand(banipstr);
					
				}
				
				SetPVarInt(PlayerID, "rcon_login_attempts", rla);
				
			}
			
		} // loop
		
		if (hasplayers == 0) {
			
			// ban the ip via rcon
			makestrf(banipstr, 64, "banip %s", ip);
			SendRconCommand(banipstr);
			
		}
		
	}
	
	return PCOR_CONTINUE;
}
Rcon 0 in server.cfg is still better.
Reply


Messages In This Thread
Rcon attempts - by DeathFire - 18.12.2013, 15:29
Re: Rcon attempts - by DJ_Shocker - 18.12.2013, 15:34
Re: Rcon attempts - by Djole1337 - 18.12.2013, 15:36
Re: Rcon attempts - by DeathFire - 18.12.2013, 15:48
Re: Rcon attempts - by Vince - 18.12.2013, 15:48
Re: Rcon attempts - by DJ_Shocker - 18.12.2013, 15:49
Re: Rcon attempts - by DeathFire - 18.12.2013, 16:03
Re: Rcon attempts - by Crystallize - 19.12.2013, 16:21
Re: Rcon attempts - by Astralis - 19.12.2013, 17:10
Re: Rcon attempts - by BedBokart - 19.12.2013, 20:02

Forum Jump:


Users browsing this thread: 2 Guest(s)