move flood control code to security.pwn

This commit is contained in:
Lorenc Pekaj 2019-01-02 02:55:49 +11:00
parent e5a2013426
commit 4e84b19014
2 changed files with 12 additions and 13 deletions

View File

@ -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[ ] )

View File

@ -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;