move player bugger code as module of anticheat/player_bugger.pwn

This commit is contained in:
Lorenc Pekaj 2019-01-01 18:38:35 +11:00
parent b19c4be348
commit fc7aeb2559
5 changed files with 72 additions and 47 deletions

View File

@ -159,6 +159,7 @@ stock AC_SetPlayerSpawned( playerid, bool: spawned ) {
/* ** Modules (remove to disable) ** */ /* ** Modules (remove to disable) ** */
#include "irresistible\anticheat\money.pwn" #include "irresistible\anticheat\money.pwn"
#include "irresistible\anticheat\thermal_vision.pwn" #include "irresistible\anticheat\thermal_vision.pwn"
#include "irresistible\anticheat\player_bugger.pwn"
#include "irresistible\anticheat\bot_attack.pwn" #include "irresistible\anticheat\bot_attack.pwn"
#include "irresistible\anticheat\hitpoints.pwn" #include "irresistible\anticheat\hitpoints.pwn"
#include "irresistible\anticheat\weapon.pwn" #include "irresistible\anticheat\weapon.pwn"

View File

@ -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;
}

View File

@ -11,7 +11,7 @@
/* ** Hooks ** */ /* ** Hooks ** */
hook OnPlayerUpdate( playerid ) { hook OnPlayerUpdate( playerid ) {
if ( ! AC_NightThermalVisionHack( playerid ) ) { if ( ! AC_NightThermalVisionHack( playerid ) ) {
return Y_HOOKS_BREAK_RETURN_1; return Y_HOOKS_BREAK_RETURN_0;
} else { } else {
return Y_HOOKS_CONTINUE_RETURN_1; return Y_HOOKS_CONTINUE_RETURN_1;
} }

View File

@ -115,9 +115,6 @@ new
p_Robberies [ MAX_PLAYERS ], p_Robberies [ MAX_PLAYERS ],
p_ViewingStats [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... }, p_ViewingStats [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... },
p_AntiTextSpamCount [ MAX_PLAYERS char ], 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_PingImmunity [ MAX_PLAYERS char ],
p_Fires [ MAX_PLAYERS ], p_Fires [ MAX_PLAYERS ],
p_AntiTieSpam [ MAX_PLAYERS ], p_AntiTieSpam [ MAX_PLAYERS ],
@ -177,7 +174,6 @@ new
Text3D: p_TiedLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... }, Text3D: p_TiedLabel [ MAX_PLAYERS ] = { Text3D: INVALID_3DTEXT_ID, ... },
p_TiedBy [ MAX_PLAYERS ], p_TiedBy [ MAX_PLAYERS ],
p_BlowjobPrice [ MAX_PLAYERS ], p_BlowjobPrice [ MAX_PLAYERS ],
p_DesyncTime [ MAX_PLAYERS ],
p_AnswerDelay [ MAX_PLAYERS ], p_AnswerDelay [ MAX_PLAYERS ],
p_LastPlayerState [ MAX_PLAYERS char ], p_LastPlayerState [ MAX_PLAYERS char ],
p_RespondDelay [ MAX_PLAYERS ], p_RespondDelay [ MAX_PLAYERS ],

View File

@ -5350,15 +5350,9 @@ public OnPlayerUpdate( playerid )
return 0; return 0;
static static
Float: X, Float: Y, Float: Z,
Float: vX, Float: vY, Float: vZ,
iKeys, iLeftRight, iState iKeys, iLeftRight, iState
; ;
if ( g_iTime < p_DesyncTime[ playerid ] )
return 0; // Desync Feature
GetPlayerKeys( playerid, iKeys, tmpVariable, iLeftRight ); GetPlayerKeys( playerid, iKeys, tmpVariable, iLeftRight );
p_AFKTime[ playerid ] = GetTickCount( ); 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, 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 ); 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; return 1;
} }