move fake-kill and car warp code into respective anticheat modules
This commit is contained in:
parent
52b7d22ee7
commit
8831de493a
@ -22,12 +22,12 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CHEAT_TYPE_WEAPON,
|
CHEAT_TYPE_WEAPON,
|
||||||
//CHEAT_TYPE_CARWARP,
|
CHEAT_TYPE_CARWARP,
|
||||||
//CHEAT_TYPE_MONEY,
|
//CHEAT_TYPE_MONEY,
|
||||||
//CHEAT_TYPE_PLAYERBUGGER,
|
//CHEAT_TYPE_PLAYERBUGGER,
|
||||||
//CHEAT_TYPE_PICKUP_SPAM,
|
//CHEAT_TYPE_PICKUP_SPAM,
|
||||||
//CHEAT_TYPE_SPECTATE,
|
//CHEAT_TYPE_SPECTATE,
|
||||||
//CHEAT_TYPE_FAKEKILL,
|
CHEAT_TYPE_FAKEKILL,
|
||||||
CHEAT_TYPE_REMOTE_JACK,
|
CHEAT_TYPE_REMOTE_JACK,
|
||||||
//CHEAT_TYPE_PING_LIMIT,
|
//CHEAT_TYPE_PING_LIMIT,
|
||||||
CHEAT_TYPE_SPEED_HACK,
|
CHEAT_TYPE_SPEED_HACK,
|
||||||
@ -165,3 +165,4 @@ stock AC_SetPlayerSpawned( playerid, bool: spawned ) {
|
|||||||
#include "irresistible\anticheat\flying.pwn"
|
#include "irresistible\anticheat\flying.pwn"
|
||||||
#include "irresistible\anticheat\remotejack.pwn"
|
#include "irresistible\anticheat\remotejack.pwn"
|
||||||
#include "irresistible\anticheat\rapidfire.pwn"
|
#include "irresistible\anticheat\rapidfire.pwn"
|
||||||
|
#include "irresistible\anticheat\carwarp.pwn"
|
||||||
|
38
gamemodes/irresistible/anticheat/carwarp.pwn
Normal file
38
gamemodes/irresistible/anticheat/carwarp.pwn
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Irresistible Gaming (c) 2018
|
||||||
|
* Developed by Lorenc Pekaj
|
||||||
|
* Module:
|
||||||
|
* Purpose:
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ** Includes ** */
|
||||||
|
#include < YSI\y_hooks >
|
||||||
|
|
||||||
|
/* ** Variables ** */
|
||||||
|
static stock
|
||||||
|
p_ac_CarWarpTime [ MAX_PLAYERS ],
|
||||||
|
p_ac_CarWarpVehicleID [ MAX_PLAYERS ]
|
||||||
|
;
|
||||||
|
|
||||||
|
/* ** Hooks ** */
|
||||||
|
hook OnPlayerStateChange( playerid, newstate, oldstate )
|
||||||
|
{
|
||||||
|
if ( newstate == PLAYER_STATE_DRIVER )
|
||||||
|
{
|
||||||
|
if ( GetPlayerVehicleID( playerid ) != p_ac_CarWarpVehicleID[ playerid ] )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
server_time = gettime( );
|
||||||
|
|
||||||
|
if ( p_ac_CarWarpTime[ playerid ] > server_time )
|
||||||
|
{
|
||||||
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_RAPIDFIRE, 0 );
|
||||||
|
return Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_ac_CarWarpTime[ playerid ] = server_time + 1;
|
||||||
|
p_ac_CarWarpVehicleID[ playerid ] = GetPlayerVehicleID( playerid );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
@ -184,7 +184,9 @@ static stock
|
|||||||
Float: p_LastDamageIssued [ MAX_PLAYERS ],
|
Float: p_LastDamageIssued [ MAX_PLAYERS ],
|
||||||
p_LastTookDamage [ MAX_PLAYERS ],
|
p_LastTookDamage [ MAX_PLAYERS ],
|
||||||
p_LastDamageIssuer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
p_LastDamageIssuer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||||
p_LastWeaponIssuer [ MAX_PLAYERS ]
|
p_LastWeaponIssuer [ MAX_PLAYERS ],
|
||||||
|
p_LastDeath [ MAX_PLAYERS ],
|
||||||
|
p_DeathSpam [ MAX_PLAYERS char ]
|
||||||
;
|
;
|
||||||
|
|
||||||
/* ** Forwards ** */
|
/* ** Forwards ** */
|
||||||
@ -283,6 +285,7 @@ hook OnPlayerConnect( playerid )
|
|||||||
// Reset variables
|
// Reset variables
|
||||||
p_PlayerHealth[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
p_PlayerHealth[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
||||||
p_PlayerArmour[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
p_PlayerArmour[ playerid ] [ E_UPDATE_FAIL ] = 0;
|
||||||
|
p_DeathSpam{ playerid } = 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -563,16 +566,36 @@ stock AC_CheckForHealthHacks( playerid, iTicks )
|
|||||||
|
|
||||||
hook OnPlayerDeath( playerid, killerid, reason )
|
hook OnPlayerDeath( playerid, killerid, reason )
|
||||||
{
|
{
|
||||||
if ( !IsPlayerNPC( playerid ) )
|
if ( ! IsPlayerNPC( playerid ) )
|
||||||
{
|
{
|
||||||
|
new
|
||||||
|
server_time = gettime( );
|
||||||
|
|
||||||
// Reset spawned variable
|
// Reset spawned variable
|
||||||
AC_SetPlayerSpawned( playerid, false );
|
AC_SetPlayerSpawned( playerid, false );
|
||||||
|
|
||||||
|
// Anti-fakekill
|
||||||
|
switch( server_time - p_LastDeath[ playerid ] )
|
||||||
|
{
|
||||||
|
case 0 .. 3:
|
||||||
|
{
|
||||||
|
if ( p_DeathSpam{ playerid } ++ == 3 )
|
||||||
|
{
|
||||||
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_FAKEKILL, p_DeathSpam{ playerid } );
|
||||||
|
return Y_HOOKS_BREAK_RETURN_1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: p_DeathSpam{ playerid } = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_LastDeath[ playerid ] = server_time;
|
||||||
|
|
||||||
// Died in Vehicle
|
// Died in Vehicle
|
||||||
if ( GetPlayerVehicleID( playerid ) && AC_IsPlayerSpawned( playerid ) )
|
if ( GetPlayerVehicleID( playerid ) && AC_IsPlayerSpawned( playerid ) )
|
||||||
{
|
{
|
||||||
if( ( GetTickCount( ) - p_LastTookDamage[ playerid ] ) > 2500 )
|
if( ( GetTickCount( ) - p_LastTookDamage[ playerid ] ) > 2500 ) {
|
||||||
p_LastDamageIssuer[ playerid ] = INVALID_PLAYER_ID, p_LastWeaponIssuer[ playerid ] = 51;
|
p_LastDamageIssuer[ playerid ] = INVALID_PLAYER_ID, p_LastWeaponIssuer[ playerid ] = 51;
|
||||||
|
}
|
||||||
|
|
||||||
CallRemoteFunction( "OnPlayerDeathEx", "ddfd", playerid, p_LastDamageIssuer[ playerid ], p_LastWeaponIssuer[ playerid ], 3.3, 3 );
|
CallRemoteFunction( "OnPlayerDeathEx", "ddfd", playerid, p_LastDamageIssuer[ playerid ], p_LastWeaponIssuer[ playerid ], 3.3, 3 );
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,6 @@ new
|
|||||||
bool: p_AidsVaccine [ MAX_PLAYERS char ],
|
bool: p_AidsVaccine [ MAX_PLAYERS char ],
|
||||||
bool: p_CantUseAsk [ MAX_PLAYERS char ],
|
bool: p_CantUseAsk [ MAX_PLAYERS char ],
|
||||||
bool: p_AdminLog [ MAX_PLAYERS char ],
|
bool: p_AdminLog [ MAX_PLAYERS char ],
|
||||||
LastDeath [ MAX_PLAYERS ],
|
|
||||||
DeathSpam [ MAX_PLAYERS char ],
|
|
||||||
bool: p_beingSpectated [ MAX_PLAYERS ],
|
bool: p_beingSpectated [ MAX_PLAYERS ],
|
||||||
p_whomSpectating [ MAX_PLAYERS ],
|
p_whomSpectating [ MAX_PLAYERS ],
|
||||||
bool: p_InAnimation [ MAX_PLAYERS char ],
|
bool: p_InAnimation [ MAX_PLAYERS char ],
|
||||||
@ -135,8 +133,6 @@ new
|
|||||||
p_IncorrectLogins [ MAX_PLAYERS char ],
|
p_IncorrectLogins [ MAX_PLAYERS char ],
|
||||||
p_Robberies [ MAX_PLAYERS ],
|
p_Robberies [ MAX_PLAYERS ],
|
||||||
p_ViewingStats [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
p_ViewingStats [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
|
||||||
p_CarWarpTime [ MAX_PLAYERS ],
|
|
||||||
p_CarWarpVehicleID [ MAX_PLAYERS ],
|
|
||||||
p_AntiTextSpamCount [ MAX_PLAYERS char ],
|
p_AntiTextSpamCount [ MAX_PLAYERS char ],
|
||||||
Float: p_PlayerBuggerX [ MAX_PLAYERS ],
|
Float: p_PlayerBuggerX [ MAX_PLAYERS ],
|
||||||
Float: p_PlayerBuggerY [ MAX_PLAYERS ],
|
Float: p_PlayerBuggerY [ MAX_PLAYERS ],
|
||||||
|
@ -4044,7 +4044,6 @@ public OnPlayerDisconnect( playerid, reason )
|
|||||||
p_FPSCounter { playerid } = false;
|
p_FPSCounter { playerid } = false;
|
||||||
p_Ropes [ playerid ] = 0;
|
p_Ropes [ playerid ] = 0;
|
||||||
p_Scissors [ playerid ] = 0;
|
p_Scissors [ playerid ] = 0;
|
||||||
DeathSpam { playerid } = 0;
|
|
||||||
p_Fires [ playerid ] = 0;
|
p_Fires [ playerid ] = 0;
|
||||||
p_PingImmunity { playerid } = 0;
|
p_PingImmunity { playerid } = 0;
|
||||||
p_Robberies [ playerid ] = 0;
|
p_Robberies [ playerid ] = 0;
|
||||||
@ -5063,20 +5062,6 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
return SendServerMessage( playerid, "Possible Fake-kill detected - 0x0A" ), KickPlayerTimed( playerid );
|
return SendServerMessage( playerid, "Possible Fake-kill detected - 0x0A" ), KickPlayerTimed( playerid );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( g_iTime - LastDeath[ playerid ] )
|
|
||||||
{
|
|
||||||
case 0 .. 3:
|
|
||||||
{
|
|
||||||
if ( DeathSpam{ playerid }++ == 3 )
|
|
||||||
{
|
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for fake-killing.", ReturnPlayerName( playerid ), playerid );
|
|
||||||
BanEx( playerid, "Fake-kill" );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default: DeathSpam{ playerid } = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Robbery system
|
// Robbery system
|
||||||
if ( IsPlayerNPC( killerid ) )
|
if ( IsPlayerNPC( killerid ) )
|
||||||
{
|
{
|
||||||
@ -5089,7 +5074,6 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset player variables
|
// Reset player variables
|
||||||
LastDeath[ playerid ] = g_iTime;
|
|
||||||
p_Spawned{ playerid } = false;
|
p_Spawned{ playerid } = false;
|
||||||
p_QuitToAvoidTimestamp[ playerid ] = 0;
|
p_QuitToAvoidTimestamp[ playerid ] = 0;
|
||||||
CutSpectation( playerid );
|
CutSpectation( playerid );
|
||||||
@ -5225,7 +5209,8 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
|
|
||||||
if ( p_Class[ killerid ] == CLASS_POLICE )
|
if ( p_Class[ killerid ] == CLASS_POLICE )
|
||||||
{
|
{
|
||||||
if ( p_Class[ killerid ] == p_Class[ playerid ] ) {
|
if ( p_Class[ killerid ] == p_Class[ playerid ] )
|
||||||
|
{
|
||||||
// SendClientMessageToAdmins( -1, ""COL_PINK"[FAKE-KILL]{FFFFFF} Traces of fake-kill have came from %s: "COL_GREY"%s", ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ) );
|
// SendClientMessageToAdmins( -1, ""COL_PINK"[FAKE-KILL]{FFFFFF} Traces of fake-kill have came from %s: "COL_GREY"%s", ReturnPlayerName( playerid ), ReturnPlayerIP( playerid ) );
|
||||||
// KickPlayerTimed( playerid );
|
// KickPlayerTimed( playerid );
|
||||||
SendClientMessageFormatted( killerid, -1, ""COL_BLUE"[INNOCENT KILL]{FFFFFF} You have killed a team mate %s, you have lost 2 score and "COL_GOLD"$10,000{FFFFFF}.", ReturnPlayerName( playerid ) );
|
SendClientMessageFormatted( killerid, -1, ""COL_BLUE"[INNOCENT KILL]{FFFFFF} You have killed a team mate %s, you have lost 2 score and "COL_GOLD"$10,000{FFFFFF}.", ReturnPlayerName( playerid ) );
|
||||||
@ -5238,8 +5223,6 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if ( !DeathSpam{ playerid } ) // If the player doesn't even have a death-spam count.
|
|
||||||
{
|
{
|
||||||
if ( !IsPlayerInEvent( killerid ) ) // Allow in event
|
if ( !IsPlayerInEvent( killerid ) ) // Allow in event
|
||||||
{
|
{
|
||||||
@ -5273,7 +5256,6 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ killerid ] == CLASS_CIVILIAN )
|
if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ killerid ] == CLASS_CIVILIAN )
|
||||||
{
|
{
|
||||||
@ -11966,20 +11948,6 @@ public OnPlayerStateChange(playerid, newstate, oldstate)
|
|||||||
|
|
||||||
p_LastPlayerState{ playerid } = oldstate;
|
p_LastPlayerState{ playerid } = oldstate;
|
||||||
|
|
||||||
if ( newstate == PLAYER_STATE_DRIVER && p_AdminLevel[ playerid ] <= 0 )
|
|
||||||
{
|
|
||||||
if ( GetPlayerVehicleID( playerid ) != p_CarWarpVehicleID[ playerid ] )
|
|
||||||
{
|
|
||||||
if ( p_CarWarpTime[ playerid ] > g_iTime )
|
|
||||||
{
|
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for car warping.", ReturnPlayerName( playerid ), playerid );
|
|
||||||
BanEx( playerid, "Car Warp" );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
p_CarWarpTime[ playerid ] = g_iTime + 1;
|
|
||||||
p_CarWarpVehicleID[ playerid ] = GetPlayerVehicleID( playerid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( oldstate == PLAYER_STATE_SPECTATING )
|
if ( oldstate == PLAYER_STATE_SPECTATING )
|
||||||
{
|
{
|
||||||
@ -13715,20 +13683,30 @@ function unpause_Player( playerid )
|
|||||||
return Kick( playerid ), 1;
|
return Kick( playerid ), 1;
|
||||||
}
|
}
|
||||||
SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL JACKING]"COL_GREY" %s(%d) is a suspect of jacking vehicles abnormally.", ReturnPlayerName( playerid ), playerid );
|
SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL JACKING]"COL_GREY" %s(%d) is a suspect of jacking vehicles abnormally.", ReturnPlayerName( playerid ), playerid );
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else if ( detection == CHEAT_TYPE_RAPIDFIRE )
|
else if ( detection == CHEAT_TYPE_RAPIDFIRE )
|
||||||
{
|
{
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for rapid-firing.", ReturnPlayerName( playerid ), playerid );
|
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for rapid-firing.", ReturnPlayerName( playerid ), playerid );
|
||||||
Kick( playerid );
|
Kick( playerid );
|
||||||
return 1;
|
}
|
||||||
|
else if ( detection == CHEAT_TYPE_FAKEKILL )
|
||||||
|
{
|
||||||
|
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for fake-killing.", ReturnPlayerName( playerid ), playerid );
|
||||||
|
BanEx( playerid, "Fake-kill" );
|
||||||
|
}
|
||||||
|
else if ( detection == CHEAT_TYPE_CARWARP )
|
||||||
|
{
|
||||||
|
if ( ! GetPlayerAdminLevel( playerid ) )
|
||||||
|
{
|
||||||
|
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for car warping.", ReturnPlayerName( playerid ), playerid );
|
||||||
|
BanEx( playerid, "Car Warp" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( detection == CHEAT_TYPE_AIRBRAKE )
|
else if ( detection == CHEAT_TYPE_AIRBRAKE )
|
||||||
{
|
{
|
||||||
//SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for airbraking.", ReturnPlayerName( playerid ), playerid );
|
//SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for airbraking.", ReturnPlayerName( playerid ), playerid );
|
||||||
//AdvancedBan( playerid, "Server", "Airbrake", ReturnPlayerIP( playerid ) );
|
//AdvancedBan( playerid, "Server", "Airbrake", ReturnPlayerIP( playerid ) );
|
||||||
SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL MOVEMENT]"COL_GREY" %s(%d) has been detected for airbrake.", ReturnPlayerName( playerid ), playerid );
|
SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL MOVEMENT]"COL_GREY" %s(%d) has been detected for airbrake.", ReturnPlayerName( playerid ), playerid );
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else if ( detection == CHEAT_TYPE_FLYHACKS )
|
else if ( detection == CHEAT_TYPE_FLYHACKS )
|
||||||
{
|
{
|
||||||
@ -13739,7 +13717,6 @@ function unpause_Player( playerid )
|
|||||||
else if ( detection == CHEAT_TYPE_WEAPON )
|
else if ( detection == CHEAT_TYPE_WEAPON )
|
||||||
{
|
{
|
||||||
SendClientMessageToAdmins( -1, ""COL_PINK"[ANTI-CHEAT]"COL_GREY" %s(%d) has been detected for weapon hack (%s).", ReturnPlayerName( playerid ), playerid, ReturnWeaponName( params ) );
|
SendClientMessageToAdmins( -1, ""COL_PINK"[ANTI-CHEAT]"COL_GREY" %s(%d) has been detected for weapon hack (%s).", ReturnPlayerName( playerid ), playerid, ReturnWeaponName( params ) );
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user