diff --git a/gamemodes/irresistible/anticheat/_anticheat.pwn b/gamemodes/irresistible/anticheat/_anticheat.pwn index 0825fd7..7bab1a8 100644 --- a/gamemodes/irresistible/anticheat/_anticheat.pwn +++ b/gamemodes/irresistible/anticheat/_anticheat.pwn @@ -158,6 +158,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\bot_attack.pwn" #include "irresistible\anticheat\hitpoints.pwn" #include "irresistible\anticheat\weapon.pwn" diff --git a/gamemodes/irresistible/anticheat/thermal_vision.pwn b/gamemodes/irresistible/anticheat/thermal_vision.pwn new file mode 100644 index 0000000..7887f39 --- /dev/null +++ b/gamemodes/irresistible/anticheat/thermal_vision.pwn @@ -0,0 +1,64 @@ +/* + * Irresistible Gaming (c) 2018 + * Developed by wups, Lorenc + * Module: irresistible\anticheat\thermal_vision.pwn + * Purpose: prevents players from randomly enabling thermal vision + */ + +/* ** Includes ** */ +#include < YSI\y_hooks > + +/* ** Hooks ** */ +hook OnPlayerUpdate( playerid ) { + if ( ! AC_NightThermalVisionHack( playerid ) ) { + return Y_HOOKS_BREAK_RETURN_1; + } else { + return Y_HOOKS_CONTINUE_RETURN_1; + } +} + +/* ** Functions ** */ +static stock AC_NightThermalVisionHack( playerid ) // Created by wups +{ + static + weapon; + + weapon = GetPlayerWeapon( playerid ); + if ( weapon == 44 || weapon == 45 ) + { + static + HoldingFire[ MAX_PLAYERS ], + IsHoldingFire[ MAX_PLAYERS char ], + CanHoldAgain[ MAX_PLAYERS char ], + keys, lr, tick + ; + + GetPlayerKeys( playerid, keys, lr, lr); + tick = GetTickCount( ); + + if ( keys & KEY_FIRE ) + { + if ( !IsHoldingFire{ playerid } && CanHoldAgain{ playerid } ) + { + IsHoldingFire{ playerid } = 1; + HoldingFire[ playerid ] = tick; + CanHoldAgain{ playerid } = 0; + } + } + else if ( !CanHoldAgain{ playerid } ) CanHoldAgain{ playerid } = 1; + + if ( IsHoldingFire{ playerid } ) + { + if ( tick - 1500 <= HoldingFire[ playerid ] ) + { + return 0; + } + else + { + IsHoldingFire{ playerid } = 0; + return 1; + } + } + } + return 1; +} \ No newline at end of file diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 58d5dfc..752e00a 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -5346,7 +5346,7 @@ function unpause_Player( playerid ) public OnPlayerUpdate( playerid ) { - if ( !p_PlayerLogged{ playerid } ) + if ( ! p_PlayerLogged{ playerid } ) return 0; static @@ -5412,7 +5412,7 @@ public OnPlayerUpdate( playerid ) return 0; } } - return fix_NightThermalVisionHack( playerid ); + return 1; } public OnPlayerStreamIn(playerid, forplayerid) @@ -8375,51 +8375,6 @@ function HidePlayerHelpDialog( playerid ) PlayerTextDrawHide( playerid, p_HelpBoxTD[ playerid ] ); } -stock fix_NightThermalVisionHack( playerid ) // Created by wups -{ - static - weapon; - - weapon = GetPlayerWeapon( playerid ); - if ( weapon == 44 || weapon == 45 ) - { - static - HoldingFire[ MAX_PLAYERS ], - IsHoldingFire[ MAX_PLAYERS char ], - CanHoldAgain[ MAX_PLAYERS char ], - keys, lr, tick - ; - - GetPlayerKeys( playerid, keys, lr, lr); - tick = GetTickCount( ); - - if ( keys & KEY_FIRE ) - { - if ( !IsHoldingFire{ playerid } && CanHoldAgain{ playerid } ) - { - IsHoldingFire{ playerid } = 1; - HoldingFire[ playerid ] = tick; - CanHoldAgain{ playerid } = 0; - } - } - else if ( !CanHoldAgain{ playerid } ) CanHoldAgain{ playerid } = 1; - - if ( IsHoldingFire{ playerid } ) - { - if ( tick - 1500 <= HoldingFire[ playerid ] ) - { - return 0; - } - else - { - IsHoldingFire{ playerid } = 0; - return 1; - } - } - } - return 1; -} - stock hasBadDrivebyWeapon( playerid ) { for( new i; i < sizeof g_BannedDrivebyWeapons; i++ )