Guest User

Untitled

a guest
Oct 16th, 2011
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.79 KB | None | 0 0
  1. /* Anti-Cheat by DaRkAnGeL[NBK]
  2.  * Includes Cash hack, Airbreak hack, Weapon hack, Jetpack hack, Anti-Spam
  3.  * Will release update shortly
  4.  */
  5.  
  6. #include <a_samp>
  7. #include <WeaponKick> //define if player is banned for hacking weapons
  8. //#include <WeaponBan> //define if player is banned for hacking weapons
  9. // Anti Cash Hack
  10.  
  11. #define ResetMoneyBar ResetPlayerMoney
  12. #define UpdateMoneyBar GivePlayerMoney
  13.  
  14.  
  15.  
  16. new Cash[MAX_PLAYERS];
  17.  
  18. stock GivePlayerCash(playerid, money)
  19. {
  20.     Cash[playerid] += money;
  21.     ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
  22.     UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
  23.     return Cash[playerid];
  24. }
  25. stock SetPlayerCash(playerid, money)
  26. {
  27.     Cash[playerid] = money;
  28.     ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
  29.     UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
  30.     return Cash[playerid];
  31. }
  32. stock ResetPlayerCash(playerid)
  33. {
  34.     Cash[playerid] = 0;
  35.     ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
  36.     UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
  37.     return Cash[playerid];
  38. }
  39. stock GetPlayerCash(playerid)
  40. {
  41.     return Cash[playerid];
  42. }
  43. forward MoneyTimer();
  44. public MoneyTimer()
  45. {
  46.     new username[MAX_PLAYER_NAME];
  47.     for(new i=0; i<MAX_PLAYERS; i++)
  48.     {
  49.         if(IsPlayerConnected(i))
  50.         {
  51.             if(GetPlayerCash(i) != GetPlayerMoney(i))
  52.             {
  53.                 ResetMoneyBar(i);//Resets the money in the original moneybar, Do not remove!
  54.                 UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
  55.                 new hack = GetPlayerMoney(i) - GetPlayerCash(i);
  56.                 GetPlayerName(i,username,sizeof(username));
  57.                 printf("%s has picked up/attempted to spawn $%d.", username,hack);
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63.  
  64. //anti teleport
  65. stock Float:GetDistanceBetweenPoints(Float:rx1,Float:ry1,Float:rz1,Float:rx2,Float:ry2,Float:rz2)
  66. {
  67.     return floatadd(floatadd(floatsqroot(floatpower(floatsub(rx1,rx2),2)),floatsqroot(floatpower(floatsub(ry1,ry2),2))),floatsqroot(floatpower(floatsub(rz1,rz2),2)));
  68. }
  69.  
  70.  
  71. public OnFilterScriptInit()
  72. {
  73.     SetTimer("MoneyTimer", 1000, 1);
  74.     // Anti Weapon Hacking
  75.     CheckForAll();      //Checks if any weapon is spawned
  76.     //CheckForMeele();      //Checks if Meele weapons are spawned
  77.     //CheckForHeavy();      //Checks if Heavy weapons are spawned
  78.     //CheckForAssault();    //Checks if Assualt weapons are spawned
  79.     //CheckForLight();      //Checks if Light weapons are spawned
  80.     //CheckForShotgun();    //Checks if Shotguns are spawned
  81.     //CheckForRifle();      //Checks if Rifles are spawned
  82.     //CheckForRPG();    //Checks if RPG's and Heatseakers are spawned
  83.     //CheckForMinigun();    //Checks if Miniguns are spawned
  84.     //CheckForGrenade();  //Checks if Grenades are spawned
  85.     //CheckForMolotov();  //Checks if Molotovs are spawned
  86.     //CheckForStatchel();  //Checks if Statchel charges are spawned
  87.     //CheckForVision();   //Checks if Night vision/Heat vision goggles are spawned
  88.  
  89.     // Anti Jetpack
  90.     SetTimer("JetPack",1000,1);
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerConnect(playerid)
  95. {
  96. // Anti-Airbreak
  97.     SetPVarInt(playerid, "airbreak",0);
  98.     ResetPlayerCash(playerid);
  99.     return 1;
  100. }
  101. public OnPlayerDisconnect(playerid)
  102. {
  103.     DeletePVar( playerid, "airbreak" );
  104.     return 1;
  105. }
  106. // Anti Spam
  107.  
  108. public OnPlayerText(playerid, text[])
  109. {
  110.     SetPVarInt(playerid,"textspam",GetPVarInt(playerid,"textspam")+1);
  111.     if(GetPVarInt(playerid,"textspam") == 5) {
  112.         new string[128];
  113.         new tname[MAX_PLAYER_NAME];
  114.         GetPlayerName(playerid,tname,sizeof(tname));
  115.         format(string,sizeof(string),"[SERVER]: %s(%d) Has Been Kicked For: Spam",tname,playerid);
  116.         SendClientMessageToAll(0xAA3333AA,string);
  117.         Kick(playerid);
  118.         }
  119.         else if(GetPVarInt(playerid,"textspam") == 4) {
  120.         SendClientMessage(playerid,0xAA3333AA,"Do Not Spam You Must Wait: 5 Seconds");
  121.         return 0;
  122.     }
  123.     return 1;
  124. }
  125.  
  126. forward clearspam(playerid);
  127. public clearspam(playerid)
  128. {
  129.     SetPVarInt(playerid,"textspam",0);
  130. }
  131.  
  132. forward JetPack();
  133. public JetPack()
  134. {
  135.     for(new i;i<MAX_PLAYERS;i++)
  136.     {
  137.         if(IsPlayerConnected(i))
  138.       {
  139.             if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
  140.             {
  141.                 new tname[MAX_PLAYER_NAME], string[128];
  142.                 GetPlayerName(i, tname, sizeof(tname));
  143.                 format(string, sizeof(string), "AC BAN: %s(%d) has been banned",tname,i);
  144.                 SendClientMessageToAll(0xAA3333AA, string);
  145.                 Ban(i);
  146.             }
  147.         }
  148.     }
  149. }
  150. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  151. {
  152.         new Float:a;
  153.         GetPlayerPos(playerid, x, y, a);
  154.         GetPlayerFacingAngle(playerid, a);
  155.         if (GetPlayerVehicleID(playerid))
  156.         {
  157.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  158.         }
  159.         x += (distance * floatsin(-a, degrees));
  160.         y += (distance * floatcos(-a, degrees));
  161. }
  162.  
  163. GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
  164. {
  165.         new Float:a;
  166.         GetPlayerPos(playerid, x, y, a);
  167.         GetPlayerFacingAngle(playerid, a);
  168.         a = a - 180;
  169.         if (GetPlayerVehicleID(playerid))
  170.         {
  171.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  172.         }
  173.         x += (distance * floatsin(-a, degrees));
  174.         y += (distance * floatcos(-a, degrees));
  175. }
  176.  
  177. GetXYRightOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  178. {
  179.         new Float:a;
  180.         GetPlayerPos(playerid, x, y, a);
  181.         GetPlayerFacingAngle(playerid, a);
  182.         a = a - 90;
  183.         if (GetPlayerVehicleID(playerid))
  184.         {
  185.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  186.         }
  187.         x += (distance * floatsin(-a, degrees));
  188.         y += (distance * floatcos(-a, degrees));
  189. }
  190.  
  191. GetXYLeftOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  192. {
  193.         new Float:a;
  194.         GetPlayerPos(playerid, x, y, a);
  195.         GetPlayerFacingAngle(playerid, a);
  196.         a = a + 90;
  197.         if (GetPlayerVehicleID(playerid))
  198.         {
  199.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  200.         }
  201.         x += (distance * floatsin(-a, degrees));
  202.         y += (distance * floatcos(-a, degrees));
  203. }
  204.  
  205. public OnPlayerUpdate( playerid ) {
  206.         new Keys,ud,lr;
  207.         GetPlayerKeys(playerid,Keys,ud,lr);
  208.         if( ud < 0 ) {
  209.                 if( GetPVarInt( playerid, "airbreak" ) == 1 ) {
  210.                 new Float:x, Float:y;
  211.                 new Float:x2, Float:y2, Float:z2;
  212.                 GetXYInFrontOfPlayer( playerid, x, y, 1.5 );
  213.                 GetPlayerPos( playerid, x2, y2, z2 );
  214.                 #pragma unused x2
  215.                 #pragma unused y2
  216.                 SetPlayerPos( playerid, x, y, z2 );
  217.                 }
  218.         }
  219.         if( ud > 0 ) {
  220.                 if( GetPVarInt( playerid, "airbreak" ) == 1 ) {
  221.                 new Float:x, Float:y;
  222.                 new Float:x2, Float:y2, Float:z2;
  223.                 GetXYBehindPlayer( playerid, x, y, 1.5 );
  224.                 GetPlayerPos( playerid, x2, y2, z2 );
  225.                 #pragma unused x2
  226.                 #pragma unused y2
  227.                 SetPlayerPos( playerid, x, y, z2 );
  228.                 }
  229.         }
  230.         if( lr > 0 ) {
  231.                 if( GetPVarInt( playerid, "airbreak" ) == 1 ) {
  232.                 new Float:x, Float:y;
  233.                 new Float:x2, Float:y2, Float:z2;
  234.                 GetXYRightOfPlayer( playerid, x, y, 2.0 );
  235.                 GetPlayerPos( playerid, x2, y2, z2 );
  236.                 #pragma unused x2
  237.                 #pragma unused y2
  238.                 SetPlayerPos( playerid, x, y, z2 );
  239.                 }
  240.         }
  241.         if( lr < 0 ) {
  242.                 if( GetPVarInt( playerid, "airbreak" ) == 1 ) {
  243.                 new Float:x, Float:y;
  244.                 new Float:x2, Float:y2, Float:z2;
  245.                 GetXYLeftOfPlayer( playerid, x, y, 2.0 );
  246.                 GetPlayerPos( playerid, x2, y2, z2 );
  247.                 #pragma unused x2
  248.                 #pragma unused y2
  249.                 SetPlayerPos( playerid, x, y, z2 );
  250.                 }
  251.         }
  252.         if( Keys & KEY_SPRINT ) {
  253.                 if( GetPVarInt( playerid, "airbreak" ) == 1 ) {
  254.                 new Float:x, Float:y, Float:z;
  255.                 GetPlayerPos( playerid, x, y, z );
  256.                 SetPlayerPos( playerid, x, y, z + 2.0 );
  257.                 }
  258.         }
  259.         if( Keys & KEY_JUMP ) {
  260.                 if( GetPVarInt( playerid, "airbreak" ) == 1 ) {
  261.                 new Float:x, Float:y, Float:z;
  262.                 GetPlayerPos( playerid, x, y, z );
  263.                 SetPlayerPos( playerid, x, y, z - 2.0 );
  264.                 }
  265.         }
  266.         return 1;
  267. }
  268.  
Advertisement
Add Comment
Please, Sign In to add comment