diff --git a/gamemodes/irresistible/anticheat/_anticheat.pwn b/gamemodes/irresistible/anticheat/_anticheat.pwn index 7bab1a8..5b9f779 100644 --- a/gamemodes/irresistible/anticheat/_anticheat.pwn +++ b/gamemodes/irresistible/anticheat/_anticheat.pwn @@ -159,6 +159,7 @@ stock AC_SetPlayerSpawned( playerid, bool: spawned ) { /* ** Modules (remove to disable) ** */ #include "irresistible\anticheat\money.pwn" #include "irresistible\anticheat\thermal_vision.pwn" +#include "irresistible\anticheat\player_bugger.pwn" #include "irresistible\anticheat\bot_attack.pwn" #include "irresistible\anticheat\hitpoints.pwn" #include "irresistible\anticheat\weapon.pwn" diff --git a/gamemodes/irresistible/anticheat/player_bugger.pwn b/gamemodes/irresistible/anticheat/player_bugger.pwn new file mode 100644 index 0000000..0625037 --- /dev/null +++ b/gamemodes/irresistible/anticheat/player_bugger.pwn @@ -0,0 +1,70 @@ +/* + * Irresistible Gaming (c) 2018 + * Developed by Lorenc + * Module: irresistible\anticheat\player_bugger.pwn + * Purpose: method(s) for preventing players to be bugged + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Variables ** */ +static stock + p_DesyncTime [ MAX_PLAYERS ], + Float: p_PlayerBuggerX [ MAX_PLAYERS ], + Float: p_PlayerBuggerY [ MAX_PLAYERS ], + Float: p_PlayerBuggerZ [ MAX_PLAYERS ] +; + +/* ** Hooks ** */ +hook OnPlayerUpdate( playerid ) +{ + // automatically resort to using the 'fastest' one + #if defined GetServerTime + new server_time = GetServerTime( ); + #else + new server_time = gettime( ); + #endif + + // desync feature + if ( server_time < p_DesyncTime[ playerid ] ) + return Y_HOOKS_BREAK_RETURN_0; + + static + Float: X, Float: Y, Float: Z, + Float: vX, Float: vY, Float: vZ + ; + + // Fugga.cs + GetPlayerVelocity( playerid, vX, vY, vZ ); + + if ( ( ( vX < -10.0 || vX > 10.0 ) && ( vZ > 1.0 || vZ < -1.0 ) ) || ( ( vX < -3.0 || vX > 3.0 ) && ( vY < -3.0 || vY > 3.0 ) && ( vZ > 3.0 || vZ < -3.0 ) ) ) { + p_DesyncTime[ playerid ] = server_time + 3; + return Y_HOOKS_BREAK_RETURN_0; + } + + // PlayerBugger.cs + GetPlayerPos( playerid, X, Y, Z ); + + if ( X >= 99999.0 || Y >= 99999.0 || Z >= 99999.0 || X <= -99999.0 || Y <= -99999.0 || Z <= -99999.0 ) { + SendClientMessage( playerid, 0xa9c4e4ff, "Warning: Excessive X, Y, Z has been breached thus last location set." ); + SetPlayerPos( playerid, p_PlayerBuggerX[ playerid ], p_PlayerBuggerY[ playerid ], p_PlayerBuggerZ[ playerid ] ); + } else { + p_PlayerBuggerX[ playerid ] = X; + p_PlayerBuggerY[ playerid ] = Y; + p_PlayerBuggerZ[ playerid ] = Z; + } + + // CarSwing.cs + if ( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { + + GetPlayerPos( playerid, X, Y, Z ); + GetVehicleVelocity( GetPlayerVehicleID( playerid ), vX, vY, vZ ); + + if ( ( vX > 3.0 || vY > 3.0 || vZ > 3.0 || vX < -3.0 || vY < -3.0 || vZ < -3.0 ) && ( vX != X && vY != Y && vZ != Z ) ) { + p_DesyncTime[ playerid ] = server_time + 3; + return Y_HOOKS_BREAK_RETURN_0; + } + } + return 1; +} \ No newline at end of file diff --git a/gamemodes/irresistible/anticheat/thermal_vision.pwn b/gamemodes/irresistible/anticheat/thermal_vision.pwn index 7887f39..b7b8d06 100644 --- a/gamemodes/irresistible/anticheat/thermal_vision.pwn +++ b/gamemodes/irresistible/anticheat/thermal_vision.pwn @@ -11,7 +11,7 @@ /* ** Hooks ** */ hook OnPlayerUpdate( playerid ) { if ( ! AC_NightThermalVisionHack( playerid ) ) { - return Y_HOOKS_BREAK_RETURN_1; + return Y_HOOKS_BREAK_RETURN_0; } else { return Y_HOOKS_CONTINUE_RETURN_1; } diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index 4016f9f..5a1841e 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -115,9 +115,6 @@ new p_Robberies [ MAX_PLAYERS ], p_ViewingStats [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... }, p_AntiTextSpamCount [ MAX_PLAYERS char ], - Float: p_PlayerBuggerX [ MAX_PLAYERS ], - Float: p_PlayerBuggerY [ MAX_PLAYERS ], - Float: p_PlayerBuggerZ [ MAX_PLAYERS ], p_PingImmunity [ MAX_PLAYERS char ], p_Fires [ MAX_PLAYERS ], p_AntiTieSpam [ MAX_PLAYERS ], @@ -177,7 +174,6 @@ new Text3D: p_TiedLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... }, p_TiedBy [ MAX_PLAYERS ], p_BlowjobPrice [ MAX_PLAYERS ], - p_DesyncTime [ MAX_PLAYERS ], p_AnswerDelay [ MAX_PLAYERS ], p_LastPlayerState [ MAX_PLAYERS char ], p_RespondDelay [ MAX_PLAYERS ], diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 752e00a..09c068b 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -5350,15 +5350,9 @@ public OnPlayerUpdate( playerid ) return 0; static - Float: X, Float: Y, Float: Z, - Float: vX, Float: vY, Float: vZ, - iKeys, iLeftRight, iState ; - if ( g_iTime < p_DesyncTime[ playerid ] ) - return 0; // Desync Feature - GetPlayerKeys( playerid, iKeys, tmpVariable, iLeftRight ); p_AFKTime[ playerid ] = GetTickCount( ); @@ -5376,42 +5370,6 @@ public OnPlayerUpdate( playerid ) //SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 ); SetPlayerAttachedObject( playerid, 1, 1210, 7, 0.302650, -0.002469, -0.193321, 296.124053, 270.396881, 8.941717, 1.000000, 1.000000, 1.000000 ); } - - // Fugga.cs - GetPlayerVelocity( playerid, vX, vY, vZ ); - if ( ( ( vX < -10.0 || vX > 10.0 ) && ( vZ > 1.0 || vZ < -1.0 ) ) || ( ( vX < -3.0 || vX > 3.0 ) && ( vY < -3.0 || vY > 3.0 ) && ( vZ > 3.0 || vZ < -3.0 ) ) ) - { - //SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for player swinging.", ReturnPlayerName( playerid ), playerid ); - //BanEx( playerid, "Player Swing" ); - p_DesyncTime[ playerid ] = g_iTime + 3; - return 0; - } - - // PlayerBugger.cs - GetPlayerPos( playerid, X, Y, Z ); - if ( X >= 99999.0 || Y >= 99999.0 || Z >= 99999.0 || X <= -99999.0 || Y <= -99999.0 || Z <= -99999.0 ) { - SendClientMessage( playerid, 0xa9c4e4ff, "Warning: Excessive X, Y, Z has been breached thus last location set." ); - SetPlayerPos( playerid, p_PlayerBuggerX[ playerid ], p_PlayerBuggerY[ playerid ], p_PlayerBuggerZ[ playerid ] ); - } - else - { - p_PlayerBuggerX[ playerid ] = X; - p_PlayerBuggerY[ playerid ] = Y; - p_PlayerBuggerZ[ playerid ] = Z; - } - - if ( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) - { - GetPlayerPos( playerid, X, Y, Z ); - GetVehicleVelocity( GetPlayerVehicleID( playerid ), vX, vY, vZ ); - if ( ( vX > 3.0 || vY > 3.0 || vZ > 3.0 || vX < -3.0 || vY < -3.0 || vZ < -3.0 ) && ( vX != X && vY != Y && vZ != Z ) ) - { - //SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for car swinging.", ReturnPlayerName( playerid ), playerid ); - //BanEx( playerid, "Car Swing" ); - p_DesyncTime[ playerid ] = g_iTime + 3; - return 0; - } - } return 1; }