Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <foreach>
- #undef MAX_PLAYERS
- #define MAX_PLAYERS (100)
- new Float:AC_oldPos[MAX_PLAYERS][3], AC_oldPlayerState[MAX_PLAYERS], CanCheckABX[MAX_PLAYERS], bool:CanCheckAirBreak[MAX_PLAYERS], NeedCheckTuningAB[MAX_PLAYERS];
- stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
- {
- x1 -= x2;
- y1 -= y2;
- z1 -= z2;
- return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
- }
- forward AntiCheat();
- main()
- {
- print("\n");
- }
- public OnGameModeInit()
- {
- AddPlayerClass(292, 151.4260, -161.4709, 1.5781, 94.3938, 0, 0, 0, 0, 0, 0); // start location in Blue Berry (gangsta)
- UsePlayerPedAnims();
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- CanCheckAirBreak[playerid] = false;
- CanCheckABX[playerid] = true;
- NeedCheckTuningAB [playerid] = 0;
- return true;
- }
- public OnPlayerSpawn(playerid)
- {
- CanCheckAirBreak[playerid] = false;
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- CanCheckABX[playerid] = true;
- NeedCheckTuningAB [playerid] = 0;
- return true;
- }
- public OnPlayerUpdate(playerid)
- {
- // Anti-air break
- // *Note* CanCheckAirBreak[playerid] = false; put into AC_SetPlayerPos.
- //if( !Afking[playerid] && CanCheckABX[playerid])
- if( CanCheckABX[playerid])
- {
- if(!CanCheckAirBreak[playerid])
- {
- AC_AirBreakReset(playerid);
- CanCheckAirBreak[playerid] = true;
- }
- else
- {
- if( NeedCheckTuningAB[ playerid ] == 1 )
- {
- NeedCheckTuningAB[ playerid ] = 0;
- CanCheckAirBreak[ playerid ] = false;
- }
- else if( NeedCheckTuningAB[ playerid ] > 0 ) NeedCheckTuningAB[ playerid ]--;
- else
- {
- new AC_playerState = GetPlayerState(playerid);
- if(AC_oldPlayerState[playerid] == AC_playerState)
- {
- if(AC_playerState == PLAYER_STATE_ONFOOT || AC_playerState == PLAYER_STATE_DRIVER || AC_playerState == PLAYER_STATE_PASSENGER)
- {
- if(AC_playerState == PLAYER_STATE_ONFOOT)
- {
- new AC_animIndex = GetPlayerAnimationIndex(playerid);
- if(AC_animIndex)
- {
- new animLib[32], animName[32];
- GetAnimationName(AC_animIndex, animLib, 32, animName, 32);
- if(!strcmp(animName, "FALL_LAND", true) || !strcmp(animName, "CLIMB_JUMP2FALL", true) || !strcmp(animName, "CLIMB_PULL", true) || !strcmp(animName, "CLIMB_JUMP_B", true))
- {
- CanCheckAirBreak[playerid] = false;
- return true;
- }
- }
- }
- new Float:AC_fPos[3], Float:AC_fSpeed;
- if(AC_playerState == PLAYER_STATE_DRIVER) GetVehicleVelocity(GetPlayerVehicleID(playerid), AC_fPos[0], AC_fPos[1], AC_fPos[2]);
- else GetPlayerVelocity(playerid, AC_fPos[0], AC_fPos[1], AC_fPos[2]);
- AC_fSpeed = floatsqroot(floatpower(AC_fPos[0], 2) + floatpower(AC_fPos[1], 2) + floatpower(AC_fPos[2], 2)) * 200;
- if(AC_oldPos[playerid][0] != 0.0)
- {
- GetPlayerPos(playerid, AC_fPos[0], AC_fPos[1], AC_fPos[2]);
- if( IsPlayerInRangeOfPoint(playerid, 5.0, 616.7820, -74.8151, 997.6350 ) || IsPlayerInRangeOfPoint(playerid, 5.0, 615.2851, -124.2390, 997.6350 ) || IsPlayerInRangeOfPoint(playerid, 5.0, 617.5380, -1.9900, 1000.6829 ) )
- {
- NeedCheckTuningAB [ playerid ] = 10;
- }
- if( NeedCheckTuningAB [ playerid ] == 0 )
- {
- new Float:AC_traveledDistance = GetDistanceBetweenPoints(AC_fPos[0], AC_fPos[1], AC_fPos[2], AC_oldPos[playerid][0], AC_oldPos[playerid][1], AC_oldPos[playerid][2]);
- AC_oldPos[playerid][0] = AC_fPos[0];
- AC_oldPos[playerid][1] = AC_fPos[1];
- AC_oldPos[playerid][2] = AC_fPos[2];
- if(AC_traveledDistance > AC_fSpeed > 0.2)
- {
- new
- pName [ MAX_PLAYER_NAME ],
- zin [ 60 ];
- GetPlayerName ( playerid, pName, MAX_PLAYER_NAME );
- format ( zin, sizeof( zin ), "[ KICK' ] Iðmestas [{FF7E7E}%s{FFFFFF}]", pName );
- SendClientMessageToAll ( 0xFFFFFFFF, zin );
- SendClientMessageToAll ( 0xFFFFFFFF, "{FF0000}[]{FFFFFF} Prieþastis: [{FF7E7E}Galimas 'Air Break' naudojimas{FFFFFF}]" );
- format(zin, 60, "{FF0000}[]{FFFFFF} Greitis {FF7E7E}%f", AC_fSpeed);
- SendClientMessage (playerid ,0xFFFFFFFF, zin );
- //Kick ( playerid );
- }
- }
- }
- else GetPlayerPos(playerid, AC_oldPos[playerid][0], AC_oldPos[playerid][1], AC_oldPos[playerid][2]);
- }
- }
- else CanCheckAirBreak[playerid] = false;
- AC_oldPlayerState[playerid] = AC_playerState;
- }
- }
- }
- else
- {
- if(AC_oldPos[playerid][0] != 0.0) AC_AirBreakReset(playerid);
- }
- return true;
- }
- stock AC_SetPlayerPos( playerid, Float:pPosX, Float:pPosY, Float:pPosZ )
- {
- CanCheckABX [ playerid ] = false;
- CanCheckAirBreak[ playerid ] = false;
- NeedCheckTuningAB [ playerid ] = 5;
- SetPlayerPos( playerid, pPosX, pPosY, pPosZ );
- CanCheckABX [ playerid ] = true;
- }
- stock AC_PutPlayerInVehicle( playerid, pvehicleid, pseatid )
- {
- CanCheckABX [ playerid ] = false;
- CanCheckAirBreak[ playerid ] = false;
- NeedCheckTuningAB [ playerid ] = 5;
- PutPlayerInVehicle( playerid, pvehicleid, pseatid );
- CanCheckABX [ playerid ] = true;
- }
- stock AC_AirBreakReset( playerid )
- {
- AC_oldPos[playerid][0] = 0.0;
- AC_oldPos[playerid][1] = 0.0;
- AC_oldPos[playerid][2] = 0.0;
- }
Advertisement
Add Comment
Please, Sign In to add comment