Advertisement
Paulo_AttacK

pbAntiCheater v1.1

Oct 19th, 2012
684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 37.75 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //
  4. //        #### ########   ######     ######## ########    ###    ##     ##
  5. //         ##  ##     ## ##    ##       ##    ##         ## ##   ###   ###
  6. //         ##  ##     ## ##             ##    ##        ##   ##  #### ####
  7. //         ##  ########   ######        ##    ######   ##     ## ## ### ##
  8. //         ##  ##              ##       ##    ##       ######### ##     ##
  9. //         ##  ##        ##    ##       ##    ##       ##     ## ##     ##
  10. //        #### ##         ######        ##    ######## ##     ## ##     ##
  11. //
  12. //
  13. //          Por Bruno da Silva (iPs DraKiNs) e  Paulo (iPs Paulo)
  14. //
  15. //          Acesse meu blog sobre programação www.brunodasilva.com.br
  16. //
  17. //          --------------------------------------------
  18. //
  19. //          Detectar:
  20. //              Bot,
  21. //              Death Flood,
  22. //              Surf Vehicle,
  23. //              Car Teleport,
  24. //              State Hack,
  25. //              No-Reload,
  26. //              Weapon Hack,
  27. //              Ammo Hack,
  28. //              Freeze Hack,
  29. //              Score Hack,
  30. //              Money Hack,
  31. //              Health Hack,
  32. //              Armour Hack,
  33. //              Publish Text,
  34. //              Offend Text,
  35. //              Flood Text,
  36. //              Teleport Hack,
  37. //              Air Break,
  38. //              Player Bugger,
  39. //              High Ping,
  40. //              Spider Hack,
  41. //              CP Race Hack,
  42. //              Speed Hack,
  43. //              Player Speed Hack,
  44. //              Fly Hack
  45. //
  46. //          --------------------------------------------
  47. //
  48. //                  www.brunodasilva.com.br
  49. //
  50. //                  Ingresse também na [iPs]TeaM
  51. //                  wwww.ips-team.forumeiros.com
  52. //
  53. //////////////////////////////////////////////////////////////////////////////////
  54.  
  55. enum {
  56.     // Anti DDos Bots
  57.     PLAYER_BOT_LEVEL3,
  58.     PLAYER_BOT_LEVEL2,
  59.     PLAYER_BOT_LEVEL1,
  60.  
  61.     // Anti Cleo4 Fake-kill
  62.     PLAYER_DEATHFLOOD_LEVEL3,
  63.     PLAYER_DEATHFLOOD_LEVEL2,
  64.     PLAYER_DEATHFLOOD_LEVEL1,
  65.  
  66.     // Anti Bug Cars
  67.     PLAYER_SURF_VEHICLE,
  68.     PLAYER_CAR_TELEPORT,
  69.     PLAYER_STATE_HACK,
  70.  
  71.     // Ammo Weapon
  72.     PLAYER_NORELOAD_HACK,
  73.     PLAYER_WEAPON_HACK,
  74.     PLAYER_AMMO_HACK,
  75.  
  76.  
  77.     // hackings
  78.     PLAYER_FREEZE_HACK,
  79.     PLAYER_SCORE_HACK,
  80.     PLAYER_MONEY_HACK,
  81.     PLAYER_HEALTH_HACK,
  82.     PLAYER_ARMOUR_HACK,
  83.  
  84.     // Text Chat
  85.     PLAYER_PUBLISH_TEXT,
  86.     PLAYER_OFFEND_TEXT,
  87.     PLAYER_FLOOD_TEXT,
  88.  
  89.     // pos cheat
  90.     PLAYER_TELEPORT_HACK,
  91.     PLAYER_AIRBREAK_HACK,
  92.     PLAYER_BUGGER_HACK,
  93.  
  94.     // outros
  95.     PLAYER_HIGH_PING,
  96.     PLAYER_SPIDER_HACK,
  97.     PLAYER_CPRACE_HACK,
  98.     PLAYER_SPEED_HACK,
  99.     PLAYER_PSPEED_HACK,
  100.     PLAYER_FLY_HACK
  101. }
  102.  
  103.  
  104. new Float: vPos_pB[4],
  105.     dbIP_pB[MAX_PLAYERS][20],
  106.     Float: dAngle_pB[MAX_VEHICLES],
  107.     vVelocity_pB[MAX_VEHICLES],
  108.     bool: vRespawn_pB[MAX_VEHICLES],
  109.     bool: OPC_pB,
  110.     bool: OPS_pB,
  111.     bool: OPDI_pB,
  112.     bool: OPT_pB,
  113.     bool: OPD_pB,
  114.     bool: OVM_pB,
  115.     bool: OPERCP_pB,
  116.     bool: OPU_pB,
  117.     bool: OPSC_pB,
  118.     bool: OUVU_pB;
  119.  
  120. forward OnPlayerHacking(playerid, hackid);
  121.  
  122. #define INVALID_CHAT_BLOCK
  123. #define SERVER_SIDE_DELAY   (0002)
  124. #define MAX_DISTANCE_DEF    (83.1)
  125. #define MAX_PING            (0800)
  126.  
  127. //Usar somente AntiCheater's determinados
  128.  
  129. #if !defined @FE_OnPlayerEnterVehicle
  130.     #define @FE_OnPlayerEnterVehicle        true //Atere para 'false' para desativar a edição sobre a função.
  131. #endif
  132.  
  133.  
  134. // =============================================================================
  135. //
  136. // OBSERVAÇõES IMPORTANTES:
  137.  
  138. // #define INVALID_CHAT_BLOCK
  139. // Em caso de não quiser bloquear o texto em caso de texto inválido
  140. // Texto inválido, spam, flood, palavreado, ofensa, publicação. etc
  141.  
  142. // Ping acima de 1 segundo (1000 ms) poderá ocorrer graves problemas de precisão no anti cheater.
  143. // Em caso de ping muito elevado aconselha-se o uso de SERVER_SIDE_DELAY elevado para maior precisão
  144.  
  145. // SERVER_SIDE_DELAY equivale ao tempo de delay entre o uso de uma função registrada
  146. // que influencia no detectamento do anti cheater. Aconselhável 1 a 5 segundos.
  147. // Dependendo da conexão do servidor você coloca maior delay ou menor dealay
  148.  
  149. // MAX_DISTANCE_DEF é essencial para busca e detecção de anti-teleport e air break
  150. // O número padrão foi calculado e não houve bugs por parte do sistema
  151. // A única coisa que pode influenciar será o sistema de SetPlayerPos. Mas o SERVER_SIDE_DELAY supriu isto com precisão
  152.  
  153. // Este sistema apenas detecta cheaters. É aconselhavél a checagem de um administrador real antes de aplicar o banimento.
  154.  
  155. // ========================================================================================================
  156.  
  157. #define pFunction%0(%1) %0(%1); public%0(%1)
  158. #define Hook%0(%1)  stock%0_pB(%1)
  159.  
  160. // ---------------------------------------------
  161. //  Nesta parte aparecem funções hookeadas
  162. //  Elas são essenciais para ter controle server-side detalhado
  163. //  Essencial para qualquer anti-hack. Controle minucioso
  164. //  Para o funcionamento disto precisa do filterscript
  165. //  Hookei apenas as mais importantes callbacks nativas da sa:mp.
  166. //  Daria muito trabalho "hookear" todas
  167. // ---------------------------------------------
  168.  
  169.  
  170. Hook GivePlayerMoney(playerid, value) {
  171.     return SetPVarInt(playerid, "rMoney_pB", (GetPVarInt(playerid, "rMoney_pB") + value)), GivePlayerMoney(playerid, value);
  172. }
  173.  
  174. Hook ResetPlayerMoney(playerid) {
  175.     return SetPVarInt(playerid, "rMoney_pB", 0), ResetPlayerMoney(playerid);
  176. }
  177.  
  178. Hook SetPlayerScore(playerid, value){
  179.     return SetPVarInt(playerid, "rScore_pB", value), SetPlayerScore(playerid, value);
  180. }
  181.  
  182. Hook PutPlayerInVehicle(playerid,vehicleid, seatid) {
  183.     return SetPVarInt(playerid, "rState_pB", (gettime() - SERVER_SIDE_DELAY)), PutPlayerInVehicle(playerid, vehicleid, seatid);
  184. }
  185.  
  186. Hook SetVehicleVelocity(vehicleid, Float: fX_pB, Float: fY_pB, Float: fZ_pB) {
  187.     return vVelocity_pB[vehicleid] = gettime(), SetVehicleVelocity(vehicleid, fX_pB, fY_pB, fZ_pB);
  188. }
  189.  
  190. Hook SetVehiclePos(vehicleid, Float: fX_pB, Float: fY_pB, Float: fZ_pB) {
  191.     for(new i_pB = (GetMaxPlayers() - 1); i_pB > -1;  --i_pB) {
  192.         if(GetPlayerVehicleID(i_pB) == vehicleid) {
  193.             SetPVarInt(i_pB, "tPosSet_pB", gettime());
  194.             break;
  195.         }
  196.     }
  197.     return SetVehiclePos(vehicleid, fX_pB, fY_pB, fZ_pB);
  198. }
  199.  
  200. Hook SetPlayerPos(playerid, Float: fX_pB, Float: fY_pB, Float: fZ_pB) {
  201.     return SetPVarInt(playerid, "tPosSet_pB", gettime()), SetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  202. }
  203.  
  204. Hook GivePlayerWeapon(playerid, weaponid, ammo) {
  205.     return SetPVarInt(playerid, getSlotID_pB(getWeaponSlot_pB(weaponid)), weaponid), SetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(weaponid)), ammo), GivePlayerWeapon(playerid, weaponid, ammo);
  206. }
  207.  
  208. Hook ResetPlayerWeapons(playerid) {
  209.     for(new i_pB; i_pB != 13; ++i_pB) SetPVarInt(playerid, getSlotID_pB(i_pB), 0);
  210.     return ResetPlayerWeapons(playerid);
  211. }
  212.  
  213. Hook TogglePlayerC(playerid, {bool, _}: c_pB) {
  214.     if(c_pB) {
  215.         static Float: fX_pB, Float: fY_pB, Float: fZ_pB;
  216.  
  217.         GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  218.         SetPVarFloat(playerid, "xPosControll_pB", fX_pB),
  219.         SetPVarFloat(playerid, "yPosControll_pB", fY_pB),
  220.         SetPVarFloat(playerid, "zPosControll_pB", fZ_pB);
  221.     } else {
  222.         SetPVarFloat(playerid, "xPosControll_pB", 0.0);
  223.         SetPVarFloat(playerid, "yPosControll_pB", 0.0);
  224.         SetPVarFloat(playerid, "zPosControll_pB", 0.0);
  225.     }
  226.     TogglePlayerControllable(playerid, c_pB);
  227.     return SetPVarInt(playerid, "PlayerControllable_pB_pB", _:!c_pB);
  228. }
  229.  
  230. Hook SetPlayerHealth(playerid, Float: h_pB) {
  231.     return SetPVarFloat(playerid, "Health_pB", h_pB), SetPlayerHealth(playerid, h_pB);
  232. }
  233.  
  234. Hook SetPlayerArmour(playerid, Float: a_pB) {
  235.     return SetPVarFloat(playerid, "Armour_pB", a_pB), SetPlayerArmour(playerid, a_pB);
  236. }
  237.  
  238. Hook SetVehicleToRespawn(vehicleid) {
  239.     return vRespawn_pB[vehicleid] = true, SetVehicleToRespawn(vehicleid);
  240. }
  241.  
  242. isPlayerAiming_pB(playerid) {
  243.     new Anim_pB = GetPlayerAnimationIndex(playerid);
  244.     if(((Anim_pB >= 1160) && (Anim_pB <= 1163)) || (Anim_pB == 1167) || (Anim_pB == 1365) || (Anim_pB == 1643) || (Anim_pB == 1453) || (Anim_pB == 220)) return 1;
  245.     return 0;
  246. }
  247.  
  248. isPlayerInWater_pB(playerid) { //Coords By Synchro
  249.     static Float: fX_pB, Float: fY_pB, Float: fZ_pB;
  250.     GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  251.     if((fX_pB >= 2044.6 && fX_pB <= 2192.984 && fY_pB >= 1206.358 && fY_pB <= 1376.552) && fZ_pB < 0xA) return 1;
  252.     else if((fX_pB >= 2048.504 && fX_pB <= 2185.174 && fY_pB >= 1063.239 && fY_pB <= 1202.49) && fZ_pB < 0xA) return 1;
  253.     else if((fX_pB >= 2204.698 && fX_pB <= 2204.698 && fY_pB >= 1426.837 && fY_pB <= 1430.705) && fZ_pB < 0xA) return 1;
  254.     else if((fX_pB >= 2032.885 && fX_pB <= 2114.887 && fY_pB >= 1852.325 && fY_pB <= 1991.575) && fZ_pB < 0xC) return 1;
  255.     else if((fX_pB >= 2517.086 && fX_pB <= 2606.897 && fY_pB >= 2316.493 && fY_pB <= 2420.93) && fZ_pB < 0x16) return 1;
  256.     else if((fX_pB >= 2554.5996 && fX_pB <= 2507.7683 && fY_pB >= 1548.6178 && fY_pB <= 1588.9154) && fZ_pB < 0xF) return 1;
  257.     else if((fX_pB >= -2043.628 && fX_pB <= -1973.561 && fY_pB >= -980.9415 && fY_pB <= -724.0283) && fZ_pB < 0x20) return 1;
  258.     else if((fX_pB >= -2753.912 && fX_pB <= -2665.071 && fY_pB >= -522.3632 && fY_pB <= -380.3444) && fZ_pB < 0x05) return 1;
  259.     else if((fX_pB >= 1219.864 && fX_pB <= 1292.118 && fY_pB >= -2435.881 && fY_pB <= -2325.344) && fZ_pB < 0xF) return 1;
  260.     else if((fX_pB >= 1923.388 && fX_pB <= 2010.854 && fY_pB >= -1223.924 && fY_pB <= -1168.656) && fZ_pB < 0x16) return 1;
  261.     else if((fX_pB >= 1269.301 && fX_pB <= 1314.935 && fY_pB >= -837.0452 && fY_pB <= -781.7769) && fZ_pB < 0x5A) return 1;
  262.     else if((fX_pB >= 1087.3953 && fX_pB <= 1102.3138 && fY_pB >= -682.6734 && fY_pB <= -663.0043) && fZ_pB < 0x71) return 1;
  263.     else if((fX_pB >= 1268.6118 && fX_pB <= 1291.8774 && fY_pB >= -784.2910 && fY_pB <= -764.6104) && fZ_pB < 0x43D) return 1;
  264.     else if(fZ_pB < 0xF) return 1;
  265.     return 0;
  266. }
  267.  
  268. isPlayerUsingSwimAnim_pB(playerid) { // By Synchro
  269.     if(IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 0;
  270.     static aLib_pB[32], aName_pB[32];
  271.     GetAnimationName(GetPlayerAnimationIndex(playerid), aLib_pB, 32, aName_pB, 32);
  272.     if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_GLIDE", true)) return 1;
  273.     else if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_BREAST", true)) return 1;
  274.     else if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_CRAWL", true)) return 1;
  275.     else if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_DIVE_UNDER", true)) return 1;
  276.     else if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_DIVE_GLIDE", true)) return 1;
  277.     else if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_UNDER", true)) return 1;
  278.     else if(!strcmp(aLib_pB, "SWIM", true) && !strcmp(aName_pB, "SWIM_TREAD", true)) return 1;
  279.     return 0;
  280. }
  281.  
  282. getSlotID_pB(i) { // Paulor
  283.     static sSlot_pB[12];
  284.     return format(sSlot_pB, 12, "wHSlot%i", i), sSlot_pB;
  285. }
  286.  
  287. getSlotAmmoID_pB(i) { // Paulor
  288.     static sSlot_pB[12];
  289.     return format(sSlot_pB, 12, "AmmoSlot%i", i), sSlot_pB;
  290. }
  291.  
  292. getWeaponSlot_pB(w_pB) { // Paulor
  293.     if(w_pB >= 0 && w_pB < 2) return 0;
  294.     else if(w_pB > 1 && w_pB < 10) return 1;
  295.     else if(w_pB > 21 && w_pB < 25) return 2;
  296.     else if(w_pB > 24 && w_pB < 28) return 3;
  297.     else if(w_pB > 27 && w_pB < 30 || w_pB == 32) return 4;
  298.     else if(w_pB > 29 && w_pB < 32) return 5;
  299.     else if(w_pB > 32 && w_pB < 35) return 6;
  300.     else if(w_pB > 34 && w_pB < 39) return 7;
  301.     else if(w_pB > 15 && w_pB < 19 || w_pB == 39) return 8;
  302.     else if(w_pB > 40 && w_pB < 44) return 9;
  303.     else if(w_pB > 9 && w_pB < 16) return 10;
  304.     else if(w_pB > 43 && w_pB < 47) return 11;
  305.     else if(w_pB == 40) return 12;
  306.     return -1;
  307. }
  308.  
  309. getPlayerSpeed_pB(playerid) {
  310.     static Float: ST[3];
  311.     GetVehicleVelocity(GetPlayerVehicleID(playerid), ST[0], ST[1], ST[2]);
  312.     return floatround(floatmul(floatsqroot(floatadd(floatpower(ST[0], 2), floatpower(ST[1], 2))), 170.0));
  313. }
  314.  
  315. #if !defined varGet
  316. #define varGet(%0)  getproperty(0,%0)
  317. #endif
  318.  
  319. #if !defined varSet
  320. #define varSet(%0,%1) setproperty(0, %0, %1)
  321. #endif
  322.  
  323. public OnGameModeInit() {
  324.     OPC_pB = funcidx("OnPlayerConnect_pB") != -1;
  325.     OPS_pB = funcidx("OnPlayerSpawn_pB") != -1;
  326.     OPDI_pB = funcidx("OnPlayerDisconnect_pB") != -1;
  327.     OPT_pB = funcidx("OnPlayerText_pB") != -1;
  328.     OPD_pB = funcidx("OnPlayerDeath_pB") != -1;
  329.     OVM_pB = funcidx("OnVehicleMod_pB") != -1;
  330.     OPERCP_pB = funcidx("OnPlayerEnterRaceCP_pB") != -1;
  331.     OPU_pB = funcidx("OnPlayerUpdate_pB") != -1;
  332.     OPSC_pB = funcidx("OnPlayerStateChange_pB") != -1;
  333.     OUVU_pB = funcidx("OnUnoccupiedVehicleUpdate_pB") != -1;
  334.     return CallLocalFunction("OnGameModeInit_pB", #);
  335. }
  336.  
  337. #if defined _ALS_OnGameModeInit
  338.     #undef OnGameModeInit
  339. #else
  340.     #define _ALS_OnGameModeInit
  341. #endif
  342.  
  343. #define OnGameModeInit OnGameModeInit_pB
  344. forward OnGameModeInit_pB();
  345.  
  346. public OnPlayerConnect(playerid) {
  347.     CallLocalFunction("rJogador_pB", "i", playerid);
  348.     return (OPC_pB ? CallLocalFunction("OnPlayerConnect_pB", "i", playerid) : 1);
  349. }
  350.  
  351. #if defined _ALS_OnPlayerConnect
  352.     #undef OnPlayerConnect
  353. #else
  354.     #define _ALS_OnPlayerConnect
  355. #endif
  356.  
  357. #define OnPlayerConnect OnPlayerConnect_pB
  358. forward OnPlayerConnect_pB(playerid);
  359.  
  360. public OnPlayerSpawn(playerid) {
  361.     if(!GetPVarInt(playerid, "Spawned_pB")) SetPVarInt(playerid, "Spawned_pB", true);
  362.     SetPVarFloat(playerid, "Health_pB", 100.0);
  363.     SetPVarFloat(playerid, "Armour_pB", 0.0);
  364.     SetPlayerHealth(playerid, 100.0);
  365.     SetPlayerArmour(playerid, 0.0);
  366.     return (OPS_pB ? CallLocalFunction("OnPlayerSpawn_pB", "i", playerid) : 1);
  367. }
  368.  
  369. #if defined _ALS_OnPlayerSpawn
  370.     #undef OnPlayerSpawn
  371. #else
  372.     #define _ALS_OnPlayerSpawn
  373. #endif
  374.  
  375. #define OnPlayerSpawn OnPlayerSpawn_pB
  376. forward OnPlayerSpawn_pB(playerid);
  377.  
  378. public OnPlayerDisconnect(playerid, reason) {
  379.     // Não retire está parte. Isto serve para não enviar mensagens de desconecção quando o player é bot ddos
  380.     if(GetPVarInt(playerid, "jOn_pB")) return false;
  381.     return (OPDI_pB ? CallLocalFunction("OnPlayerDisconnect_pB", "is", playerid, reason) : 1);
  382. }
  383.  
  384. #if defined _ALS_OnPlayerDisconnect
  385.     #undef OnPlayerDisconnect
  386. #else
  387.     #define _ALS_OnPlayerDisconnect
  388. #endif
  389.  
  390. #define OnPlayerDisconnect OnPlayerDisconnect_pB
  391. forward OnPlayerDisconnect_pB(playerid, reason);
  392.  
  393. new const palavreado[][24] = {
  394.     "daputa", "babaca", "baitola", "piranha", "bicha", "bichona", "biscat", "bitch", "bix", "boiola", "boiolona", "buceta", "bucetudo", "cuzona", "bund", "burr", "fude", "cacet", "viad",
  395.     "caral", "vadi", "carai", "rola", "chup", "idiot", "corno", "nocu", "eucu", "ocu", "cusa", "cusi", "cuza", "cuzinho", "piroca", "embecil", "fdp", "foda", "fode", "fuck", "fud",
  396.     "hetard", "homo", "imbess", "jegu", "kacet", "karai", "karaleo", "kct", "kral", "krl", "noku", "lasarent", "lazarent", "mula", "otari", "pnc", "pereb", "penis", "pint", "prosti",
  397.     "punhet", "put", "retardado", "tnc", "viad", "viadi", "vsf", "vtnc", "sobe", "vogelz", "baranga", "vagab", "broxa", "ignorant", "comed", "ejacu", "prosti", "cachorr", "surub", "peni",
  398.     "chup", "pau", "viad", "perere", "bucet", "bicha", "bixa", "gay", "desgra", "troxa", "tomanocu", "seucu"
  399. };
  400.  
  401. public OnPlayerText(playerid, text[]) {
  402.  
  403.     /*--------------------------------------------------
  404.     *
  405.     *  Anti Publicação de IP Inteligente
  406.     *   Usando OnPlayerText com manipulação de strings e outros
  407.     *   A precisão deste sistema está em torno de 95%
  408.     *
  409.     * Detecta: 127.0.0.1 | 1 2    7 .   0  0 1 etc
  410.     -------------------------------------------------*/
  411.  
  412.     static sText_pB[128], bText_pB[128], nChat_pB, pChat_pB, j;
  413.     nChat_pB = -1, pChat_pB = -1, j = 0, sText_pB = bText_pB;
  414.  
  415.     for(new i_pB; text[i_pB]; ++i_pB) {
  416.         if(text[i_pB] >= '0' && '9' >= text[i_pB] || (text[i_pB] == '.' || text[i_pB] == ':')) {
  417.             if(text[i_pB] == '.' || text[i_pB] == ':') pChat_pB++;
  418.             else nChat_pB++;
  419.             if(nChat_pB >= 8 && pChat_pB >= 3) {
  420.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_PUBLISH_TEXT);
  421.                 #if defined INVALID_CHAT_BLOCK
  422.                     return false;
  423.                 #else
  424.                     break;
  425.                 #endif
  426.             }
  427.         }
  428.  
  429.         switch(text[i_pB]) {
  430.             case '0': { sText_pB[j] = 'o'; j++; continue; }
  431.             case '1': { sText_pB[j] = 'i'; j++; continue; }
  432.             case '2': { sText_pB[j] = 'z'; j++; continue; }
  433.             case '3': { sText_pB[j] = 'e'; j++; continue; }
  434.             case '4': { sText_pB[j] = 'a'; j++; continue; }
  435.             case '5': { sText_pB[j] = 's'; j++; continue; }
  436.             case '6': { sText_pB[j] = 'g'; j++; continue; }
  437.             case '7': { sText_pB[j] = 't'; j++; continue; }
  438.             case '8': { sText_pB[j] = 'b'; j++; continue; }
  439.             case 65 .. 90, 97 .. 122: { sText_pB[j++] = tolower(text[i_pB]); continue; }
  440.         }
  441.     }
  442.  
  443.     /*--------------------------------------------------
  444.     *
  445.     *  Anti Palavreado Inteligente
  446.     *   Usando OnPlayerText com manipulação de strings e outros
  447.     *   A precisão deste sistema está em torno de 85%
  448.     *
  449.     * Detecta: buceta, b - u c |e t-a, buc 3 7 4 etc
  450.     -------------------------------------------------*/
  451.  
  452.     for(new i_pB ; i_pB != sizeof(palavreado); ++i_pB) {
  453.         if(strfind(sText_pB, palavreado[i_pB], false) != -1) {
  454.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_OFFEND_TEXT);
  455.  
  456.             #if defined INVALID_CHAT_BLOCK
  457.                 return false;
  458.             #else
  459.                 break;
  460.             #endif
  461.         }
  462.     }
  463.  
  464.     /*--------------------------------------------------
  465.     *
  466.     *  Anti Flood
  467.     *   Usando OnPlayerText com gettime e outros
  468.     *   A precisão deste sistema está em torno de 95%
  469.     *
  470.     -------------------------------------------------*/
  471.  
  472.     if((gettime() - GetPVarInt(playerid, "fChat_pB")) < 3) {
  473.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FLOOD_TEXT);
  474.         #if defined INVALID_CHAT_BLOCK
  475.             return false;
  476.         #endif
  477.     }
  478.  
  479.     SetPVarInt(playerid, "fChat_pB", gettime());
  480.     return (OPT_pB ? CallLocalFunction("OnPlayerText_pB", "is", playerid, text) : 1);
  481. }
  482.  
  483. #if defined _ALS_OnPlayerText
  484.     #undef OnPlayerText
  485. #else
  486.     #define _ALS_OnPlayerText
  487. #endif
  488.  
  489. #define OnPlayerText OnPlayerText_pB
  490. forward OnPlayerText_pB(playerid, text[]);
  491.  
  492. public OnPlayerDeath(playerid, killerid, reason) {
  493.  
  494.     /*--------------------------------------------------
  495.     *
  496.     *  Anti Fake Kill
  497.     *   Usando OnPlayerDeath com gettime e outros
  498.     *   A precisão deste sistema está dividido em partes
  499.     *
  500.     *  PLAYER_DEATHFLOOD_LEVEL1 -> 070%
  501.     *  PLAYER_DEATHFLOOD_LEVEL2 -> 090%
  502.     *  PLAYER_DEATHFLOOD_LEVEL3 -> 100%
  503.     *
  504.     *
  505.     -------------------------------------------------*/
  506.  
  507.     if(gettime() - GetPVarInt(playerid, "rDeath_pB") < 20) {
  508.         if(GetPVarInt(playerid, "rValDeath_pB") > 15) {
  509.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL1);
  510.         }
  511.         if(gettime() - GetPVarInt(playerid, "rDeath_pB") < 2) {
  512.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL2);
  513.         }
  514.         if(gettime() - GetPVarInt(playerid, "rDeath_pB") < 5) {
  515.             if(GetPVarInt(playerid, "rValDeath_pB") > 3) {
  516.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL3);
  517.             }
  518.         }
  519.     }
  520.     SetPVarInt(playerid, "rDeath_pB", gettime());
  521.     SetPVarInt(playerid, "rValDeath_pB", (GetPVarInt(playerid, "rValDeath_pB") + 1));
  522.  
  523.     return (OPD_pB ? CallLocalFunction("OnPlayerDeath_pB", "i", playerid) : 1);
  524. }
  525.  
  526. #if defined _ALS_OnPlayerDeath
  527.     #undef OnPlayerDeath
  528. #else
  529.     #define _ALS_OnPlayerDeath
  530. #endif
  531.  
  532. #define OnPlayerDeath OnPlayerDeath_pB
  533. forward OnPlayerDeath_pB(playerid, killerid, reason);
  534.  
  535. public OnVehicleMod(playerid, vehicleid, componentid) {
  536.     if(!GetPlayerInterior(playerid)) {
  537.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CPRACE_HACK);
  538.     }
  539.     return (OVM_pB ? CallLocalFunction("OnVehicleMod_pB", "ddd", playerid, vehicleid, componentid) : 1);
  540. }
  541.  
  542. #if defined _ALS_OnVehicleMod
  543.     #undef OnVehicleMod
  544. #else
  545.     #define _ALS_OnVehicleMod
  546. #endif
  547.  
  548. #define OnVehicleMod OnVehicleMod_pB
  549. forward OnVehicleMod_pB(playerid,vehicleid,componentid);
  550.  
  551. public OnPlayerEnterRaceCheckpoint(playerid) {
  552.     if(IsPlayerInAnyVehicle(playerid)) {
  553.         if(!getPlayerSpeed_pB(playerid)) {
  554.             if(GetPVarInt(playerid, "cHack_pB") > 3) {
  555.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CPRACE_HACK);
  556.                 SetPVarInt(playerid, "cHack_pB", 0);
  557.             }
  558.             SetPVarInt(playerid, "cHack_pB", (GetPVarInt(playerid, "cHack_pB") + 1));
  559.         }
  560.     }
  561.     return (OPERCP_pB ? CallLocalFunction("OnPlayerEnterRaceCP_pB", "i", playerid) : 1);
  562. }
  563.  
  564. #if defined _ALS_OnPlayerEnterRaceCP
  565.     #undef OnPlayerEnterRaceCheckpoint
  566. #else
  567.     #define _ALS_OnPlayerEnterRaceCP
  568. #endif
  569.  
  570. #define OnPlayerEnterRaceCheckpoint OnPlayerEnterRaceCP_pB
  571. forward OnPlayerEnterRaceCP_pB(playerid);
  572.  
  573. public OnPlayerUpdate(playerid) {
  574.     if(!IsPlayerNPC(playerid)) {
  575.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
  576.  
  577.             /*--------------------------------------------------
  578.             *
  579.             *  Anti Speed Hack
  580.             *   Usando GetPlayerSpeedANTIHACK com variáveis
  581.             *   A precisão deste sistema fica em torno de 100%
  582.             *
  583.             -------------------------------------------------*/
  584.  
  585.             if(GetPVarInt(playerid, "cSpeedTemp_pB")) {
  586.                 if((gettime() - GetPVarInt(playerid, "cSpeedTemp_pB")) > 1) {
  587.                     TogglePlayerControllable(playerid, true);
  588.                     SetPVarInt(playerid, "cSpeedTemp_pB", 0);
  589.                 }
  590.             }
  591.             if(getPlayerSpeed_pB(playerid) > 260) {
  592.                 if((gettime() - vVelocity_pB[GetPlayerVehicleID(playerid)]) > 10) {
  593.                     TogglePlayerControllable(playerid, false);
  594.                     SetPVarInt(playerid, "cSpeedTemp_pB", gettime());
  595.                     return CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SPEED_HACK), true;
  596.                 }
  597.             }
  598.  
  599.             /*--------------------------------------------------
  600.             *
  601.             *  Anti Spider Car
  602.             *   Usando GetVehicleRotationQuat
  603.             *   A precisão deste sistema fica em torno de 75%
  604.             *
  605.             -------------------------------------------------*/
  606.  
  607.             static Float: fW_pB, Float: fX_pB, Float: fY_pB, Float: fZ_pB;
  608.  
  609.             GetVehicleRotationQuat(GetPlayerVehicleID(playerid), fW_pB, fX_pB, fY_pB, fZ_pB);
  610.  
  611.             fW_pB = atan2(2 * ((fY_pB * fZ_pB) + (fX_pB * fW_pB)), (-(fX_pB * fX_pB) - (fY_pB * fY_pB) + (fZ_pB * fZ_pB) + (fW_pB * fW_pB)));
  612.  
  613.             // OBS: Inclinação de 5 graus. Construções mais inclinadas podem
  614.             // fazer o veículo inclinar mais. Mas para evitar falsos reports deixe mais ou menos este valor
  615.  
  616.             if((85.0 < fW_pB < 90.0) || (-85.0 > fW_pB > -90.0)) {
  617.                 SetPVarInt(playerid, "sCar_pB", (GetPVarInt(playerid, "sCar_pB") + 1));
  618.                 if(GetPVarInt(playerid, "sCar_pB") > 40) {
  619.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SPIDER_HACK);
  620.                     SetPVarInt(playerid, "sCar_pB", 0);
  621.                 }
  622.             }
  623.         }
  624.        
  625.         /*--------------------------------------------------
  626.         *
  627.         *  Anti Health/Armour Hack
  628.         *   Usando GetPlayer(Health/Armour) com variáveis server sided
  629.         *   A precisão deste sistema fica em torno de 100%
  630.         *
  631.         -------------------------------------------------*/
  632.  
  633.         static Float: pLife_pB;
  634.         GetPlayerHealth(playerid, pLife_pB);
  635.         if(pLife_pB > GetPVarFloat(playerid, "Health_pB")) {
  636.             SetPlayerHealth(playerid, GetPVarFloat(playerid, "Health_pB"));
  637.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_HEALTH_HACK);
  638.         }
  639.         GetPlayerArmour(playerid, pLife_pB);
  640.         if(pLife_pB > GetPVarFloat(playerid, "Armour_pB")) {
  641.             SetPlayerArmour(playerid, GetPVarFloat(playerid, "Armour_pB"));
  642.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_ARMOUR_HACK);
  643.         }
  644.  
  645.         /*--------------------------------------------------
  646.         *
  647.         *  Anti Player Bugger
  648.         *   Usando GetPlayerPos com variáveis server sided
  649.         *   A precisão deste sistema fica em torno de 99%
  650.         *   Desbuga o jogador bugado e envia mensagem aos administradores
  651.         *
  652.         -------------------------------------------------*/
  653.  
  654.         static Float: fX_pB, Float: fY_pB, Float:fZ_pB;
  655.         GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  656.  
  657.         if(fX_pB > 0xdbb9f && fY_pB > 0xdbb9f && fZ_pB > 0xdbb9f) {
  658.             SetTimerEx("verifBugger_pB", 250, false, "i", playerid);
  659.         }
  660.  
  661.         /*--------------------------------------------------
  662.         *
  663.         *  Anti Freeze Hack
  664.         *   Usando GetPlayerPos com variáveis server sided
  665.         *   A precisão deste sistema fica em torno de 90%
  666.         *
  667.         -------------------------------------------------*/
  668.  
  669.         else {
  670.             // checar se realmente está está como MOVIMENTO FALSE
  671.             if(!GetPVarInt(playerid, "PlayerControllable_pB")) {
  672.                 GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  673.  
  674.                 // Checar seus controle foram realmente bloqueados para diferentes de zero !
  675.  
  676.                 if(GetPVarFloat(playerid, "xPosControll_pB") && GetPVarFloat(playerid, "yPosControll_pB") && GetPVarFloat(playerid, "zPosControll_pB")) {
  677.                     if((GetPVarFloat(playerid, "xPosControll_pB") != fX_pB) ||  (GetPVarFloat(playerid, "yPosControll_pB") != fY_pB) || (GetPVarFloat(playerid, "zPosControll_pB") != fZ_pB)) {
  678.  
  679.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FREEZE_HACK);
  680.  
  681.                         // liberar jogador
  682.                         SetPVarInt(playerid, "PlayerControllable_pB", 1);
  683.                     }
  684.                 }
  685.             }
  686.  
  687.             GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  688.             if(GetPVarFloat(playerid, "xPosSet_pB") != 0 && GetPVarFloat(playerid, "yPosSet_pB") != 0 && GetPVarFloat(playerid, "zPosSet_pB") != 0) {
  689.                 new Float: xDistance_pB = MAX_DISTANCE_DEF;
  690.  
  691.                 fX_pB = GetPVarFloat(playerid, "xPosSet_pB") - fX_pB;
  692.                 fY_pB = GetPVarFloat(playerid, "yPosSet_pB") - fY_pB;
  693.                 fZ_pB = GetPVarFloat(playerid, "zPosSet_pB") - fZ_pB;
  694.  
  695.                 if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID) {
  696.                     xDistance_pB = 7.0;
  697.                 }
  698.                 if((fX_pB > xDistance_pB || fX_pB < -xDistance_pB) || (fY_pB > xDistance_pB || fY_pB < -xDistance_pB) || (fZ_pB > xDistance_pB || fZ_pB < -xDistance_pB)) {
  699.                     if((gettime() - GetPVarInt(playerid, "tPosSet_pB")) > 3 && GetPVarInt(playerid, "Spawned_pB")) {
  700.                         GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  701.                         SetTimerEx("checkPos_pB", 500, false, "ifff", playerid, fX_pB, fY_pB, fZ_pB);
  702.                     }
  703.                 }
  704.             }
  705.  
  706.             GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  707.  
  708.             SetPVarFloat(playerid, "xPosSet_pB", fX_pB);
  709.             SetPVarFloat(playerid, "yPosSet_pB", fY_pB);
  710.             SetPVarFloat(playerid, "zPosSet_pB", fZ_pB);
  711.         }
  712.  
  713.         /*--------------------------------------------------
  714.         *
  715.         *  Anti Ping Alto
  716.         *   Usando GetPlayerScore com variáveis server sided
  717.         *   A precisão deste sistema fica em torno de 90%
  718.         *
  719.         -------------------------------------------------*/
  720.  
  721.         if(GetPlayerPing(playerid) > MAX_PING) {
  722.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_HIGH_PING);
  723.         }
  724.  
  725.         /*--------------------------------------------------
  726.         *
  727.         *  Anti Score Hack
  728.         *   Usando GetPlayerScore com variáveis server sided
  729.         *   A precisão deste sistema fica em torno de 100%
  730.         *
  731.         -------------------------------------------------*/
  732.  
  733.         if(GetPlayerScore(playerid) > GetPVarInt(playerid, "rScore_pB")) {
  734.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SCORE_HACK);
  735.             SetPlayerScore(playerid, GetPVarInt(playerid, "rScore_pB"));
  736.         }
  737.  
  738.         /*--------------------------------------------------
  739.         *
  740.         *  Anti Money Hack
  741.         *   Usando GetPlayerMoney com variáveis server sided
  742.         *   A precisão deste sistema fica em torno de 100%
  743.         *
  744.         -------------------------------------------------*/
  745.  
  746.         if(GetPlayerMoney(playerid) > GetPVarInt(playerid, "rMoney_pB")) {
  747.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_MONEY_HACK);
  748.             GivePlayerMoney(playerid, (ResetPlayerMoney(playerid), GetPVarInt(playerid, "rMoney_pB")));
  749.         }
  750.        
  751.         /*--------------------------------------------------
  752.         *
  753.         *  Anti Player Speed Hack
  754.         *   Usando GetPlayerVelocity com variáveis server sided
  755.         *   A precisão deste sistema fica em torno de 95%
  756.         *
  757.         -------------------------------------------------*/
  758.        
  759.         if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
  760.             GetPlayerVelocity(playerid, fX_pB, fY_pB, fZ_pB);
  761.             if(floatround(floatsqroot(floatadd(floatpower(fX_pB, 2), floatpower(fY_pB, 2))) * 200) > 100) {
  762.                 if(!(GetPVarInt(playerid, "wSpeed_pB") % 50)) {
  763.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_PSPEED_HACK);
  764.                 }
  765.                 SetPVarInt(playerid, "wSpeed_pB", (GetPVarInt(playerid, "wSpeed_pB") + 1));
  766.             }
  767.         }
  768.  
  769.         /*--------------------------------------------------
  770.         *
  771.         *  Anti Weapons Hack
  772.         *   Usando GetPlayerWeaponData com variáveis server sided
  773.         *   A precisão deste sistema fica em torno de 100%
  774.         *
  775.         -------------------------------------------------*/
  776.  
  777.         static wSlot_pB[2];
  778.         for(new w_pB; w_pB != 13; ++w_pB) {
  779.             GetPlayerWeaponData(playerid, w_pB, wSlot_pB[0], wSlot_pB[1]);
  780.             if(GetPVarInt(playerid, getSlotID_pB(w_pB)) != wSlot_pB[0] && wSlot_pB[0] && wSlot_pB[0] < 47) {
  781.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_WEAPON_HACK);
  782.                 SetPVarInt(playerid, getSlotID_pB(w_pB), wSlot_pB[0]);
  783.             }
  784.         }
  785.        
  786.         /*--------------------------------------------------
  787.         *
  788.         *  Anti No-Reload
  789.         *   Usando GetPlayerAmmo com variáveis server sided
  790.         *   A precisão deste sistema fica em torno de 100%
  791.         *
  792.         -------------------------------------------------*/
  793.        
  794.         static pKey_pB[3];
  795.         GetPlayerKeys(playerid, pKey_pB[0], pKey_pB[1], pKey_pB[2]);
  796.         if(isPlayerAiming_pB(playerid) && ((pKey_pB[0] & KEY_FIRE) == KEY_FIRE || (pKey_pB[0] & KEY_ACTION) == KEY_ACTION)) {
  797.             if(GetPlayerWeapon(playerid) > 15 && GetPlayerWeapon(playerid) < 43 && GetPlayerAmmo(playerid) == GetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(GetPlayerWeapon(playerid)))) && !GetPVarInt(playerid, "PlayerControllable_pB") && !IsPlayerInAnyVehicle(playerid)) {
  798.                 SetPVarInt(playerid, "kWarns_pB", (GetPVarInt(playerid, "kWarns_pB") + 1));
  799.                 if(!(GetPVarInt(playerid, "kWarns_pB") % 50) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
  800.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_NORELOAD_HACK);
  801.                 }
  802.             }
  803.             if(GetPlayerWeaponState(playerid) == WEAPONSTATE_RELOADING || GetPlayerAmmo(playerid) < GetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(GetPlayerWeapon(playerid))))) SetPVarInt(playerid, "kWarns_pB", 0);
  804.             SetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(GetPlayerWeapon(playerid))), GetPlayerAmmo(playerid));
  805.         }
  806.  
  807.         /*--------------------------------------------------
  808.         *
  809.         *  Anti Ammo Hack
  810.         *   Usando GetPlayerAmmo com variáveis server sided
  811.         *   A precisão deste sistema fica em torno de 100%
  812.         *
  813.         -------------------------------------------------*/
  814.  
  815.         if(GetPlayerWeapon(playerid) > 15 && GetPlayerWeapon(playerid) < 43) {
  816.             if(GetPlayerAmmo(playerid) > GetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(GetPlayerWeapon(playerid))))) {
  817.                 if(!IsPlayerInAnyVehicle(playerid)) {
  818.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_AMMO_HACK);
  819.                 }
  820.             }
  821.             SetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(GetPlayerWeapon(playerid))), GetPlayerAmmo(playerid));
  822.         }
  823.  
  824.         /*--------------------------------------------------
  825.         *
  826.         *   Anti Fly Hack
  827.         *   Usando Posições e Animções.
  828.         *   A precisão deste sistema fica em torno de 85%
  829.         *
  830.         -------------------------------------------------*/
  831.  
  832.         if(!isPlayerInWater_pB(playerid) && isPlayerUsingSwimAnim_pB(playerid)) {
  833.             if(!(GetPVarInt(playerid, "FlyTime") % 50)) {
  834.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FLY_HACK);
  835.                 SetPVarInt(playerid, "FlyTime", 0);
  836.             }
  837.             SetPVarInt(playerid, "FlyTime", (GetPVarInt(playerid, "FlyTime") + 1));
  838.         } else if(isPlayerInWater_pB(playerid) && isPlayerUsingSwimAnim_pB(playerid)) {
  839.             SetPVarInt(playerid, "FlyTime", 0);
  840.         }
  841.  
  842.         SetPVarInt(playerid, "rMoney_pB", GetPlayerMoney(playerid));
  843.         SetPVarInt(playerid, "rScore_pB", GetPlayerScore(playerid));
  844.     }
  845.     return (OPU_pB ? CallLocalFunction("OnPlayerUpdate_pB", "i", playerid) : 1);
  846. }
  847.  
  848. #if defined _ALS_OnPlayerUpdate
  849.     #undef OnPlayerUpdate
  850. #else
  851.     #define _ALS_OnPlayerUpdate
  852. #endif
  853.  
  854. #define OnPlayerUpdate OnPlayerUpdate_pB
  855. forward OnPlayerUpdate_pB(playerid);
  856.  
  857. public OnPlayerStateChange(playerid, newstate, oldstate) {
  858.  
  859.     /*--------------------------------------------------
  860.     *
  861.     *  Anti State Hack
  862.     *   Usando OnPlayerStateChange com gettime
  863.     *   A precisão deste sistema fica em torno de 95%
  864.     *
  865.     -------------------------------------------------*/
  866.  
  867.     if(newstate == PLAYER_STATE_DRIVER) {
  868.         if((gettime() - GetPVarInt(playerid, "rState_pB")) < 2 && (gettime() - GetPVarInt(playerid, "tPosSet_pB")) > 3) {
  869.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_STATE_HACK);
  870.         }
  871.         SetPVarInt(playerid, "rState_pB", gettime());
  872.     }
  873.     SetPVarInt(playerid, "sCar_pB", 0);
  874.     return (OPSC_pB ? CallLocalFunction("OnPlayerStateChange_pB", "idi", playerid, newstate, oldstate) : 1);
  875. }
  876.  
  877. #if defined _ALS_OnPlayerStateChange
  878.     #undef OnPlayerStateChange
  879. #else
  880.     #define _ALS_OnPlayerStateChange
  881. #endif
  882.  
  883. #define OnPlayerStateChange OnPlayerStateChange_pB
  884. forward OnPlayerStateChange_pB(playerid, newstate, oldstate);
  885.  
  886. public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat) {
  887.  
  888.     /*--------------------------------------------------
  889.     *
  890.     *  Anti Surfer Vehicle
  891.     *   Usando OnUnoccupiedVehicleUpdate com gettime e outros
  892.     *   A precisão deste sistema fica em torno de 85%
  893.     *
  894.     -------------------------------------------------*/
  895.  
  896.     GetVehiclePos(vehicleid, vPos_pB[0], vPos_pB[1], vPos_pB[2]);
  897.  
  898.     if(IsPlayerInRangeOfPoint(playerid, 1.0, vPos_pB[0], vPos_pB[1], vPos_pB[2])) {
  899.         GetVehicleZAngle(vehicleid, vPos_pB[3]);
  900.         if(dAngle_pB[vehicleid] != vPos_pB[3]) {
  901.             if(!IsPlayerInAnyVehicle(playerid)) {
  902.                 GetPlayerPos(vehicleid, vPos_pB[1], vPos_pB[1], vPos_pB[3]);
  903.                 if(vPos_pB[3] > vPos_pB[2]) {
  904.                     SetPVarInt(playerid, "rUAF_pB", GetPVarInt(playerid, "rUAF_pB") +1);
  905.                     if(GetPVarInt(playerid, "rUAF_pB") > 40) {
  906.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SURF_VEHICLE);
  907.                     }
  908.                 }
  909.             }
  910.         }
  911.         dAngle_pB[vehicleid] = vPos_pB[3];
  912.         return true;
  913.     }
  914.  
  915.     /*--------------------------------------------------
  916.     *
  917.     *  Anti Teleport Vehicle
  918.     *   Usando OnUnoccupiedVehicleUpdate com gettime e outros
  919.     *   A precisão deste sistema fica em torno de 85%
  920.     *
  921.     -------------------------------------------------*/
  922.  
  923.     else if(!IsPlayerInRangeOfPoint(playerid, 40.0, vPos_pB[0], vPos_pB[1], vPos_pB[2])) {
  924.         if(!IsPlayerInAnyVehicle(playerid) && (gettime() - GetPVarInt(playerid, "tPosSet_pB") > 3) && !vRespawn_pB[vehicleid]) {
  925.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CAR_TELEPORT);
  926.         } else if(vRespawn_pB[vehicleid]) vRespawn_pB[vehicleid] = false;
  927.     }
  928.     return (OUVU_pB ? CallLocalFunction("OnUnoccupiedVehicleUpdate_pB", "idi", vehicleid, playerid, passenger_seat) : 1);
  929. }
  930.  
  931. #if defined _ALS_OnUnoccupiedVehicleUpdate
  932.     #undef OnUnoccupiedVehicleUpdate
  933. #else
  934.     #define _ALS_OnUnoccupiedVehicleUpdate
  935. #endif
  936.  
  937. #define OnUnoccupiedVehicleUpdate OnUnoccupiedVehicleUpdate_pB
  938. forward OnUnoccupiedVehicleUpdate_pB(vehicleid, playerid, passenger_seat);
  939.  
  940. pFunction checkPos_pB(i, Float: fX_pB, Float: fY_pB, Float: fZ_pB) {
  941.     if(gettime() - GetPVarInt(i, "aBreakSet_pB") < 10)
  942.     return false;
  943.  
  944.     /*--------------------------------------------------
  945.     *
  946.     *  Anti Teleport Hack
  947.     *   Usando GetPlayerPos com variáveis server sided
  948.     *   A precisão deste sistema fica em torno de 95%
  949.     *
  950.     -------------------------------------------------*/
  951.  
  952.     if(IsPlayerInRangeOfPoint(i, 2.012837, fX_pB, fY_pB, fZ_pB)) {
  953.         CallLocalFunction("OnPlayerHacking", "ii", i, PLAYER_TELEPORT_HACK);
  954.     }
  955.  
  956.     /*--------------------------------------------------
  957.     *
  958.     *  Anti AirBreak Hack
  959.     *   Usando GetPlayerPos e SetPlayerPos com variáveis server sided
  960.     *   A precisão deste sistema fica em torno de 95%
  961.     *
  962.     -------------------------------------------------*/
  963.  
  964.     else {
  965.         CallLocalFunction("OnPlayerHacking", "ii", i, PLAYER_AIRBREAK_HACK);
  966.         SetPVarInt(i, "aBreakSet_pB", gettime());
  967.     }
  968.     return true;
  969. }
  970.  
  971. pFunction verifBugger_pB(playerid) {
  972.     new Float: fX_pB, Float: fY_pB, Float: fZ_pB;
  973.     GetPlayerPos(playerid, fX_pB, fY_pB, fZ_pB);
  974.     if(fX_pB > 0xdbb9f && fY_pB > 0xdbb9f && fZ_pB > 0xdbb9f) SetPlayerPos(playerid, GetPVarFloat(playerid, "xPosSet_pB"),  GetPVarFloat(playerid, "yPosSet_pB"),  GetPVarFloat(playerid, "zPosSet_pB"));
  975.     else CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_BUGGER_HACK);
  976.     return 1;
  977. }
  978.  
  979. pFunction registerBot_pB(playerid) {
  980.  
  981.     /*--------------------------------------------------
  982.     *
  983.     *  Anti DDos Bots
  984.     *   Usando GetPlayerPing/OnPlayerConnect com gettime e outros
  985.     *   A precisão deste sistema está dividido em partes
  986.     *
  987.     *  PLAYER_BOT_LEVEL1 -> 70%
  988.     *  PLAYER_BOT_LEVEL2 -> 90%
  989.     *  PLAYER_BOT_LEVEL3 -> 100%
  990.     *
  991.     *
  992.     -------------------------------------------------*/
  993.  
  994.     if(GetPlayerPing(playerid) != 0xFFFF && GetPlayerPing(playerid)  != 0) SetPVarInt(playerid, "jOn_pB", 1);
  995.     if(IsPlayerConnected(playerid) && GetPlayerPing(playerid)  == 0xFFFF) {
  996.         static iP_pB[20];
  997.         GetPlayerIp(playerid, iP_pB, 20);
  998.         if(0x1c5 > (gettime() - varGet(iP_pB))) {
  999.             iP_pB[(strlen(iP_pB) - 1)] = 'x';
  1000.             if(varGet(iP_pB) > 3) {
  1001.                 return CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_BOT_LEVEL3);
  1002.             }
  1003.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_BOT_LEVEL2);
  1004.         }
  1005.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_BOT_LEVEL1);
  1006.         SetTimerEx("registerBot_pB", 700, false, "i" , playerid);
  1007.     }
  1008.     return false;
  1009. }
  1010.  
  1011. pFunction rJogador_pB(playerid) {
  1012.     static iP_pB[20], connect_pB;
  1013.  
  1014.     dAngle_pB[playerid] = 0;
  1015.     GetPlayerIp(playerid, iP_pB, 20);
  1016.     varSet(iP_pB, gettime()); ++connect_pB;
  1017.  
  1018.     if(connect_pB == MAX_PLAYERS - 1) {
  1019.         for(connect_pB = 0; dbIP_pB[connect_pB][0]; connect_pB++) continue;
  1020.     }
  1021.     SetTimerEx("resetBot_pB", 50000, false, "i", connect_pB);
  1022.  
  1023.     iP_pB[strlen(iP_pB)-1] = 'x';
  1024.     format(dbIP_pB[connect_pB], 20, iP_pB);
  1025.     varSet(iP_pB, varGet(iP_pB) +1);
  1026.  
  1027.     SetPVarInt(playerid, "tPosSet_pB", gettime());
  1028.     return SetTimerEx("registerBot_pB", 700, false, "i" , playerid);
  1029. }
  1030.  
  1031. pFunction resetBot_pB(botid) {
  1032.     varSet(dbIP_pB[botid], 0);
  1033.     return dbIP_pB[botid][0] = EOS;
  1034. }
  1035.  
  1036. #define GivePlayerMoney             GivePlayerMoney_pB
  1037. #define ResetPlayerMoney            ResetPlayerMoney_pB
  1038. #define SetPlayerScore              SetPlayerScore_pB
  1039. #define PutPlayerInVehicle          PutPlayerInVehicle_pB
  1040. #define SetPlayerArmour             SetPlayerArmour_pB
  1041. #define SetPlayerHealth             SetPlayerHealth_pB
  1042. #define TogglePlayerControllable    TogglePlayerC_pB
  1043. #define GivePlayerWeapon            GivePlayerWeapon_pB
  1044. #define ResetPlayerWeapons          ResetPlayerWeapons_pB
  1045. #define SetPlayerPos                SetPlayerPos_pB
  1046. #define SetVehiclePos               SetVehiclePos_pB
  1047.  
  1048. #define SetVehicleVelocity          SetVehicleVelocity_pB
  1049. #define SetVehicleToRespawn         SetVehicleToRespawn_pB
  1050.  
  1051. forward OnPlayerHacking(playerid, hackid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement