Guest User

Ati TELE

a guest
Aug 2nd, 2011
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. #include <a_samp>
  2. #include <foreach>
  3.  
  4. #undef MAX_PLAYERS
  5. #define MAX_PLAYERS (100)
  6.  
  7. new Float:AC_oldPos[MAX_PLAYERS][3], AC_oldPlayerState[MAX_PLAYERS], CanCheckABX[MAX_PLAYERS], bool:CanCheckAirBreak[MAX_PLAYERS], NeedCheckTuningAB[MAX_PLAYERS];
  8.  
  9. stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
  10. {
  11. x1 -= x2;
  12. y1 -= y2;
  13. z1 -= z2;
  14. return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
  15. }
  16.  
  17. forward AntiCheat();
  18.  
  19. main()
  20. {
  21. print("\n");
  22. }
  23.  
  24. public OnGameModeInit()
  25. {
  26. AddPlayerClass(292, 151.4260, -161.4709, 1.5781, 94.3938, 0, 0, 0, 0, 0, 0); // start location in Blue Berry (gangsta)
  27. UsePlayerPedAnims();
  28. return true;
  29. }
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33. CanCheckAirBreak[playerid] = false;
  34. CanCheckABX[playerid] = true;
  35. NeedCheckTuningAB [playerid] = 0;
  36. return true;
  37. }
  38.  
  39. public OnPlayerSpawn(playerid)
  40. {
  41. CanCheckAirBreak[playerid] = false;
  42. return true;
  43. }
  44.  
  45. public OnPlayerDisconnect(playerid, reason)
  46. {
  47. CanCheckABX[playerid] = true;
  48. NeedCheckTuningAB [playerid] = 0;
  49. return true;
  50. }
  51.  
  52. public OnPlayerUpdate(playerid)
  53. {
  54. // Anti-air break
  55. // *Note* CanCheckAirBreak[playerid] = false; put into AC_SetPlayerPos.
  56.  
  57. //if( !Afking[playerid] && CanCheckABX[playerid])
  58. if( CanCheckABX[playerid])
  59. {
  60. if(!CanCheckAirBreak[playerid])
  61. {
  62. AC_AirBreakReset(playerid);
  63. CanCheckAirBreak[playerid] = true;
  64. }
  65. else
  66. {
  67. if( NeedCheckTuningAB[ playerid ] == 1 )
  68. {
  69. NeedCheckTuningAB[ playerid ] = 0;
  70. CanCheckAirBreak[ playerid ] = false;
  71. }
  72. else if( NeedCheckTuningAB[ playerid ] > 0 ) NeedCheckTuningAB[ playerid ]--;
  73. else
  74. {
  75. new AC_playerState = GetPlayerState(playerid);
  76. if(AC_oldPlayerState[playerid] == AC_playerState)
  77. {
  78. if(AC_playerState == PLAYER_STATE_ONFOOT || AC_playerState == PLAYER_STATE_DRIVER || AC_playerState == PLAYER_STATE_PASSENGER)
  79. {
  80. if(AC_playerState == PLAYER_STATE_ONFOOT)
  81. {
  82. new AC_animIndex = GetPlayerAnimationIndex(playerid);
  83. if(AC_animIndex)
  84. {
  85. new animLib[32], animName[32];
  86. GetAnimationName(AC_animIndex, animLib, 32, animName, 32);
  87. if(!strcmp(animName, "FALL_LAND", true) || !strcmp(animName, "CLIMB_JUMP2FALL", true) || !strcmp(animName, "CLIMB_PULL", true) || !strcmp(animName, "CLIMB_JUMP_B", true))
  88. {
  89. CanCheckAirBreak[playerid] = false;
  90. return true;
  91. }
  92. }
  93. }
  94.  
  95. new Float:AC_fPos[3], Float:AC_fSpeed;
  96. if(AC_playerState == PLAYER_STATE_DRIVER) GetVehicleVelocity(GetPlayerVehicleID(playerid), AC_fPos[0], AC_fPos[1], AC_fPos[2]);
  97. else GetPlayerVelocity(playerid, AC_fPos[0], AC_fPos[1], AC_fPos[2]);
  98. AC_fSpeed = floatsqroot(floatpower(AC_fPos[0], 2) + floatpower(AC_fPos[1], 2) + floatpower(AC_fPos[2], 2)) * 200;
  99. if(AC_oldPos[playerid][0] != 0.0)
  100. {
  101. GetPlayerPos(playerid, AC_fPos[0], AC_fPos[1], AC_fPos[2]);
  102.  
  103. 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 ) )
  104. {
  105. NeedCheckTuningAB [ playerid ] = 10;
  106. }
  107.  
  108. if( NeedCheckTuningAB [ playerid ] == 0 )
  109. {
  110. 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]);
  111.  
  112. AC_oldPos[playerid][0] = AC_fPos[0];
  113. AC_oldPos[playerid][1] = AC_fPos[1];
  114. AC_oldPos[playerid][2] = AC_fPos[2];
  115. if(AC_traveledDistance > AC_fSpeed > 0.2)
  116. {
  117. new
  118. pName [ MAX_PLAYER_NAME ],
  119. zin [ 60 ];
  120.  
  121. GetPlayerName ( playerid, pName, MAX_PLAYER_NAME );
  122. format ( zin, sizeof( zin ), "[ KICK' ] Iðmestas [{FF7E7E}%s{FFFFFF}]", pName );
  123. SendClientMessageToAll ( 0xFFFFFFFF, zin );
  124. SendClientMessageToAll ( 0xFFFFFFFF, "{FF0000}[]{FFFFFF} Prieþastis: [{FF7E7E}Galimas 'Air Break' naudojimas{FFFFFF}]" );
  125. format(zin, 60, "{FF0000}[]{FFFFFF} Greitis {FF7E7E}%f", AC_fSpeed);
  126. SendClientMessage (playerid ,0xFFFFFFFF, zin );
  127. //Kick ( playerid );
  128. }
  129. }
  130. }
  131. else GetPlayerPos(playerid, AC_oldPos[playerid][0], AC_oldPos[playerid][1], AC_oldPos[playerid][2]);
  132. }
  133. }
  134. else CanCheckAirBreak[playerid] = false;
  135. AC_oldPlayerState[playerid] = AC_playerState;
  136. }
  137. }
  138. }
  139. else
  140. {
  141. if(AC_oldPos[playerid][0] != 0.0) AC_AirBreakReset(playerid);
  142. }
  143. return true;
  144. }
  145.  
  146. stock AC_SetPlayerPos( playerid, Float:pPosX, Float:pPosY, Float:pPosZ )
  147. {
  148. CanCheckABX [ playerid ] = false;
  149. CanCheckAirBreak[ playerid ] = false;
  150. NeedCheckTuningAB [ playerid ] = 5;
  151. SetPlayerPos( playerid, pPosX, pPosY, pPosZ );
  152. CanCheckABX [ playerid ] = true;
  153. }
  154.  
  155. stock AC_PutPlayerInVehicle( playerid, pvehicleid, pseatid )
  156. {
  157. CanCheckABX [ playerid ] = false;
  158. CanCheckAirBreak[ playerid ] = false;
  159. NeedCheckTuningAB [ playerid ] = 5;
  160. PutPlayerInVehicle( playerid, pvehicleid, pseatid );
  161. CanCheckABX [ playerid ] = true;
  162. }
  163.  
  164. stock AC_AirBreakReset( playerid )
  165. {
  166. AC_oldPos[playerid][0] = 0.0;
  167. AC_oldPos[playerid][1] = 0.0;
  168. AC_oldPos[playerid][2] = 0.0;
  169. }
Advertisement
Add Comment
Please, Sign In to add comment