add car particle spam and player pickup spam into anticheat modules
This commit is contained in:
parent
857cff5e7e
commit
23e21bc109
@ -25,7 +25,6 @@ enum
|
||||
CHEAT_TYPE_CARWARP,
|
||||
//CHEAT_TYPE_MONEY,
|
||||
//CHEAT_TYPE_PLAYERBUGGER,
|
||||
//CHEAT_TYPE_PICKUP_SPAM,
|
||||
//CHEAT_TYPE_SPECTATE,
|
||||
CHEAT_TYPE_FAKEKILL,
|
||||
CHEAT_TYPE_REMOTE_JACK,
|
||||
@ -38,7 +37,9 @@ enum
|
||||
CHEAT_TYPE_PROAIM,
|
||||
CHEAT_TYPE_AUTOCBUG,
|
||||
CHEAT_TYPE_FLYHACKS,
|
||||
CHEAT_TYPE_RAPIDFIRE
|
||||
CHEAT_TYPE_RAPIDFIRE,
|
||||
CHEAT_TYPE_CAR_PARTICLE_SPAM,
|
||||
CHEAT_TYPE_PICKUP_SPAM
|
||||
};
|
||||
|
||||
static stock
|
||||
@ -167,3 +168,5 @@ stock AC_SetPlayerSpawned( playerid, bool: spawned ) {
|
||||
#include "irresistible\anticheat\remotejack.pwn"
|
||||
#include "irresistible\anticheat\rapidfire.pwn"
|
||||
#include "irresistible\anticheat\carwarp.pwn"
|
||||
#include "irresistible\anticheat\car_particle_spam.pwn"
|
||||
#include "irresistible\anticheat\pickup_spam.pwn"
|
||||
|
73
gamemodes/irresistible/anticheat/car_particle_spam.pwn
Normal file
73
gamemodes/irresistible/anticheat/car_particle_spam.pwn
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Irresistible Gaming (c) 2018
|
||||
* Developed by Lorenc Pekaj
|
||||
* Module: anticheat\carparticlespam.pwn
|
||||
* Purpose: detection for car particle spamming (where doors particles spam)
|
||||
*/
|
||||
|
||||
/* ** Includes ** */
|
||||
#include < YSI\y_hooks >
|
||||
|
||||
/* ** Error Checking ** */
|
||||
DEFINE_HOOK_REPLACEMENT ( Vehicle, Veh );
|
||||
|
||||
/* ** Variables ** */
|
||||
static stock
|
||||
p_DamageSpamTime [ MAX_PLAYERS ],
|
||||
p_DamageSpamCount [ MAX_PLAYERS char ];
|
||||
|
||||
/* ** Function Hooks ** */
|
||||
stock AC_RepairVehicle( vehicleid )
|
||||
{
|
||||
foreach ( new playerid : Player ) if ( GetPlayerVehicleID( playerid ) == vehicleid ) {
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
}
|
||||
return RepairVehicle( vehicleid );
|
||||
}
|
||||
|
||||
#if defined _ALS_RepairVehicle
|
||||
#undef RepairVehicle
|
||||
#else
|
||||
#define _ALS_RepairVehicle
|
||||
#endif
|
||||
|
||||
#define RepairVehicle AC_RepairVehicle
|
||||
|
||||
/* ** Hooks ** */
|
||||
hook OnPlayerDisconnect( playerid, reason )
|
||||
{
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
hook OnVehDamageStatusUpdate( vehicleid, playerid )
|
||||
{
|
||||
if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
|
||||
{
|
||||
static
|
||||
damage_status[ 4 ];
|
||||
|
||||
GetVehicleDamageStatus( vehicleid, damage_status[ 0 ], damage_status[ 1 ], damage_status[ 2 ], damage_status[ 3 ] );
|
||||
|
||||
if ( damage_status[ 2 ] || damage_status[ 3 ] ) // ignore lights & tires
|
||||
return 1;
|
||||
|
||||
new
|
||||
time = GetTickCount( );
|
||||
|
||||
switch( time - p_DamageSpamTime[ playerid ] )
|
||||
{
|
||||
case 0 .. 500:
|
||||
{
|
||||
if ( ++ p_DamageSpamCount{ playerid } >= 10 )
|
||||
{
|
||||
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_CAR_PARTICLE_SPAM, 0 );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
default: p_DamageSpamCount{ playerid } = 0;
|
||||
}
|
||||
p_DamageSpamTime[ playerid ] = time;
|
||||
}
|
||||
return 1;
|
||||
}
|
42
gamemodes/irresistible/anticheat/pickup_spam.pwn
Normal file
42
gamemodes/irresistible/anticheat/pickup_spam.pwn
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Irresistible Gaming (c) 2018
|
||||
* Developed by Lorenc Pekaj
|
||||
* Module: anticheat/pickup_spam.pwn
|
||||
* Purpose: checks if a player enters a bunch of pickups really fast
|
||||
*/
|
||||
|
||||
/* ** Includes ** */
|
||||
#include < YSI\y_hooks >
|
||||
|
||||
/* ** Variables ** */
|
||||
static stock
|
||||
LastPickupTimestamp [ MAX_PLAYERS ],
|
||||
PreviousPickupID [ MAX_PLAYERS ],
|
||||
Float: p_LastPickupPos [ MAX_PLAYERS ] [ 3 ];
|
||||
|
||||
/* ** Hooks ** */
|
||||
hook OnPlayerPickUpDynPickup( playerid, pickupid )
|
||||
{
|
||||
if ( pickupid != PreviousPickupID[ playerid ] )
|
||||
{
|
||||
new
|
||||
iTimestamp = gettime( ); // Call it once, because swag
|
||||
|
||||
if ( LastPickupTimestamp[ playerid ] > iTimestamp )
|
||||
{
|
||||
new
|
||||
Float: distance = GetPlayerDistanceFromPoint( playerid, p_LastPickupPos[ playerid ] [ 0 ], p_LastPickupPos[ playerid ] [ 1 ], p_LastPickupPos[ playerid ] [ 2 ] );
|
||||
|
||||
//if ( distance < 50.0 ) printf( "[AC WARN] Player ID %d has entered a pickup near him really fast. (distance: %0.2fm, time: %ds)", playerid, distance, LastPickupTimestamp[ playerid ] - iTimestamp );
|
||||
if ( distance > 50.0 )
|
||||
{
|
||||
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_PICKUP_SPAM, 0 );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
LastPickupTimestamp[ playerid ] = iTimestamp + 1;
|
||||
PreviousPickupID[ playerid ] = pickupid;
|
||||
}
|
||||
GetPlayerPos( playerid, p_LastPickupPos[ playerid ] [ 0 ], p_LastPickupPos[ playerid ] [ 1 ], p_LastPickupPos[ playerid ] [ 2 ] );
|
||||
return 1;
|
||||
}
|
@ -42,7 +42,6 @@ CMD:arepair( playerid, params[ ] )
|
||||
if ( !g_adminSpawnedCar{ iVehicle } )
|
||||
return SendError( playerid, "This is not an admin spawned vehicle." );
|
||||
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
RepairVehicle( iVehicle );
|
||||
PlayerPlaySound( playerid, 1133, 0.0, 0.0, 5.0 );
|
||||
|
||||
|
@ -157,7 +157,6 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
|
||||
new Float: vZ, vehicleid = GetPlayerVehicleID( playerid );
|
||||
GetVehicleZAngle( vehicleid, vZ ), SetVehicleZAngle( vehicleid, vZ );
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
RepairVehicle( vehicleid );
|
||||
GivePlayerCash( playerid, -9900 );
|
||||
SendServerMessage( playerid, "You have fixed and flipped your vehicle for $9,900." );
|
||||
@ -175,7 +174,6 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
|
||||
new vehicleid = GetPlayerVehicleID( playerid );
|
||||
PlayerPlaySound( playerid, 1133, 0.0, 0.0, 5.0 );
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
RepairVehicle( vehicleid );
|
||||
GivePlayerCash( playerid, -7500 );
|
||||
SendServerMessage( playerid, "You have repaired your car for $7,500." );
|
||||
|
@ -126,8 +126,6 @@ new
|
||||
Float: p_PlayerBuggerX [ MAX_PLAYERS ],
|
||||
Float: p_PlayerBuggerY [ MAX_PLAYERS ],
|
||||
Float: p_PlayerBuggerZ [ MAX_PLAYERS ],
|
||||
p_DamageSpamTime [ MAX_PLAYERS ],
|
||||
p_DamageSpamCount [ MAX_PLAYERS char ],
|
||||
p_PingImmunity [ MAX_PLAYERS char ],
|
||||
p_Fires [ MAX_PLAYERS ],
|
||||
p_AntiTieSpam [ MAX_PLAYERS ],
|
||||
@ -171,8 +169,6 @@ new
|
||||
bool: p_ClassSelection [ MAX_PLAYERS char ],
|
||||
p_MiningExport [ MAX_PLAYERS ] = { 0xFFFF, ... },
|
||||
Text3D: p_WeedLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
|
||||
LastPickupTimestamp [ MAX_PLAYERS ],
|
||||
PreviousPickupID [ MAX_PLAYERS ],
|
||||
//p_LastAnimIndex [ MAX_PLAYERS ],
|
||||
p_SpawningCity [ MAX_PLAYERS char ],
|
||||
p_UsingRobberySafe [ MAX_PLAYERS ] = { -1, ... },
|
||||
@ -191,7 +187,6 @@ new
|
||||
p_AntiExportCarSpam [ MAX_PLAYERS ],
|
||||
p_AntiMechFlipSpam [ MAX_PLAYERS ],
|
||||
bool: p_inAlcatraz [ MAX_PLAYERS char ],
|
||||
Float: p_LastPickupPos [ MAX_PLAYERS ] [ 3 ],
|
||||
Text3D: p_TiedLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
|
||||
p_TiedBy [ MAX_PLAYERS ],
|
||||
p_BlowjobPrice [ MAX_PLAYERS ],
|
||||
|
@ -1684,7 +1684,6 @@ public OnPlayerDisconnect( playerid, reason )
|
||||
p_SpawningIndex[ playerid ] = 0;
|
||||
p_IncorrectLogins{ playerid } = 0;
|
||||
p_VehicleBringCooldown[ playerid ] = 0;
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
p_AntiTextSpamCount{ playerid } = 0;
|
||||
Delete3DTextLabel( p_SpawnKillLabel[ playerid ] );
|
||||
p_SpawnKillLabel[ playerid ] = Text3D: INVALID_3DTEXT_ID;
|
||||
@ -4417,7 +4416,6 @@ CMD:mech( playerid, params[ ] )
|
||||
}
|
||||
|
||||
PlayerPlaySound( playerid, 1133, 0.0, 0.0, 5.0 );
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
RepairVehicle( iVehicle );
|
||||
SendServerMessage( playerid, "You have repaired this vehicle." );
|
||||
p_AntiMechFixSpam[ playerid ] = g_iTime + 10;
|
||||
@ -4477,7 +4475,6 @@ CMD:mech( playerid, params[ ] )
|
||||
}
|
||||
|
||||
PlayerPlaySound( playerid, 1133, 0.0, 0.0, 5.0 );
|
||||
p_DamageSpamCount{ playerid } = 0;
|
||||
RepairVehicle( iVehicle );
|
||||
GetVehicleZAngle( iVehicle, vZ ), SetVehicleZAngle( iVehicle, vZ );
|
||||
SendServerMessage( playerid, "You have flipped and fixed this vehicle." );
|
||||
@ -7008,29 +7005,6 @@ public OnPlayerExitVehicle(playerid, vehicleid)
|
||||
|
||||
public OnVehicleDamageStatusUpdate( vehicleid, playerid )
|
||||
{
|
||||
GetVehicleDamageStatus( vehicleid, panels, doors, lights, tires );
|
||||
if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
|
||||
{
|
||||
if ( lights || tires )
|
||||
return 1;
|
||||
|
||||
new time = GetTickCount( );
|
||||
switch( time - p_DamageSpamTime[ playerid ] )
|
||||
{
|
||||
case 0 .. 500:
|
||||
{
|
||||
p_DamageSpamCount{ playerid } ++;
|
||||
if ( p_DamageSpamCount{ playerid } >= 10 )
|
||||
{
|
||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for car particle spam.", ReturnPlayerName( playerid ), playerid );
|
||||
Kick( playerid );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
default: p_DamageSpamCount{ playerid } = 0;
|
||||
}
|
||||
p_DamageSpamTime[ playerid ] = time;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -7548,33 +7522,6 @@ public OnPlayerClickPlayerTextDraw(playerid, PlayerText: playertextid)
|
||||
return 1;
|
||||
}
|
||||
|
||||
public OnPlayerPickUpDynamicPickup( playerid, pickupid )
|
||||
{
|
||||
if ( pickupid != PreviousPickupID[ playerid ] )
|
||||
{
|
||||
new
|
||||
iTimestamp = g_iTime; // Call it once, because swag
|
||||
|
||||
if ( LastPickupTimestamp[ playerid ] > iTimestamp )
|
||||
{
|
||||
new
|
||||
Float: distance = GetPlayerDistanceFromPoint( playerid, p_LastPickupPos[ playerid ] [ 0 ], p_LastPickupPos[ playerid ] [ 1 ], p_LastPickupPos[ playerid ] [ 2 ] );
|
||||
|
||||
//if ( distance < 50.0 ) printf( "[AC WARN] Player ID %d has entered a pickup near him really fast. (distance: %0.2fm, time: %ds)", playerid, distance, LastPickupTimestamp[ playerid ] - iTimestamp );
|
||||
if ( distance > 50.0 )
|
||||
{
|
||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for rapid pickup spam.", ReturnPlayerName( playerid ), playerid );
|
||||
BanEx( playerid, "Pickup Spam" );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
LastPickupTimestamp[ playerid ] = iTimestamp + 1;
|
||||
PreviousPickupID[ playerid ] = pickupid;
|
||||
}
|
||||
GetPlayerPos( playerid, p_LastPickupPos[ playerid ] [ 0 ], p_LastPickupPos[ playerid ] [ 1 ], p_LastPickupPos[ playerid ] [ 2 ] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
public OnVehicleMod( playerid, vehicleid, componentid )
|
||||
{
|
||||
return 1;
|
||||
@ -8021,6 +7968,16 @@ function unpause_Player( playerid )
|
||||
{
|
||||
SendClientMessageToAdmins( -1, ""COL_PINK"[ANTI-CHEAT]"COL_GREY" %s(%d) has been detected for weapon hack (%s).", ReturnPlayerName( playerid ), playerid, ReturnWeaponName( params ) );
|
||||
}
|
||||
else if ( detection == CHEAT_TYPE_CAR_PARTICLE_SPAM )
|
||||
{
|
||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for car particle spam.", ReturnPlayerName( playerid ), playerid );
|
||||
Kick( playerid );
|
||||
}
|
||||
else if( detection == CHEAT_TYPE_PICKUP_SPAM )
|
||||
{
|
||||
SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for rapid pickup spam.", ReturnPlayerName( playerid ), playerid );
|
||||
BanEx( playerid, "Pickup Spam" );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendClientMessageToAdmins( -1, ""COL_PINK"[ANTI-CHEAT]"COL_GREY" %s(%d) has been detected for %s.", ReturnPlayerName( playerid ), playerid, AC_DetectedCheatToString( detection ) );
|
||||
|
Loading…
Reference in New Issue
Block a user