anticheat fixes
This commit is contained in:
parent
e7d3b3f105
commit
1e4a40c09b
@ -89,7 +89,7 @@ stock bCheckForAirbrake( playerid, iTicks, iState )
|
|||||||
if( floatabs( distance ) >= 75.0 && ( floatabs( p_abLastPosition[ playerid ] [ 1 ] - y ) >= 50.0 || floatabs( p_abLastPosition[ playerid ] [ 0 ] - x ) >= 50.0 ) )
|
if( floatabs( distance ) >= 75.0 && ( floatabs( p_abLastPosition[ playerid ] [ 1 ] - y ) >= 50.0 || floatabs( p_abLastPosition[ playerid ] [ 0 ] - x ) >= 50.0 ) )
|
||||||
{
|
{
|
||||||
if( ++p_abDetected{ playerid } >= 3 )
|
if( ++p_abDetected{ playerid } >= 3 )
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_AIRBRAKE );
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_AIRBRAKE, 0 );
|
||||||
|
|
||||||
if( p_abResetTimer[ playerid ] == -1 )
|
if( p_abResetTimer[ playerid ] == -1 )
|
||||||
p_abResetTimer[ playerid ] = SetTimerEx( "AC_ResetABDetected", 60000, false, "d", playerid );
|
p_abResetTimer[ playerid ] = SetTimerEx( "AC_ResetABDetected", 60000, false, "d", playerid );
|
||||||
|
@ -75,7 +75,7 @@ stock vCheckForAutoCbug( playerid, weaponid )
|
|||||||
if( iInterval < iHardInterval && iCompare > 1500 && fOwnPacketLoss < 0.8 ) {
|
if( iInterval < iHardInterval && iCompare > 1500 && fOwnPacketLoss < 0.8 ) {
|
||||||
if( p_cbugWarns{ playerid }++ >= 2 ) {
|
if( p_cbugWarns{ playerid }++ >= 2 ) {
|
||||||
printf( "[autocbug detect] %d detected (wep %d, interval %d, compare %d, warns %d)", playerid, weaponid, iInterval, iCompare, p_cbugWarns{ playerid });
|
printf( "[autocbug detect] %d detected (wep %d, interval %d, compare %d, warns %d)", playerid, weaponid, iInterval, iCompare, p_cbugWarns{ playerid });
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_AUTOCBUG );
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_AUTOCBUG, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ stock vCheckForFlyHacks( playerid, iTicks )
|
|||||||
if( !ac_IsPlayerInWater( playerid ) )
|
if( !ac_IsPlayerInWater( playerid ) )
|
||||||
{
|
{
|
||||||
if( p_FlyHacksWarns{ playerid }++ >= 2 )
|
if( p_FlyHacksWarns{ playerid }++ >= 2 )
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_FLYHACKS ), p_FlyHacksWarns{ playerid } = 3;
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_FLYHACKS, 0 ), p_FlyHacksWarns{ playerid } = 3;
|
||||||
}
|
}
|
||||||
else p_FlyHacksWarns{ playerid } = 0;
|
else p_FlyHacksWarns{ playerid } = 0;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ stock
|
|||||||
|
|
||||||
// Forwards (Global)
|
// Forwards (Global)
|
||||||
|
|
||||||
public OnPlayerCheatDetected( playerid, detection );
|
public OnPlayerCheatDetected( playerid, detection, params );
|
||||||
|
|
||||||
// Functions (Global)
|
// Functions (Global)
|
||||||
|
|
||||||
|
@ -413,21 +413,8 @@ hook OnPlayerDeath(playerid, killerid, reason)
|
|||||||
{
|
{
|
||||||
if ( !IsPlayerNPC( playerid ) )
|
if ( !IsPlayerNPC( playerid ) )
|
||||||
{
|
{
|
||||||
// Health/Armour Hack
|
|
||||||
if( GetPVarInt( playerid, "CustomKill" ) )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
customKiller = GetPVarInt( playerid, "KillerID" );
|
|
||||||
|
|
||||||
CallRemoteFunction( "OnPlayerDeathEx", "ddfd", playerid, customKiller != playerid ? customKiller : INVALID_PLAYER_ID, GetPVarInt( playerid, "WeaponID" ), 3.3, 3 );
|
|
||||||
|
|
||||||
DeletePVar( playerid, "KillerID" );
|
|
||||||
DeletePVar( playerid, "WeaponID" );
|
|
||||||
DeletePVar( playerid, "CustomKill" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Died in Vehicle
|
// Died in Vehicle
|
||||||
else 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;
|
||||||
@ -448,9 +435,10 @@ hook OnPlayerDeath(playerid, killerid, reason)
|
|||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
stock ForcePlayerKill( playerid, killerid, weaponid )
|
stock ForcePlayerKill( playerid, killerid, weaponid )
|
||||||
{
|
{
|
||||||
SetPVarInt( playerid, "KillerID", killerid );
|
p_LastTookDamage[ playerid ] = GetTickCount( );
|
||||||
SetPVarInt( playerid, "WeaponID", weaponid );
|
p_LastDamageIssuer[ playerid ] = killerid;
|
||||||
SetPVarInt( playerid, "CustomKill", 1 );
|
p_LastWeaponIssuer[ playerid ] = weaponid;
|
||||||
|
p_LastDamageIssued[ playerid ] = 100.0;
|
||||||
|
|
||||||
SetPlayerHealth( playerid, -1 );
|
SetPlayerHealth( playerid, -1 );
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ stock vCheckForSilentAimbot( playerid, hittype, hitid )
|
|||||||
|
|
||||||
if( iTicks - p_silentAimbotLastCalled[ playerid ] <= 5000 ) {
|
if( iTicks - p_silentAimbotLastCalled[ playerid ] <= 5000 ) {
|
||||||
printf("[PRO-AIM] Detected %d - last %dms", playerid, iTicks - p_silentAimbotLastCalled[ playerid ]);
|
printf("[PRO-AIM] Detected %d - last %dms", playerid, iTicks - p_silentAimbotLastCalled[ playerid ]);
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_PROAIM );
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_PROAIM, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
p_silentAimbotLastCalled[ playerid ] = iTicks;
|
p_silentAimbotLastCalled[ playerid ] = iTicks;
|
||||||
|
@ -47,7 +47,7 @@ stock bCheckPlayerRemoteJacking( playerid )
|
|||||||
if( ( GetVehicleModel( iVehicle ) == 577 ) || ( GetVehicleModel( iVehicle ) == 592 )) fOffset = 25.0; // Andromanda | AT-400
|
if( ( GetVehicleModel( iVehicle ) == 577 ) || ( GetVehicleModel( iVehicle ) == 592 )) fOffset = 25.0; // Andromanda | AT-400
|
||||||
|
|
||||||
if( fDistance > fOffset )
|
if( fDistance > fOffset )
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_REMOTE_JACK );
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_REMOTE_JACK, 0 );
|
||||||
|
|
||||||
GetPlayerPos( playerid, p_remoteJackData[ playerid ] [ E_LAST_X ], p_remoteJackData[ playerid ] [ E_LAST_Y ], p_remoteJackData[ playerid ] [ E_LAST_Z ] );
|
GetPlayerPos( playerid, p_remoteJackData[ playerid ] [ E_LAST_X ], p_remoteJackData[ playerid ] [ E_LAST_Y ], p_remoteJackData[ playerid ] [ E_LAST_Z ] );
|
||||||
p_remoteJackData[ playerid ] [ E_LAST_VEH ] = iVehicle;
|
p_remoteJackData[ playerid ] [ E_LAST_VEH ] = iVehicle;
|
||||||
|
@ -51,7 +51,7 @@ stock bCheckForSpectatingHacks( playerid, iState, iTicks )
|
|||||||
if( iTicks > p_PlayerSpectateUpdateTime[ playerid ] )
|
if( iTicks > p_PlayerSpectateUpdateTime[ playerid ] )
|
||||||
{
|
{
|
||||||
if( iState == PLAYER_STATE_SPECTATING && !p_SpectatePermission{ playerid } ) {
|
if( iState == PLAYER_STATE_SPECTATING && !p_SpectatePermission{ playerid } ) {
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_SPECTATE );
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_SPECTATE, 0 );
|
||||||
printf("[spectate] [%d] %d seems to spectate hack (state id %d, perm %d).", GetTickCount( ), playerid, iState, p_SpectatePermission{ playerid } );
|
printf("[spectate] [%d] %d seems to spectate hack (state id %d, perm %d).", GetTickCount( ), playerid, iState, p_SpectatePermission{ playerid } );
|
||||||
}
|
}
|
||||||
p_PlayerSpectateUpdateTime[ playerid ] = iTicks + 1000;
|
p_PlayerSpectateUpdateTime[ playerid ] = iTicks + 1000;
|
||||||
|
@ -28,15 +28,21 @@
|
|||||||
#include < anticheat\global >
|
#include < anticheat\global >
|
||||||
#include < anticheat\player >
|
#include < anticheat\player >
|
||||||
|
|
||||||
|
// Player Variables
|
||||||
|
|
||||||
|
static p_PlayerWeaponUpdateTime[ MAX_PLAYERS ];
|
||||||
|
static p_CurrentArmedWeapon[ MAX_PLAYERS char ];
|
||||||
|
|
||||||
// Function Hook (GivePlayerWeapon)
|
// Function Hook (GivePlayerWeapon)
|
||||||
|
|
||||||
stock AC_GivePlayerWeapon( playerid, weaponid, ammo )
|
stock AC_GivePlayerWeapon( playerid, weaponid, ammo )
|
||||||
{
|
{
|
||||||
//p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
||||||
|
|
||||||
if( weaponid < AC_MAX_WEAPONS )
|
if( 0 <= weaponid < AC_MAX_WEAPONS ) {
|
||||||
p_PlayerHasWeapon[ playerid ] { weaponid } = true;
|
p_PlayerHasWeapon[ playerid ] { weaponid } = true;
|
||||||
|
p_CurrentArmedWeapon{ playerid } = weaponid;
|
||||||
|
}
|
||||||
return GivePlayerWeapon( playerid, weaponid, ammo );
|
return GivePlayerWeapon( playerid, weaponid, ammo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,11 +53,29 @@ stock AC_GivePlayerWeapon( playerid, weaponid, ammo )
|
|||||||
#endif
|
#endif
|
||||||
#define GivePlayerWeapon AC_GivePlayerWeapon
|
#define GivePlayerWeapon AC_GivePlayerWeapon
|
||||||
|
|
||||||
|
// Function Hook (SetPlayerArmedWeapon)
|
||||||
|
|
||||||
|
stock AC_SetPlayerArmedWeapon( playerid, weaponid )
|
||||||
|
{
|
||||||
|
if ( 0 <= weaponid <= AC_MAX_WEAPONS && p_CurrentArmedWeapon{ playerid } != weaponid ) {
|
||||||
|
p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
||||||
|
p_CurrentArmedWeapon{ playerid } = weaponid;
|
||||||
|
}
|
||||||
|
return SetPlayerArmedWeapon( playerid, weaponid );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined _ALS_SetPlayerArmedWeapon
|
||||||
|
#undef SetPlayerArmedWeapon
|
||||||
|
#else
|
||||||
|
#define _ALS_SetPlayerArmedWeapon
|
||||||
|
#endif
|
||||||
|
#define SetPlayerArmedWeapon AC_SetPlayerArmedWeapon
|
||||||
|
|
||||||
// Function Hook (ResetPlayerWeapons)
|
// Function Hook (ResetPlayerWeapons)
|
||||||
|
|
||||||
stock AC_ResetPlayerWeapons( playerid )
|
stock AC_ResetPlayerWeapons( playerid )
|
||||||
{
|
{
|
||||||
//p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
||||||
|
|
||||||
for ( new i = 0; i < AC_MAX_WEAPONS; i++ )
|
for ( new i = 0; i < AC_MAX_WEAPONS; i++ )
|
||||||
p_PlayerHasWeapon[ playerid ] { i } = false;
|
p_PlayerHasWeapon[ playerid ] { i } = false;
|
||||||
@ -171,15 +195,15 @@ stock AC_CreateDynamicPickup( modelid, type, Float: x, Float: y, Float: z, world
|
|||||||
|
|
||||||
stock vWeaponHackCheck( playerid, keys )
|
stock vWeaponHackCheck( playerid, keys )
|
||||||
{
|
{
|
||||||
if( ( keys & KEY_FIRE ) && ac_IsPlayerSpawned( playerid ) ) {
|
if ( ( keys & KEY_FIRE ) && ac_IsPlayerSpawned( playerid ) ) {
|
||||||
new
|
new iWeapon = GetPlayerWeapon( playerid );
|
||||||
iWeapon = GetPlayerWeapon( playerid );
|
new iTickCount = GetTickCount( );
|
||||||
|
|
||||||
if( iWeapon > -1 && iWeapon < AC_MAX_WEAPONS )
|
if ( iTickCount > p_PlayerWeaponUpdateTime[ playerid ] && 0 <= iWeapon < AC_MAX_WEAPONS )
|
||||||
{
|
{
|
||||||
if( !p_PlayerHasWeapon[ playerid ] { iWeapon } && ( iWeapon != 0 && iWeapon != 40 ) ) {
|
if( !p_PlayerHasWeapon[ playerid ] { iWeapon } && ( iWeapon != 0 && iWeapon != 40 ) && ! ( IsPlayerInAnyVehicle( playerid ) && p_CurrentArmedWeapon{ playerid } != iWeapon ) ) {
|
||||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_WEAPON );
|
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_WEAPON, iWeapon );
|
||||||
printf("[weapon] %d seems to weapon hack (weapon id %d).", playerid, iWeapon );
|
// printf("[weapon] %d seems to weapon hack (weapon id %d).", playerid, iWeapon );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user