Advertisement
RobsonSilva

Anti Glitch

Jan 20th, 2012
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.44 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. /*
  4.  *
  5.  *   "Anti Glitch"
  6.  *  by [S]trong
  7.  *
  8.  *
  9. */
  10.  
  11. stock
  12.     AG_fireTick[MAX_PLAYERS],
  13.     AG_crouchTick[MAX_PLAYERS]
  14. ;
  15.  
  16. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  17.     if((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) {
  18.         switch(GetPlayerWeapon(playerid)) {
  19.             case 22 .. 25, 27, 29 .. 31, 33, 34: { // Armas que queira proibir o c-bug...
  20.                 AG_fireTick[playerid] = GetTickCount();
  21.             }
  22.         }
  23.     }
  24. }
  25.  
  26. public OnPlayerUpdate(playerid) {
  27.     new
  28.         iVar = GetTickCount()
  29.     ;
  30.    
  31.     if(((iVar - AG_fireTick[playerid]) < 520 && (AG_crouchTick[playerid] < iVar) && (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK))) {
  32.         switch(GetPlayerCameraMode(playerid)) {
  33.             case 4, 53, 7: { // 7 para detectar na sniper também...
  34.                 new
  35.                     iKey,
  36.                     iCheck
  37.                 ;
  38.  
  39.                 GetPlayerKeys(playerid, iKey, iCheck, iCheck);
  40.  
  41.                 if((iKey & KEY_CROUCH)) {
  42.                     AG_crouchTick[playerid] = iVar + 520; // não deixar o comando floodar...
  43.                     CallRemoteFunction("OnPlayerGlitch", "i", playerid);
  44.                 }
  45.             }
  46.         }
  47.     }
  48. }
  49.  
  50. forward OnPlayerGlitch(playerid);
  51. public OnPlayerGlitch(playerid) { // Callback chamada quando o jogador faz glitch...
  52.     new
  53.         Float:fCoords[3]
  54.     ;
  55.  
  56.     GetPlayerPos(playerid, fCoords[0], fCoords[1], fCoords[2]);
  57.     SetPlayerPos(playerid, fCoords[0], fCoords[1], fCoords[2] + 1.0);
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement