Advertisement
Guest User

ZVAnti-Cheat

a guest
Dec 29th, 2010
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 22.20 KB | None | 0 0
  1. //==============================================================================
  2. /* # Sistema Anti-Cheat                                                       */
  3. /* # Autor: Zoutdaxv                                                          */
  4. /* # Versión: 0.1 b                                                              */
  5. /* # Versión SA-MP: 0.3c                                                      */
  6. /* # Tipo de script: FilterScript                                             */
  7. /* # Lenguaje: Castellano Neutro                                              */
  8. /* # Fecha: 29/12/2010 15:43 HRS UTC/GTM -6                                   */
  9. /* # Actualización: 29/12/2010 15:43 HRS UTC/GTM -6                           */
  10. /* # Créditos:                                                                */
  11. /*  - Y_Less: Método para librerías                                           */
  12. /*  - elvago: Pruebas                                                         */
  13. //==============================================================================
  14. #include <a_samp>
  15. //============================ <VARIABLES> =====================================
  16. static
  17.     Cb_OPD,   //Callback OnPlayerDisconnect
  18.     Cb_OPS,   //Callback OnPlayerSpawn
  19.     Cb_OPIC,  //Callback OnPlayerInteriorChange
  20.     Cb_OPPUP, //Callback OnPlayerPickUpPickup
  21.     Cb_OVS,   //Callback OnVehicleSpawn
  22.     Cb_OPU;   //Callback OnPlayerUpdate
  23.    
  24. static WeaponNames[47][] = {
  25. "Sin arma", "Brass Knuckles", "Golf Club", "Nite Stick", "Knife", "Baseball Bat",
  26. "Shovel", "Pool Cue", "Katana", "Chainsaw", "Purple Dildo", "Small White Vibrator",
  27. "Large White Vibrator", "Silver Vibrator", "Flowers", "Cane", "Grenade", "Tear Gas",
  28. "Molotov Cocktail", "19", "20", "21", "9mm", "Silenced 9mm", "Desert Eagle",
  29. "Shotgun", "Sawn-off Shotgun", "Combat Shotgun", "Micro SMG", "SMG", "AK47", "M4",
  30. "Tec9", "Country Rifle", "Sniper Rifle", "Rocket Launcher", "HS Rocket Launcher",
  31. "Flamethrower", "Minigun", "Satchel Charge", "Detonator", "Spraycan",
  32. "Fire Extinguisher", "Camera", "Nightvision Goggles", "Thermal Goggles", "Parachute"
  33. };
  34.  
  35. static
  36.     bool:AC_BAN[MAX_PLAYERS] = {true, ...},
  37.     Float:Health[MAX_PLAYERS] = {100.0, ...},
  38.     Float:Armour[MAX_PLAYERS],
  39.     Float:Position[MAX_PLAYERS][3],//0: X, 1: Y, 2: Z
  40.     Float:VehicleHealth[MAX_VEHICLES] = {1000.0, ...},
  41.     Weapon[MAX_PLAYERS],
  42.     Ammo[MAX_PLAYERS],
  43.     WeaponData[MAX_PLAYERS][13][2],
  44.     Money[MAX_PLAYERS],
  45.     NR_CheckCount[MAX_PLAYERS],//Count No reload
  46.     UpdateCount[MAX_PLAYERS];
  47. //******************************************************************************
  48. //Configuración/Configuration:
  49. static
  50.     Prohibited_Weapons[] = {16, 17, 18, 35, 36, 37, 38, 39, 40, 43, 44, 45},
  51.     MAX_MONEY = 1000000,//Por defecto/Default: 1,000,000.
  52.     MONEY_AMOUNT = 200;//:
  53.     //SPA: Cantidad que detectará el Anti-Cheat, por defecto $200.
  54.     //ENG: Amount of money that will detect the Anti-Cheat, by default $200.
  55. //------------------------------------------------------------------------------
  56. static
  57.     bool:BAN = false,             //true = ban, false = kick
  58.     bool:Admin_Immunity = true,   //Inmunidad para administradores RCON
  59.     bool:AC_HH = true,            //Health Hacks
  60.     bool:AC_AH = true,            //Armour Hacks
  61.     bool:AC_VHH = true,           //Vehicle Health Hacks
  62.     bool:AC_VSH = true,           //Vehicle Speed Hacks
  63.     bool:AC_AB = true,            //AirBreak
  64.     bool:AC_T = true,             //Teleport
  65.     bool:AC_NR = true,            //No Reload
  66.     bool:AC_PW = true,            //Prohibited weapon
  67.     bool:AC_SW = true,            //Spawn Weapon
  68.     bool:AC_MH = true,            //Money Hacks
  69.     bool:AC_JP = true;            //JetPack
  70. //******************************************************************************
  71. //==============================================================================
  72. public OnFilterScriptInit()
  73. {
  74.     //--------------------------------------------------------------------------
  75.     //Verificar si existen los Callbacks
  76.     Cb_OPD = funcidx("ZVACCb_OnPlayerDisconnect") != -1;
  77.     Cb_OPS = funcidx("ZVACCb_OnPlayerSpawn") != -1;
  78.     Cb_OPIC = funcidx("ZVACCb_OnPlayerInteriorChange") != -1;
  79.     Cb_OPPUP = funcidx("ZVACCb_OnPlayerPickUpPickup") != -1;
  80.     Cb_OVS = funcidx("ZVACCb_OnVehicleSpawn") != -1;
  81.     Cb_OPU = funcidx("ZVACCb_OnPlayerUpdate") != -1;
  82.  
  83.     new
  84.         val = 1;
  85.        
  86.     if(funcidx("ZVACCb_OnFilterScriptInit") != -1)//Verificar si existe el Callback
  87.     {
  88.         val = CallLocalFunction("ZVACCb_OnFilterScriptInit", "");
  89.     }
  90.     //--------------------------------------------------------------------------
  91.     print("\n");
  92.     print(" $$$$$$$$$$$$$$$$$");
  93.     print(" $ ZV Anti-Cheat $");
  94.     print(" $    V 0.1 b    $");
  95.     print(" $$$$$$$$$$$$$$$$$");
  96.     print("\n");
  97.     return val;
  98. }
  99. //Renombrar el siguiente OnFilterScriptInit
  100. #if defined _ALS_OnFilterScriptInit
  101.     #undef OnFilterScriptInit
  102. #else
  103.     #define _ALS_OnFilterScriptInit
  104. #endif
  105. #define OnFilterScriptInit ZVACCb_OnFilterScriptInit
  106. //Forward el siguiente
  107. forward ZVACCb_OnFilterScriptInit();
  108.  
  109. public OnFilterScriptExit()
  110. {
  111.     //--------------------------------------------------------------------------
  112.     new
  113.         val = 1;
  114.  
  115.     if(funcidx("ZVACCb_OnFilterScriptExit") != -1)//Verificar si existe el Callback
  116.     {
  117.         val = CallLocalFunction("ZVACCb_OnFilterScriptExit", "");
  118.     }
  119.     //--------------------------------------------------------------------------
  120.     return val;
  121. }
  122. //Renombrar el siguiente OnFilterScriptExit
  123. #if defined _ALS_OnFilterScriptExit
  124.     #undef OnFilterScriptExit
  125. #else
  126.     #define _ALS_OnFilterScriptExit
  127. #endif
  128. #define OnFilterScriptExit ZVACCb_OnFilterScriptExit
  129. //Forward el siguiente
  130. forward ZVACCb_OnFilterScriptExit();
  131.  
  132. public OnPlayerDisconnect(playerid, reason)
  133. {
  134.     AC_BAN[playerid] = true;//Activate Anti-Cheat BAN
  135.     //Reset Variables:
  136.     Health[playerid] = 100.0;
  137.     Armour[playerid] = 0.0;
  138.     Position[playerid][0] = 0.0;//X
  139.     Position[playerid][1] = 0.0;//Y
  140.     Position[playerid][2] = 0.0;//Z
  141.     for(new w = 0; w < 13; w++)
  142.     {
  143.         WeaponData[playerid][w][0] = 0;
  144.         WeaponData[playerid][w][1] = 0;
  145.     }
  146.     Money[playerid] = 0;
  147.     NR_CheckCount[playerid] = 0;
  148.     UpdateCount[playerid] = 0;
  149.     //--------------------------------------------------------------------------
  150.     //Si existe 'ZVACCb_OnPlayerDisconnect' se llama.
  151.     if(Cb_OPD)
  152.     {
  153.         return CallLocalFunction("ZVACCb_OnPlayerDisconnect", "ii", playerid, reason);
  154.     }
  155.     //--------------------------------------------------------------------------
  156.     return 1;
  157. }
  158. //Renombrar el siguiente OnPlayerDisconnect
  159. #if defined _ALS_OnPlayerDisconnect
  160.     #undef OnPlayerDisconnect
  161. #else
  162.     #define _ALS_OnPlayerDisconnect
  163. #endif
  164. #define OnPlayerDisconnect ZVACCb_OnPlayerDisconnect
  165. //Forward el siguiente
  166. forward ZVACCb_OnPlayerDisconnect(playerid, reason);
  167.  
  168. public OnPlayerSpawn(playerid)
  169. {
  170.     //Reset Variables:
  171.     Health[playerid] = 100.0;
  172.     NR_CheckCount[playerid] = 0;
  173.     UpdateCount[playerid] = 0;
  174.     //--------------------------------------------------------------------------
  175.     //Si existe 'ZVACCb_OnPlayerSpawn' se llama.
  176.     if(Cb_OPS)
  177.     {
  178.         return CallLocalFunction("ZVACCb_OnPlayerSpawn", "i", playerid);
  179.     }
  180.     //--------------------------------------------------------------------------
  181.     return 1;
  182. }
  183. //Renombrar el siguiente OnPlayerSpawn
  184. #if defined _ALS_OnPlayerSpawn
  185.     #undef OnPlayerSpawn
  186. #else
  187.     #define _ALS_OnPlayerSpawn
  188. #endif
  189. #define OnPlayerSpawn ZVACCb_OnPlayerSpawn
  190. //Forward el siguiente
  191. forward ZVACCb_OnPlayerSpawn(playerid);
  192.  
  193. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  194. {
  195.     UpdateCount[playerid] = 0;
  196.     //--------------------------------------------------------------------------
  197.     //Si existe 'ZVACCb_OnPlayerInteriorChange' se llama.
  198.     if(Cb_OPIC)
  199.     {
  200.         return CallLocalFunction("ZVACCb_OnPlayerInteriorChange", "iii", playerid, newinteriorid, oldinteriorid);
  201.     }
  202.     //--------------------------------------------------------------------------
  203.     return 1;
  204. }
  205. //Renombrar el siguiente OnPlayerInteriorChange
  206. #if defined _ALS_OnPlayerInteriorChange
  207.     #undef OnPlayerInteriorChange
  208. #else
  209.     #define _ALS_OnPlayerInteriorChange
  210. #endif
  211. #define OnPlayerInteriorChange ZVACCb_OnPlayerInteriorChange
  212. //Forward el siguiente
  213. forward ZVACCb_OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid);
  214.  
  215. public OnPlayerPickUpPickup(playerid, pickupid)
  216. {
  217.     UpdateCount[playerid] = 0;
  218.     //--------------------------------------------------------------------------
  219.     //Si existe 'ZVACCb_OnPlayerPickUpPickup' se llama.
  220.     if(Cb_OPPUP)
  221.     {
  222.         return CallLocalFunction("ZVACCb_OnPlayerPickUpPickup", "ii", playerid, pickupid);
  223.     }
  224.     //--------------------------------------------------------------------------
  225.     return 1;
  226. }
  227. //Renombrar el siguiente OnPlayerPickUpPickup
  228. #if defined _ALS_OnPlayerPickUpPickup
  229.     #undef OnPlayerPickUpPickup
  230. #else
  231.     #define _ALS_OnPlayerPickUpPickup
  232. #endif
  233. #define OnPlayerPickUpPickup ZVACCb_OnPlayerPickUpPickup
  234. //Forward el siguiente
  235. forward ZVACCb_OnPlayerPickUpPickup(playerid);
  236.  
  237. public OnVehicleSpawn(vehicleid)
  238. {
  239.     VehicleHealth[vehicleid] = 1000.0;
  240.     //--------------------------------------------------------------------------
  241.     //Si existe 'ZVACCb_OnVehicleSpawn' se llama.
  242.     if(Cb_OVS)
  243.     {
  244.         return CallLocalFunction("ZVACCb_OnVehicleSpawn", "i", vehicleid);
  245.     }
  246.     //--------------------------------------------------------------------------
  247.     return 1;
  248. }
  249. //Renombrar el siguiente OnVehicleSpawn
  250. #if defined _ALS_OnVehicleSpawn
  251.     #undef OnVehicleSpawn
  252. #else
  253.     #define _ALS_OnVehicleSpawn
  254. #endif
  255. #define OnVehicleSpawn ZVACCb_OnVehicleSpawn
  256. //Forward el siguiente
  257. forward ZVACCb_OnVehicleSpawn(vehicleid);
  258.  
  259. public OnPlayerUpdate(playerid)
  260. {
  261.     if(IsPlayerNPC(playerid)) return 1;//NO NPCS
  262.     if(Admin_Immunity && IsPlayerAdmin(playerid)) return 1;//Sin ban para administradores
  263.     //========================= <ANTI-CHEAT> ===================================
  264.     new
  265.         Float:CurrentHealth,
  266.         Float:CurrentArmour,
  267.         InVehicle = IsPlayerInAnyVehicle(playerid),
  268.         SeatID = GetPlayerVehicleSeat(playerid),
  269.         Float:X,
  270.         Float:Y,
  271.         Float:Z,
  272.         Float:CurrentVehHealth,
  273.         Float:Speed,
  274.         Float:Distance,
  275.         CurrentWeapon,
  276.         CurrentAmmo,
  277.         SpecialAction = GetPlayerSpecialAction(playerid),
  278.         keys,
  279.         UD,
  280.         LR,
  281.         CurrentMoney,
  282.         bool:LostHealth = false,
  283.         reason[64];
  284.  
  285.     GetPlayerHealth(playerid, CurrentHealth);
  286.  
  287.     if(AC_HH)//HEALTH HACKS
  288.     {
  289.         if(AC_BAN[playerid])
  290.         {
  291.             if(UpdateCount[playerid] > 50)
  292.             {
  293.                 if(CurrentHealth > Health[playerid] && CurrentHealth - Health[playerid] >= 40.0)
  294.                 {
  295.                     if(!IsPlayerInFastFood(playerid))
  296.                     {
  297.                         format(reason, sizeof reason, "HEALTH HACKS {+%0.2f}", CurrentHealth - Health[playerid]);
  298.                         ZVAC_Ban(playerid, reason);
  299.                         return 1;
  300.                     }
  301.                 }
  302.             }
  303.         }
  304.     }
  305.  
  306.     if(CurrentHealth < Health[playerid]) LostHealth = true;//Debug No reload
  307.        
  308.     Health[playerid] = CurrentHealth;
  309.  
  310.     GetPlayerArmour(playerid, CurrentArmour);
  311.            
  312.     if(AC_AH)//ARMOUR HACKS
  313.     {
  314.         if(AC_BAN[playerid])
  315.         {
  316.             if(UpdateCount[playerid] > 50)
  317.             {
  318.                 if(CurrentArmour > Armour[playerid] && CurrentArmour - Armour[playerid] >= 40.0)
  319.                 {
  320.                     if(!IsPlayerInAmmuNation(playerid))
  321.                     {
  322.                         format(reason, sizeof reason, "ARMOUR HACKS {+%0.2f}", CurrentArmour - Armour[playerid]);
  323.                         ZVAC_Ban(playerid, reason);
  324.                         return 1;
  325.                     }
  326.                 }
  327.             }
  328.         }
  329.     }
  330.        
  331.     if(CurrentArmour < Armour[playerid]) LostHealth = true;//Debug No reload
  332.        
  333.     Armour[playerid] = CurrentArmour;
  334.  
  335.     GetPlayerPos(playerid, X, Y, Z);
  336.        
  337.     //VEHICLE HACKS
  338.     if(InVehicle)
  339.     {
  340.         new
  341.             VehicleID = GetPlayerVehicleID(playerid);
  342.  
  343.         GetVehicleHealth(VehicleID, CurrentVehHealth);
  344.  
  345.         if(AC_VHH)//VEHICLE HEALTH HACKS
  346.         {
  347.             if(AC_BAN[playerid])
  348.             {
  349.                 if(UpdateCount[playerid] > 50)
  350.                 {
  351.                     if(CurrentVehHealth > VehicleHealth[VehicleID] && CurrentVehHealth - VehicleHealth[VehicleID] >= 200.0)
  352.                     {
  353.                         if(SeatID == 0)//Sólo conductores/Only drivers
  354.                         {
  355.                             if(!IsPlayerInPayNSpray(playerid))//No en Pay N Spray
  356.                             {
  357.                                 if(!IsPlayerInModShop(playerid))//No en "ModShops"
  358.                                 {
  359.                                     format(reason, sizeof reason, "VEHICLE HEALTH HACKS {+%0.2f}", CurrentVehHealth - VehicleHealth[VehicleID]);
  360.                                     ZVAC_Ban(playerid, reason);
  361.                                     SetVehicleToRespawn(VehicleID);
  362.                                     return 1;
  363.                                 }
  364.                             }
  365.                         }
  366.                     }
  367.                 }
  368.             }
  369.         }
  370.  
  371.         VehicleHealth[VehicleID] = CurrentVehHealth;
  372.  
  373.         if(AC_VSH)//VEHICLE SPEED HACKS
  374.         {
  375.             ZVAC_GetVehicleSpeed(VehicleID, Speed);
  376.  
  377.             if(AC_BAN[playerid])
  378.             {
  379.                 if(UpdateCount[playerid] > 50)
  380.                 {
  381.                     if(Speed > 380.0)
  382.                     {
  383.                         if(Position[playerid][2] - Z < 1.5)//No caídas/Not falls
  384.                         {
  385.                             if(SeatID == 0)//Sólo conductores/Only drivers
  386.                             {
  387.                                 format(reason, sizeof reason, "VEHICLE SPEED HACKS {%0.2f KM/H}", Speed);
  388.                                 ZVAC_Ban(playerid, reason);
  389.                                 return 1;
  390.                             }
  391.                         }
  392.                     }
  393.                 }
  394.             }
  395.         }
  396.     }
  397.  
  398.     Distance = ZVAC_GetDistance(X, Y, Z, Position[playerid][0], Position[playerid][1], Position[playerid][2]);
  399.  
  400.     if(AC_AB)//AIRBREAK
  401.     {
  402.         if(AC_BAN[playerid])
  403.         {
  404.             if(UpdateCount[playerid] > 50)
  405.             {
  406.                 if(10.0 < Distance < 22.0)//es equivalente a/is equivalent to: (Distance > 10.0 && Distance < 22.0)
  407.                 {
  408.                     if(InVehicle)//IN VEHICLE
  409.                     {
  410.                         if(SeatID == 0)//Sólo conductores/Only drivers
  411.                         {
  412.                             if(Position[playerid][2] - Z < 1.5)//No caídas/Not falls
  413.                             {
  414.                                 format(reason, sizeof reason, "AIRBREAK (IN VEHICLE) {%0.2f}", Distance);
  415.                                 ZVAC_Ban(playerid, reason);
  416.                                 return 1;
  417.                             }
  418.                         }
  419.                     } else {//ON FOOT
  420.                         if(GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID)//No surfing on vehicle
  421.                         {
  422.                             format(reason, sizeof reason, "AIRBREAK (ON FOOT) {%0.2f}", Distance);
  423.                             ZVAC_Ban(playerid, reason);
  424.                             return 1;
  425.                         }
  426.                     }
  427.                 }
  428.             }
  429.         }
  430.     }
  431.    
  432.     if(AC_T)//TELEPORT
  433.     {
  434.         if(AC_BAN[playerid])
  435.         {
  436.             if(UpdateCount[playerid] > 50)
  437.             {
  438.                 if(Distance > 23.0)
  439.                 {
  440.                     format(reason, sizeof reason, "Teleport {%0.2f}", Distance);
  441.                     ZVAC_Ban(playerid, reason);
  442.                     return 1;
  443.                 }
  444.             }
  445.         }
  446.     }
  447.  
  448.     CurrentAmmo = GetPlayerAmmo(playerid);
  449.     CurrentWeapon = GetPlayerWeapon(playerid);
  450.        
  451.     if(AC_NR)//NO RELOAD
  452.     {
  453.         if(AC_BAN[playerid])
  454.         {
  455.             if(UpdateCount[playerid] > 50)
  456.             {
  457.                 GetPlayerKeys(playerid, keys, UD, LR);
  458.                 //------------------------ DEBUG ---------------------------
  459.                 new
  460.                     animlib[32],
  461.                     animname[32];
  462.                    
  463.                 GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, 32, animname, 32);
  464.                 if(!strcmp(animname, "CLIMB_", false, 6))
  465.                     NR_CheckCount[playerid] = 0;//trepar/climb (prevenir/prevent bug)
  466.                    
  467.                 if(LostHealth == true) NR_CheckCount[playerid] = 0; //Perdió salud/Lost health (fire no reload bug)
  468.                    
  469.                 if(CurrentWeapon != Weapon[playerid])
  470.                     NR_CheckCount[playerid] = 0;//Cambiar arma/Change weapon (tal vez/maybe 2-Shot)
  471.                        
  472.                 if(SpecialAction == SPECIAL_ACTION_DUCK)
  473.                     if(LR == KEY_RIGHT || LR == KEY_LEFT)
  474.                         NR_CheckCount[playerid] = 0;//prevenir/prevent bug
  475.  
  476.                 if((keys & KEY_SPRINT) == KEY_SPRINT) NR_CheckCount[playerid] = 0;//Sprint/Esprintar
  477.                    
  478.                 else if((keys & KEY_JUMP) == KEY_JUMP) NR_CheckCount[playerid] = 0;//Saltar/Jump
  479.                 else if((keys & KEY_CROUCH) == KEY_CROUCH) NR_CheckCount[playerid] = 0;//Agacharse/Duck (prevenir/prevent bug)
  480.                 //----------------------------------------------------------
  481.                 else if((keys & KEY_FIRE) == KEY_FIRE)//Disparar/Shoot
  482.                 {
  483.                     //26: Sawn-off shotgun, 33: Rifle, 34: Sniper Rifle
  484.                     if(CurrentWeapon == 26 || CurrentWeapon == 33 || CurrentWeapon == 34)
  485.                     {
  486.                         if(Ammo[playerid] == CurrentAmmo)
  487.                             NR_CheckCount[playerid]++;
  488.  
  489.                         if(GetPlayerWeaponState(playerid) == WEAPONSTATE_RELOADING)
  490.                             NR_CheckCount[playerid] = 0;
  491.  
  492.                         if(NR_CheckCount[playerid] > 45)
  493.                         {
  494.                             format(reason, sizeof reason, "NO RELOAD {%s(%d)}", WeaponNames[CurrentWeapon], CurrentWeapon);
  495.                             ZVAC_Ban(playerid, reason);
  496.                             NR_CheckCount[playerid] = 0;
  497.                             return 1;
  498.                         }
  499.                     }
  500.                 }
  501.             }
  502.         }
  503.     }
  504.  
  505.     Weapon[playerid] = CurrentWeapon;
  506.     Ammo[playerid] = CurrentAmmo;
  507.        
  508.     for(new w = 0; w < 13; w++)
  509.     {
  510.         GetPlayerWeaponData(playerid, w, CurrentWeapon, CurrentAmmo);
  511.            
  512.         if(AC_PW)//PROHIBITED WEAPON
  513.         {
  514.             if(AC_BAN[playerid])
  515.             {
  516.                 for(new pw = 0, m = sizeof Prohibited_Weapons; pw < m; pw++)
  517.                 {
  518.                     if(CurrentWeapon == Prohibited_Weapons[pw])
  519.                     {
  520.                         format(reason, sizeof reason, "PROHIBITED WEAPON {%s(%d)}", WeaponNames[CurrentWeapon], CurrentWeapon);
  521.                         ZVAC_Ban(playerid, reason);
  522.                         return 1;
  523.                     }
  524.                 }
  525.             }
  526.         }
  527.            
  528.         if(AC_SW)//SPAWN WEAPON
  529.         {
  530.             if(AC_BAN[playerid])
  531.             {
  532.                 if(!IsPlayerInAmmuNation(playerid))//No Ammu Nation
  533.                 {
  534.                     if(UpdateCount[playerid] > 50)//prevenir en/prevent in spawn
  535.                     {
  536.                         if(CurrentWeapon != WeaponData[playerid][w][0] && CurrentWeapon != 0)
  537.                         {
  538.                             format(reason, sizeof reason, "SPAWN WEAPON {%s(%d)[%d]}", WeaponNames[CurrentWeapon], CurrentWeapon, CurrentAmmo);
  539.                             ZVAC_Ban(playerid, reason);
  540.                             UpdateCount[playerid] = 0;
  541.                             return 1;
  542.                         }
  543.                     }
  544.                 }
  545.             }
  546.         }
  547.  
  548.         WeaponData[playerid][w][0] = CurrentWeapon;
  549.         WeaponData[playerid][w][1] = CurrentAmmo;
  550.     }
  551.            
  552.     Position[playerid][0] = X;
  553.     Position[playerid][1] = Y;
  554.     Position[playerid][2] = Z;
  555.  
  556.     CurrentMoney = GetPlayerMoney(playerid);
  557.                
  558.     if(AC_MH)//MONEY HACKS
  559.     {
  560.         if(AC_BAN[playerid])
  561.         {
  562.             if(UpdateCount[playerid] > 50)
  563.             {
  564.                 if(CurrentMoney > MAX_MONEY)
  565.                 {
  566.                     format(reason, sizeof reason, "MONEY HACKS (MAX MONEY) {$%d}", CurrentMoney);
  567.                     ZVAC_Ban(playerid, reason);
  568.                     return 1;
  569.                 }
  570.                 else if(CurrentMoney - Money[playerid] > MONEY_AMOUNT)
  571.                 {
  572.                     format(reason, sizeof reason, "MONEY HACKS {+$%d}", CurrentMoney - Money[playerid]);
  573.                     ZVAC_Ban(playerid, reason);
  574.                     return 1;
  575.                 }
  576.             }
  577.         }
  578.     }
  579.            
  580.     Money[playerid] = CurrentMoney;
  581.            
  582.     if(AC_JP)//JETPACK
  583.     {
  584.         if(AC_BAN[playerid])
  585.         {
  586.             if(SpecialAction == SPECIAL_ACTION_USEJETPACK)
  587.             {
  588.                 ZVAC_Ban(playerid, "JETPACK");
  589.                 return 1;
  590.             }
  591.         }
  592.     }
  593.            
  594.     UpdateCount[playerid]++;
  595.     if(UpdateCount[playerid] > 100) UpdateCount[playerid] = 50;
  596.     //==========================================================================
  597.     //--------------------------------------------------------------------------
  598.     //Si existe 'ZVACCb_OnPlayerUpdate' se llama.
  599.     if(Cb_OPU)
  600.     {
  601.         return CallLocalFunction("ZVACCb_OnPlayerUpdate", "i", playerid);
  602.     }
  603.     //--------------------------------------------------------------------------
  604.     return 1;
  605. }
  606. //Renombrar el siguiente OnPlayerUpdate
  607. #if defined _ALS_OnPlayerUpdate
  608.     #undef OnPlayerUpdate
  609. #else
  610.     #define _ALS_OnPlayerUpdate
  611. #endif
  612. #define OnPlayerUpdate ZVACCb_OnPlayerUpdate
  613. //Forward el siguiente
  614. forward ZVACCb_OnPlayerUpdate(playerid);
  615.  
  616. //SPA: Rinicializar UpdateCount de un jugador en específico.
  617. //ENG: Reset UpdateCount for a specific player.
  618. forward ZVAC_ResetUC(playerid);
  619. public ZVAC_ResetUC(playerid)
  620. {
  621.     if(IsPlayerConnected(playerid)) UpdateCount[playerid] = 0;
  622. }
  623.  
  624. //SPA: Activar/Desactivar BAN para un jugador en específico.
  625. //ENG: Activate/Desactivate BAN for a specific player.
  626. forward ZVAC_BAN_Activate(playerid, activate);
  627. public ZVAC_BAN_Activate(playerid, activate)
  628. {
  629.     if(IsPlayerConnected(playerid))
  630.     {
  631.         if(activate == 0) AC_BAN[playerid] = false;
  632.         else if (activate == 1) AC_BAN[playerid] = true;
  633.     }
  634. }
  635.  
  636. stock ZVAC_Ban(playerid, const reason[])
  637. {
  638.     new
  639.         string[128],
  640.         Nick[MAX_PLAYER_NAME];
  641.        
  642.     GetPlayerName(playerid, Nick, MAX_PLAYER_NAME);
  643.     format(string, sizeof string, "> %s(%d) ha sido %s por el Anti-Cheat", Nick, playerid, BAN ? ("baneado") : ("expulsado"));
  644.     SendClientMessageToAll(0xFF0000FF, string);
  645.     printf("%s, razón: %s.", string, reason);
  646.     if(BAN) BanEx(playerid, reason); else Kick(playerid);
  647. }
  648.  
  649. forward Float:ZVAC_GetDistance(Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2);
  650. stock Float:ZVAC_GetDistance(Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2)
  651. {
  652.     return floatsqroot(floatpower(X1 - X2, 2) + floatpower(Y1 - Y2, 2) + floatpower(Z1 - Z2, 2));
  653. }
  654.  
  655. stock ZVAC_GetVehicleSpeed(vehicleid, &Float:Speed)
  656. {
  657.     new
  658.         Float:X,
  659.         Float:Y,
  660.         Float:Z;
  661.  
  662.     GetVehicleVelocity(vehicleid, X, Y, Z);
  663.     Speed = floatsqroot(X * X + Y * Y + Z * Z) * 175;
  664. }
  665.  
  666. stock IsPlayerInAmmuNation(playerid)
  667. {
  668.     new
  669.         Interior = GetPlayerInterior(playerid);
  670.  
  671.     if(Interior == 1 || Interior == 4 || Interior == 6 || Interior == 7) return 1;
  672.     return 0;
  673. }
  674.  
  675. stock IsPlayerInModShop(playerid)
  676. {
  677.     new
  678.         Interior = GetPlayerInterior(playerid);
  679.    
  680.     if(Interior == 1 || Interior == 2 || Interior == 3) return 1;
  681.     return 0;
  682. }
  683.  
  684. stock IsPlayerInFastFood(playerid)
  685. {
  686.     new
  687.         Interior = GetPlayerInterior(playerid);
  688.  
  689.     if(Interior == 10 || Interior == 9 || Interior == 5) return 1;
  690.     return 0;
  691. }
  692.  
  693. stock IsPlayerInPayNSpray(playerid)
  694. {
  695.     if(IsPlayerInRangeOfPoint(playerid, 15.0, 1976.6804, 2162.9897, 11.0703)
  696.     || IsPlayerInRangeOfPoint(playerid, 15.0, -99.8578,1119.0826, 19.7417)
  697.     || IsPlayerInRangeOfPoint(playerid, 15.0, -1420.6003, 2583.0466, 55.8433)
  698.     || IsPlayerInRangeOfPoint(playerid, 15.0, 720.2489, -455.9286, 16.3359)
  699.     || IsPlayerInRangeOfPoint(playerid, 15.0, 1024.7795, -1023.6094, 32.1016)
  700.     || IsPlayerInRangeOfPoint(playerid, 15.0, 2065.1787, -1831.6390, 13.5469)
  701.     || IsPlayerInRangeOfPoint(playerid, 15.0, -1904.2811, 284.9177, 41.0469)
  702.     || IsPlayerInRangeOfPoint(playerid, 15.0, -2425.2358, 1020.6820, 50.3977)
  703.     || IsPlayerInRangeOfPoint(playerid, 15.0, 487.4328, -1740.1508, 11.1375))
  704.     {
  705.         return 1;
  706.     }
  707.     return 0;
  708. }
  709.  
  710. /*----------------------------------- FIN ------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement