From 4e84b19014ccb89c4bb0c16f54a34dd14caddf00 Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 2 Jan 2019 02:55:49 +1100 Subject: [PATCH] move flood control code to security.pwn --- gamemodes/irresistible/security.pwn | 12 ++++++++++++ gamemodes/sf-cnr.pwn | 13 ------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gamemodes/irresistible/security.pwn b/gamemodes/irresistible/security.pwn index 81ab293..14b5c56 100644 --- a/gamemodes/irresistible/security.pwn +++ b/gamemodes/irresistible/security.pwn @@ -131,6 +131,18 @@ hook OnPlayerDisconnect( playerid, reason ) return 1; } +hook OnPlayerFloodControl( playerid, iCount, iTimeSpan ) { + static + szIP[ 16 ]; + + GetPlayerIp( playerid, szIP, sizeof( szIP ) ); + + if ( iCount > 2 && iTimeSpan < 10000 && ! IsPlayerNpcEx( playerid ) ) { + BanEx( playerid, "BOT-SPAM" ); + } + return 1; +} + #if !defined DEBUG_MODE // prevent player from leaking rcon password hook OnPlayerText( playerid, text[ ] ) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 8ce31fb..bc2af2f 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -433,19 +433,6 @@ public OnPlayerRequestClass( playerid, classid ) return 1; } -public OnPlayerFloodControl( playerid, iCount, iTimeSpan ) { - static - szIP[ 16 ]; - - GetPlayerIp( playerid, szIP, sizeof( szIP ) ); - - if ( iCount > 2 && iTimeSpan < 10000 ) { - if ( !IsPlayerNpcEx( playerid ) ) { - BanEx( playerid, "BOT-SPAM" ); - } - } -} - public OnNpcConnect( npcid ) { return Kick( npcid ), 1;