Advertisement
Guest User

Anti-Sobeit

a guest
Sep 23rd, 2010
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.74 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define LoopPlayers(%0,%1) for(new %0 = 0; %0 < %1;++ %0) if(IsPlayerConnected(%0) && !IsPlayerNPC(%0))
  4. #define VERMELHO 0xC9170EFF //0xFF0000AA
  5. #define NOME_BOT "[BOT]DKN" //- Nome do Bot que Cuida dos Server -//
  6. #define SLOTS 50
  7. #define AntiSyncrobugAmount 20
  8. #define Distancecheck 200
  9. #define Minimumhealth 0
  10. #define Defaulthpchecks 10
  11. #define DefaultQuickturnChecks 5
  12. #define DefaultVehicleNosHackChecks 3
  13. #define DefaultAnimationHackChecks 10
  14. #define DefaultCheckpointHack 4
  15. #define CreateLog 1
  16.  
  17.  
  18. new
  19.     TimerValue[ 0 ] = 5000,
  20.     Weaponshot[ SLOTS ],
  21.     Ammunationcheck[ SLOTS ],
  22.     x_sobcheck[13][2],
  23.     x_gun[ SLOTS ],
  24.     x_ammo[ SLOTS ],
  25.     Float: Portcheck[ SLOTS ],
  26.     Float: cur_x, Float: cur_y, Float: cur_z,
  27.     s0beit_name[ MAX_PLAYER_NAME ],
  28.     Float: x_health,
  29.     Healthhackcheck[ SLOTS ],
  30.     Float: x_oldangle,
  31.     x_Quickturn[ SLOTS ],
  32.     x_Animationhack[ SLOTS ],
  33.     x_VehicleNosHack[ SLOTS ],
  34.     bool: x_Animationcheck[ SLOTS ],
  35.     bool: x_VehicleMod[ SLOTS ],
  36.     x_AntiPortCheckpoint[ SLOTS ],
  37.     Ammucheck[ SLOTS ];
  38.    
  39.  
  40. forward Anticheat();
  41. forward OnAntiCheatInit();
  42. forward OnAntiCheatPlayerKeyStateChange(playerid, newkeys, oldkeys);
  43. forward CheckPositions();
  44. forward OnAntiCheatPlayerDisconnect(playerid);
  45. forward OnAntiCheatPlayerConnect(playerid);
  46. forward OnAntiCheatVehicleMod(playerid,vehicleid,componentid);
  47. forward OnAntiCheatEnterCheckpoint(playerid);
  48. forward AntiCheatLog(string[]);
  49. forward OnAntiCheatPlayerText(playerid, text[]);
  50.  
  51. public OnFilterScriptInit()
  52. {
  53.     SetTimer("Anticheat", TimerValue[ 0 ], true);
  54.     SetTimer("CheckPositions", TimerValue[ 0 ]*5, true);
  55.     return 1;
  56. }
  57.  
  58. stock SetPlayerSavePos(playerid, Float: sob_x, Float: sob_y, Float: sob_z)
  59. {
  60.     GetPlayerPos(playerid, cur_x, cur_y,  cur_x);
  61.     new Float:oldpos_all = floatadd(cur_x, cur_y, cur_x);
  62.     SetPlayerPos(playerid, sob_x, sob_y, sob_z);
  63.     new Float:newpos_all = floatadd(sob_x, sob_y, sob_z);
  64.     new Float:difference_newposoldpos = floatsub(oldpos_all, newpos_all);
  65.     Portcheck[ playerid ] = difference_newposoldpos;
  66.     return 1;
  67. }
  68.  
  69. stock SetPlayerSaveSpecialAction(playerid, actionid)
  70. {
  71.     x_Animationcheck[ playerid ] = true;
  72.     SetPlayerSpecialAction(playerid, actionid);
  73.     return 1;
  74. }
  75.  
  76. public OnAntiCheatEnterCheckpoint(playerid)
  77. {
  78.     if(x_AntiPortCheckpoint[ playerid ] >= DefaultCheckpointHack) { SendClientMessage(playerid, 0xB4B5B7FF, "     U have been kicked cause of an s0beit Checkpoint Cheat"); Kick(playerid);}
  79.     x_AntiPortCheckpoint[ playerid ]++;
  80.     return 1;
  81. }
  82.  
  83. public CheckPositions()
  84. {
  85.     LoopPlayers(x_anti,SLOTS)
  86.     {
  87.         GetPlayerPos(x_anti, cur_x, cur_y,  cur_z);
  88.         GetPlayerHealth(x_anti, x_health);
  89.         new x_veh = GetPlayerVehicleID(x_anti);
  90.         GetVehicleZAngle(x_veh, x_oldangle);
  91.         x_AntiPortCheckpoint[ x_anti ]--;
  92.         if(GetPlayerSpecialAction(x_anti) == SPECIAL_ACTION_NONE) { x_Animationcheck[ x_anti ] = false; }
  93.     }
  94.     return 1;
  95. }
  96. public OnPlayerDisconnect(playerid)
  97. {
  98.  
  99.     GetPlayerName(playerid, s0beit_name, sizeof(s0beit_name));
  100.     return 1;
  101. }
  102. public OnPlayerConnect(playerid)
  103. {
  104.     new
  105.         quickconnect_name[ MAX_PLAYER_NAME ],
  106.         string[ MAX_PLAYER_NAME ];
  107.     GetPlayerName(playerid, quickconnect_name, sizeof(quickconnect_name));
  108.     if(format(string, sizeof(string), "%s", s0beit_name) == format(string, sizeof(string),"%s", quickconnect_name))
  109.     {
  110.         SendClientMessage(playerid, 0xB4B5B7FF, "VocΓͺ foi Kickado por Suspeita de Bot");
  111.         Kick(playerid);
  112.     }
  113.     return 1;
  114. }
  115.  
  116. public OnAntiCheatVehicleMod(playerid,vehicleid,componentid)
  117. {
  118.     if(componentid == 1008 || componentid == 1009 || componentid == 1010 )
  119.     {
  120.         if(x_VehicleMod[ playerid ] == false && x_VehicleNosHack[ playerid ] < DefaultVehicleNosHackChecks) { x_VehicleNosHack[ playerid ]++; }
  121.         else if(x_VehicleMod[ playerid ] == false && x_VehicleNosHack[ playerid ] >= DefaultVehicleNosHackChecks) { KickEx(playerid,"Nitro Hack",NOME_BOT); }
  122.     }
  123.     return 1;
  124. }
  125.  
  126. public Anticheat()
  127. {
  128.     LoopPlayers(x_anti,SLOTS)
  129.     {
  130.         new Float: x_newangle, Float: CurrentPos_X, Float: CurrentPos_Y, Float: CurrentPos_Z, Float: CurrentPos_Angle, Float: AllPos_Angle[ SLOTS ], Float: x_statichealth;
  131.         GetPlayerPos(x_anti, CurrentPos_X, CurrentPos_Y, CurrentPos_Z);
  132.         GetPlayerWeaponData(x_anti, 0, x_sobcheck[0][0], x_sobcheck[0][1]);
  133.         x_sobcheck[0][1] = Ammucheck[ x_anti ];
  134.         Ammucheck[ x_anti ] = GetPlayerAmmo(x_anti);
  135.         GetPlayerFacingAngle(x_anti, AllPos_Angle[ x_anti ]);
  136.         GetPlayerHealth(x_anti, x_statichealth);
  137.      
  138.         if(GetPlayerSpecialAction(x_anti) == SPECIAL_ACTION_DANCE1 || GetPlayerSpecialAction(x_anti) == SPECIAL_ACTION_DANCE2 || GetPlayerSpecialAction(x_anti) == SPECIAL_ACTION_DANCE3 || GetPlayerSpecialAction(x_anti) == SPECIAL_ACTION_DANCE4) { if(x_Animationcheck[ x_anti ] == false) { x_Animationhack[ x_anti ]++; } }
  139.         if(x_Animationhack[ x_anti ] >= DefaultAnimationHackChecks) { KickEx(x_anti,"Dance Hack",NOME_BOT); }
  140.         if(x_newangle != x_oldangle && x_newangle-x_oldangle > 135 || x_newangle-x_oldangle < 135 && x_Quickturn[ x_anti ] < DefaultQuickturnChecks) { x_Quickturn[ x_anti ]++;}
  141.         if(Minimumhealth > x_health-x_statichealth && Healthhackcheck[ x_anti ] < Defaulthpchecks) { Healthhackcheck[ x_anti ]++; }
  142.         else if(Healthhackcheck[ x_anti ] > Defaulthpchecks) { KickEx(x_anti,"Health Hack",NOME_BOT); }
  143.         if(GetPlayerState(x_anti) == 1) { if(Portcheck[ x_anti ] > 30 || Portcheck[ x_anti ] < -30) { KickEx(x_anti,"Air Break",NOME_BOT); } }
  144.         if(GetPlayerFacingAngle(x_anti, CurrentPos_Angle) == AllPos_Angle[ x_anti]) { KickEx(x_anti,"Aim Hack",NOME_BOT); }
  145.         if(Portcheck[ x_anti ] < 100 || Portcheck[ x_anti ] > -100)
  146.         {
  147.             if(CurrentPos_X - cur_x > Distancecheck || CurrentPos_X - cur_x < Distancecheck) { }
  148.             else { Portcheck[ x_anti ] += CurrentPos_X - cur_x; }
  149.         }
  150.         else if(Portcheck[ x_anti ] > 100 || Portcheck[ x_anti ] < -100) { KickEx(x_anti,"Teleport",NOME_BOT); }
  151.         if(Weaponshot[ x_anti ] > 5)
  152.         {
  153.             if(Ammucheck[ x_anti ] < Ammucheck[ x_anti ] - AntiSyncrobugAmount) {KickEx(x_anti,"Weapown Hack",NOME_BOT); }
  154.         }
  155.         else
  156.         {
  157.             Weaponshot[ x_anti ] = 0;
  158.         }
  159.     }
  160.     return 1;
  161. }
  162.  
  163. public OnAntiCheatPlayerKeyStateChange(playerid, newkeys, oldkeys)
  164. {
  165.     x_gun[ playerid ] = GetPlayerWeapon(playerid);
  166.     x_ammo[ playerid ] = GetPlayerAmmo(playerid);
  167.     if(newkeys == KEY_FIRE && x_gun[ playerid ] > 15 && x_gun[ playerid ] < 44 && x_ammo[ playerid ] == Ammucheck[ playerid ])
  168.     {
  169.         GetPlayerWeaponData(playerid, 0, x_sobcheck[0][0], x_sobcheck[0][1]);
  170.         x_sobcheck[0][1] = Ammucheck[ playerid ];
  171.         Ammucheck[ playerid ]--;
  172.         Ammunationcheck[ playerid ] = x_sobcheck[0][1];
  173.     }
  174.     else if(x_ammo[ playerid ] != Ammucheck[ playerid ])
  175.     {
  176.         Weaponshot[ playerid ]++;
  177.         x_ammo[ playerid ] = Ammucheck[ playerid ];
  178.     }
  179.     return 1;
  180. }
  181. stock KickEx(playerid,motivo[],kickou[])
  182. {
  183.     new name[24],string[128],salvar[128],plrIP[16];
  184.     GetPlayerName(playerid, name,24);
  185.     GetPlayerIp(playerid, plrIP, sizeof(plrIP));
  186.     format(string, sizeof(string), "[FeK]: O player %s(%d) foi Kickado pelo Administrador %s | Motivo: %s",name,playerid,kickou,motivo);
  187.     SendClientMessageToAll(VERMELHO, string);
  188.     PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  189.     Kick(playerid);
  190.  
  191.     format(salvar, sizeof(salvar), "Player %s | Admin: %s |Motivo: %s |IP: %s \r\n",name,kickou,motivo,plrIP);
  192.     new File:KicksLogs = fopen("LogKicks.ini",io_append);
  193.     fwrite(KicksLogs,salvar);
  194.     fclose(KicksLogs);
  195.     return false;
  196. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement