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( ++p_abDetected{ playerid } >= 3 )
|
||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_AIRBRAKE );
|
||||
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_AIRBRAKE, 0 );
|
||||
|
||||
if( p_abResetTimer[ playerid ] == -1 )
|
||||
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( p_cbugWarns{ playerid }++ >= 2 ) {
|
||||
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( 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;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ stock
|
||||
|
||||
// Forwards (Global)
|
||||
|
||||
public OnPlayerCheatDetected( playerid, detection );
|
||||
public OnPlayerCheatDetected( playerid, detection, params );
|
||||
|
||||
// Functions (Global)
|
||||
|
||||
|
@ -413,21 +413,8 @@ hook OnPlayerDeath(playerid, killerid, reason)
|
||||
{
|
||||
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
|
||||
else if( GetPlayerVehicleID( playerid ) && ac_IsPlayerSpawned( playerid ) )
|
||||
if ( GetPlayerVehicleID( playerid ) && ac_IsPlayerSpawned( playerid ) )
|
||||
{
|
||||
if( ( GetTickCount( ) - p_LastTookDamage[ playerid ] ) > 2500 )
|
||||
p_LastDamageIssuer[ playerid ] = INVALID_PLAYER_ID, p_LastWeaponIssuer[ playerid ] = 51;
|
||||
@ -448,9 +435,10 @@ hook OnPlayerDeath(playerid, killerid, reason)
|
||||
/* ** Functions ** */
|
||||
stock ForcePlayerKill( playerid, killerid, weaponid )
|
||||
{
|
||||
SetPVarInt( playerid, "KillerID", killerid );
|
||||
SetPVarInt( playerid, "WeaponID", weaponid );
|
||||
SetPVarInt( playerid, "CustomKill", 1 );
|
||||
p_LastTookDamage[ playerid ] = GetTickCount( );
|
||||
p_LastDamageIssuer[ playerid ] = killerid;
|
||||
p_LastWeaponIssuer[ playerid ] = weaponid;
|
||||
p_LastDamageIssued[ playerid ] = 100.0;
|
||||
|
||||
SetPlayerHealth( playerid, -1 );
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ stock vCheckForSilentAimbot( playerid, hittype, hitid )
|
||||
|
||||
if( iTicks - p_silentAimbotLastCalled[ playerid ] <= 5000 ) {
|
||||
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;
|
||||
|
@ -47,7 +47,7 @@ stock bCheckPlayerRemoteJacking( playerid )
|
||||
if( ( GetVehicleModel( iVehicle ) == 577 ) || ( GetVehicleModel( iVehicle ) == 592 )) fOffset = 25.0; // Andromanda | AT-400
|
||||
|
||||
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 ] );
|
||||
p_remoteJackData[ playerid ] [ E_LAST_VEH ] = iVehicle;
|
||||
|
@ -51,7 +51,7 @@ stock bCheckForSpectatingHacks( playerid, iState, iTicks )
|
||||
if( iTicks > p_PlayerSpectateUpdateTime[ 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 } );
|
||||
}
|
||||
p_PlayerSpectateUpdateTime[ playerid ] = iTicks + 1000;
|
||||
|
@ -28,15 +28,21 @@
|
||||
#include < anticheat\global >
|
||||
#include < anticheat\player >
|
||||
|
||||
// Player Variables
|
||||
|
||||
static p_PlayerWeaponUpdateTime[ MAX_PLAYERS ];
|
||||
static p_CurrentArmedWeapon[ MAX_PLAYERS char ];
|
||||
|
||||
// Function Hook (GivePlayerWeapon)
|
||||
|
||||
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_CurrentArmedWeapon{ playerid } = weaponid;
|
||||
}
|
||||
return GivePlayerWeapon( playerid, weaponid, ammo );
|
||||
}
|
||||
|
||||
@ -47,11 +53,29 @@ stock AC_GivePlayerWeapon( playerid, weaponid, ammo )
|
||||
#endif
|
||||
#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)
|
||||
|
||||
stock AC_ResetPlayerWeapons( playerid )
|
||||
{
|
||||
//p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
||||
p_PlayerWeaponUpdateTime[ playerid ] = GetTickCount( ) + 2000;
|
||||
|
||||
for ( new i = 0; i < AC_MAX_WEAPONS; i++ )
|
||||
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 )
|
||||
{
|
||||
if( ( keys & KEY_FIRE ) && ac_IsPlayerSpawned( playerid ) ) {
|
||||
new
|
||||
iWeapon = GetPlayerWeapon( playerid );
|
||||
if ( ( keys & KEY_FIRE ) && ac_IsPlayerSpawned( playerid ) ) {
|
||||
new 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 ) ) {
|
||||
CallLocalFunction( "OnPlayerCheatDetected", "dd", playerid, CHEAT_TYPE_WEAPON );
|
||||
printf("[weapon] %d seems to weapon hack (weapon id %d).", playerid, iWeapon );
|
||||
if( !p_PlayerHasWeapon[ playerid ] { iWeapon } && ( iWeapon != 0 && iWeapon != 40 ) && ! ( IsPlayerInAnyVehicle( playerid ) && p_CurrentArmedWeapon{ playerid } != iWeapon ) ) {
|
||||
CallLocalFunction( "OnPlayerCheatDetected", "ddd", playerid, CHEAT_TYPE_WEAPON, iWeapon );
|
||||
// printf("[weapon] %d seems to weapon hack (weapon id %d).", playerid, iWeapon );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user