Advertisement
ipsBruno

(Pawn) pbAntiCheater

Oct 19th, 2012
3,080
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 36.88 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
  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
  49. // *  Bruno da Silva (email@brunodasilva.com)
  50. //
  51. //                  Ingresse também na [iPs]TeaM
  52. //                  wwww.ips-team.forumeiros.com
  53. //
  54. //////////////////////////////////////////////////////////////////////////////////
  55.  
  56. enum {
  57.     // Anti DDos Bots
  58.     PLAYER_BOT_LEVEL3,
  59.     PLAYER_BOT_LEVEL2,
  60.     PLAYER_BOT_LEVEL1,
  61.  
  62.     // Anti Cleo4 Fake-kill
  63.     PLAYER_DEATHFLOOD_LEVEL3,
  64.     PLAYER_DEATHFLOOD_LEVEL2,
  65.     PLAYER_DEATHFLOOD_LEVEL1,
  66.  
  67.     // Anti Bug Cars
  68.     PLAYER_SURF_VEHICLE,
  69.     PLAYER_CAR_TELEPORT,
  70.     PLAYER_STATE_HACK,
  71.  
  72.     // Ammo Weapon
  73.     PLAYER_NORELOAD_HACK,
  74.     PLAYER_WEAPON_HACK,
  75.     PLAYER_AMMO_HACK,
  76.  
  77.  
  78.     // hackings
  79.     PLAYER_FREEZE_HACK,
  80.     PLAYER_SCORE_HACK,
  81.     PLAYER_MONEY_HACK,
  82.     PLAYER_HEALTH_HACK,
  83.     PLAYER_ARMOUR_HACK,
  84.  
  85.     // Text Chat
  86.     PLAYER_PUBLISH_TEXT,
  87.     PLAYER_OFFEND_TEXT,
  88.     PLAYER_FLOOD_TEXT,
  89.  
  90.     // pos cheat
  91.     PLAYER_TELEPORT_HACK,
  92.     PLAYER_AIRBREAK_HACK,
  93.     PLAYER_BUGGER_HACK,
  94.  
  95.     // outros
  96.     PLAYER_HIGH_PING,
  97.     PLAYER_SPIDER_HACK,
  98.     PLAYER_CPRACE_HACK,
  99.     PLAYER_SPEED_HACK,
  100.     PLAYER_PSPEED_HACK,
  101.     PLAYER_FLY_HACK
  102. }
  103.  
  104.  
  105. new connect = -1,
  106.     Float: g_ucPos[4],
  107.     databaseIP[MAX_PLAYERS][20],
  108.     Float:g_diferencasAngle[MAX_VEHICLES],
  109.     vehVelocity[MAX_VEHICLES],
  110.     bool: vehRespawn[MAX_VEHICLES],
  111.     bool: pOPC,
  112.     bool: pOPS,
  113.     bool: pOPDI,
  114.     bool: pOPT,
  115.     bool: pOPD,
  116.     bool: pOVM,
  117.     bool: pOPERCP,
  118.     bool: pOPU,
  119.     bool: pOPSC,
  120.     bool: pOUVU;
  121.  
  122. forward OnPlayerHacking(playerid, hackid);
  123.  
  124. #define INVALID_CHAT_BLOCK
  125. #define SERVER_SIDE_DELAY   (0002)
  126. #define MAX_DISTANCE_DEF    (83.1)
  127. #define MAX_PING            (0800)
  128.  
  129.  
  130. // =============================================================================
  131. //
  132. // OBSERVAÇõES IMPORTANTES:
  133.  
  134. // #define INVALID_CHAT_BLOCK
  135. // Em caso de não quiser bloquear o texto em caso de texto inválido
  136. // Texto inválido, spam, flood, palavreado, ofensa, publicação. etc
  137.  
  138. // Ping acima de 1 segundo (1000 ms) poderá ocorrer graves problemas de precisão no anti cheater.
  139. // Em caso de ping muito elevado aconselha-se o uso de SERVER_SIDE_DELAY elevado para maior precisão
  140.  
  141. // SERVER_SIDE_DELAY equivale ao tempo de delay entre o uso de uma função registrada
  142. // que influencia no detectamento do anti cheater. Aconselhável 1 a 5 segundos.
  143. // Dependendo da conexão do servidor você coloca maior delay ou menor dealay
  144.  
  145. // MAX_DISTANCE_DEF é essencial para busca e detecção de anti-teleport e air break
  146. // O número padrão foi calculado e não houve bugs por parte do sistema
  147. // A única coisa que pode influenciar será o sistema de SetPlayerPos. Mas o SERVER_SIDE_DELAY supriu isto com precisão
  148.  
  149. // Este sistema apenas detecta cheaters. É aconselhavél a checagem de um administrador real antes de aplicar o banimento.
  150.  
  151. // ========================================================================================================
  152.  
  153. #define pFunction%0(%1) %0(%1); public%0(%1)
  154. #define Hook%0(%1)  stock%0_pB(%1)
  155.  
  156. // ---------------------------------------------
  157. //  Nesta parte aparecem funções hookeadas
  158. //  Elas são essenciais para ter controle server-side detalhado
  159. //  Essencial para qualquer anti-hack. Controle minucioso
  160. //  Para o funcionamento disto precisa do filterscript
  161. //  Hookei apenas as mais importantes callbacks nativas da sa:mp.
  162. //  Daria muito trabalho "hookear" todas
  163. // ---------------------------------------------
  164.  
  165.  
  166. Hook GivePlayerMoney(playerid, value) {
  167.     return SetPVarInt(playerid, #registerMoney, (GetPVarInt(playerid, #registerMoney) + value)), GivePlayerMoney(playerid, value);
  168. }
  169.  
  170. Hook ResetPlayerMoney(playerid) {
  171.     return SetPVarInt(playerid, #registerMoney, 0), ResetPlayerMoney(playerid);
  172. }
  173.  
  174. Hook SetPlayerScore(playerid, value){
  175.     return SetPVarInt(playerid, #registerScore, value), SetPlayerScore(playerid, value);
  176. }
  177.  
  178. Hook PutPlayerInVehicle(playerid,vehicleid, seatid) {
  179.     return SetPVarInt(playerid, #registerState, (gettime() - SERVER_SIDE_DELAY)), PutPlayerInVehicle(playerid, vehicleid, seatid);
  180. }
  181.  
  182. Hook SetVehicleVelocity(vehicleid, Float: pX, Float: pY, Float: pZ) {
  183.     return vehVelocity[vehicleid] = gettime(), SetVehicleVelocity(vehicleid, pX, pY, pZ);
  184. }
  185.  
  186. Hook SetVehiclePos(vehicleid, Float: pX, Float: pY, Float: pZ) {
  187.  
  188.     for( new i = GetMaxPlayers() - 1; i > -1;  --i ) {
  189.         if( GetPlayerVehicleID(i) == vehicleid ) {
  190.             SetPVarInt(i, #tPosSet, gettime());
  191.             break;
  192.         }
  193.     }
  194.  
  195.     return SetVehiclePos(vehicleid, pX, pY, pZ);
  196. }
  197.  
  198. Hook SetPlayerPos(playerid, Float: pX, Float: pY, Float: pZ) {
  199.     return SetPVarInt(playerid, #tPosSet, gettime()), SetPlayerPos(playerid, pX, pY, pZ);
  200. }
  201.  
  202. Hook GivePlayerWeapon(playerid, weaponid, ammo) {
  203.     return SetPVarInt(playerid, getSlotID_pB(getWeaponSlot_pB(weaponid)), weaponid), SetPVarInt(playerid, getSlotAmmoID_pB(getWeaponSlot_pB(weaponid)), ammo), GivePlayerWeapon(playerid, weaponid, ammo);
  204. }
  205.  
  206. Hook ResetPlayerWeapons(playerid) {
  207.     for(new i; i != 13; ++i) SetPVarInt(playerid, getSlotID_pB(i), 0);
  208.     return ResetPlayerWeapons(playerid);
  209. }
  210.  
  211. Hook TogglePlayerC(playerid, {bool, _}: control) {
  212.     if(control) {
  213.         static Float: pX, Float: pY, Float: pZ;
  214.  
  215.         GetPlayerPos(playerid, pX, pY, pZ);
  216.         SetPVarFloat(playerid, "xPosControll", pX),
  217.         SetPVarFloat(playerid, "yPosControll", pY),
  218.         SetPVarFloat(playerid, "zPosControll", pZ);
  219.     } else {
  220.         SetPVarFloat(playerid, "xPosControll", 0.0);
  221.         SetPVarFloat(playerid, "yPosControll", 0.0);
  222.         SetPVarFloat(playerid, "zPosControll", 0.0);
  223.     }
  224.     TogglePlayerControllable(playerid, control);
  225.     return SetPVarInt(playerid, "PlayerControllable", _:!control);
  226. }
  227.  
  228. Hook SetPlayerHealth(playerid, Float:health) {
  229.     return SetPVarFloat(playerid, #pHealth, health), SetPlayerHealth(playerid, health);
  230. }
  231.  
  232. Hook SetPlayerArmour(playerid, Float:armour) {
  233.     return SetPVarFloat(playerid, #pArmour, armour), SetPlayerArmour(playerid, armour);
  234. }
  235.  
  236. Hook SetVehicleToRespawn(vehicleid) {
  237.     return vehRespawn[vehicleid] = true, SetVehicleToRespawn(vehicleid);
  238. }
  239.  
  240. isPlayerAiming_pB(playerid) {
  241.     new Anim = GetPlayerAnimationIndex(playerid);
  242.     if(((Anim >= 1160) && (Anim <= 1163)) || (Anim == 1167) || (Anim == 1365) || (Anim == 1643) || (Anim == 1453) || (Anim == 220)) return 1;
  243.     return 0;
  244. }
  245.  
  246. isPlayerInWater_pB(playerid) { //Coords By Synchro
  247.     static Float:fX, Float:fY, Float:fZ; GetPlayerPos(playerid, fX, fY, fZ);
  248.     if((fX >= 2044.6 && fX <= 2192.984 && fY >= 1206.358 && fY <= 1376.552) && fZ < 0xA) return 1;
  249.     else if((fX >= 2048.504 && fX <= 2185.174 && fY >= 1063.239 && fY <= 1202.49) && fZ < 0xA) return 1;
  250.     else if((fX >= 2204.698 && fX <= 2204.698 && fY >= 1426.837 && fY <= 1430.705) && fZ < 0xA) return 1;
  251.     else if((fX >= 2032.885 && fX <= 2114.887 && fY >= 1852.325 && fY <= 1991.575) && fZ < 0xC) return 1;
  252.     else if((fX >= 2517.086 && fX <= 2606.897 && fY >= 2316.493 && fY <= 2420.93) && fZ < 0x16) return 1;
  253.     else if((fX >= 2554.5996 && fX <= 2507.7683 && fY >= 1548.6178 && fY <= 1588.9154) && fZ < 0xF) return 1;
  254.     else if((fX >= -2043.628 && fX <= -1973.561 && fY >= -980.9415 && fY <= -724.0283) && fZ < 0x20) return 1;
  255.     else if((fX >= -2753.912 && fX <= -2665.071 && fY >= -522.3632 && fY <= -380.3444) && fZ < 0x05) return 1;
  256.     else if((fX >= 1219.864 && fX <= 1292.118 && fY >= -2435.881 && fY <= -2325.344) && fZ < 0xF) return 1;
  257.     else if((fX >= 1923.388 && fX <= 2010.854 && fY >= -1223.924 && fY <= -1168.656) && fZ < 0x16) return 1;
  258.     else if((fX >= 1269.301 && fX <= 1314.935 && fY >= -837.0452 && fY <= -781.7769) && fZ < 0x5A) return 1;
  259.     else if((fX >= 1087.3953 && fX <= 1102.3138 && fY >= -682.6734 && fY <= -663.0043) && fZ < 0x71) return 1;
  260.     else if((fX >= 1268.6118 && fX <= 1291.8774 && fY >= -784.2910 && fY <= -764.6104) && fZ < 0x43D) return 1;
  261.     else if(fZ < 0xF) return 1;
  262.     return 0;
  263. }
  264.  
  265. isPlayerUsingSwimAnim_pB(playerid) { // By Synchro
  266.     if(IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 0;
  267.     static animlib[32], animname[32];
  268.     GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
  269.     if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_GLIDE", true)) return 1;
  270.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_BREAST", true)) return 1;
  271.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_CRAWL", true)) return 1;
  272.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_UNDER", true)) return 1;
  273.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_GLIDE", true)) return 1;
  274.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_UNDER", true)) return 1;
  275.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_TREAD", true)) return 1;
  276.     return 0;
  277. }
  278.  
  279. getSlotID_pB(i) { // Paulor
  280.     static stringSlot[12];
  281.     return format(stringSlot, 12, "wHSlot%i", i), stringSlot;
  282. }
  283.  
  284. getSlotAmmoID_pB(i) { // Paulor
  285.     static stringSlot[12];
  286.     return format(stringSlot, 12, "AmmoSlot%i", i), stringSlot;
  287. }
  288.  
  289. getWeaponSlot_pB(weaponid) { // Paulor
  290.     if(weaponid >= 0 && weaponid < 2) return 0;
  291.     else if(weaponid > 1 && weaponid < 10) return 1;
  292.     else if(weaponid > 21 && weaponid < 25) return 2;
  293.     else if(weaponid > 24 && weaponid < 28) return 3;
  294.     else if(weaponid > 27 && weaponid < 30 || weaponid == 32) return 4;
  295.     else if(weaponid > 29 && weaponid < 32) return 5;
  296.     else if(weaponid > 32 && weaponid < 35) return 6;
  297.     else if(weaponid > 34 && weaponid < 39) return 7;
  298.     else if(weaponid > 15 && weaponid < 19 || weaponid == 39) return 8;
  299.     else if(weaponid > 40 && weaponid < 44) return 9;
  300.     else if(weaponid > 9 && weaponid < 16) return 10;
  301.     else if(weaponid > 43 && weaponid < 47) return 11;
  302.     else if(weaponid == 40) return 12;
  303.     return -1;
  304. }
  305.  
  306. getPlayerSpeed_pB(playerid) {
  307.     static Float: ST[3];
  308.     GetVehicleVelocity(GetPlayerVehicleID(playerid), ST[0], ST[1], ST[2]);
  309.     return floatround(floatmul(floatsqroot(floatadd(floatpower(ST[0], 2), floatpower(ST[1], 2))), 170.0));
  310. }
  311.  
  312. #if !defined varGet
  313. #define varGet(%0)  getproperty(0,%0)
  314. #endif
  315.  
  316. #if !defined varSet
  317. #define varSet(%0,%1) setproperty(0, %0, %1)
  318. #endif
  319.  
  320. public OnGameModeInit() {
  321.     pOPC = funcidx(#ExOnPlayerConnect) != -1;
  322.     pOPS = funcidx(#ExOnPlayerSpawn) != -1;
  323.     pOPDI = funcidx(#ExOnPlayerDisconnect) != -1;
  324.     pOPT = funcidx(#ExOnPlayerText) != -1;
  325.     pOPD = funcidx(#ExOnPlayerDeath) != -1;
  326.     pOVM = funcidx(#ExOnVehicleMod) != -1;
  327.     pOPERCP = funcidx(#ExOnPlayerEnterRaceCP) != -1;
  328.     pOPU = funcidx(#ExOnPlayerUpdate) != -1;
  329.     pOPSC = funcidx(#ExOnPlayerStateChange) != -1;
  330.     pOUVU = funcidx(#ExOnUnoccupiedVehicleUpdate) != -1;
  331.     return CallLocalFunction(#ExOnGameModeInit, #);
  332. }
  333.  
  334. #if defined _ALS_OnGameModeInit
  335.     #undef OnGameModeInit
  336. #else
  337.     #define _ALS_OnGameModeInit
  338. #endif
  339.  
  340. #define OnGameModeInit ExOnGameModeInit
  341. forward ExOnGameModeInit();
  342.  
  343. public OnPlayerConnect(playerid) {
  344.     CallLocalFunction("registrarJogador_pB", "i", playerid);
  345.     return (pOPC ? CallLocalFunction("ExOnPlayerConnect", "i", playerid) : 1);
  346. }
  347.  
  348. #if defined _ALS_OnPlayerConnect
  349.     #undef OnPlayerConnect
  350. #else
  351.     #define _ALS_OnPlayerConnect
  352. #endif
  353.  
  354. #define OnPlayerConnect ExOnPlayerConnect
  355. forward ExOnPlayerConnect(playerid);
  356.  
  357. public OnPlayerSpawn(playerid) {
  358.     if(!GetPVarInt(playerid, "pSpawned")) SetPVarInt(playerid, "pSpawned", true);
  359.     SetPVarFloat(playerid, #pHealth, 100.0);
  360.     SetPVarFloat(playerid, #pArmour, 0.0);
  361.     SetPlayerHealth(playerid, 100.0);
  362.     SetPlayerArmour(playerid, 0.0);
  363.     return (pOPS ? CallLocalFunction("ExOnPlayerSpawn", "i", playerid) : 1);
  364. }
  365.  
  366. #if defined _ALS_OnPlayerSpawn
  367.     #undef OnPlayerSpawn
  368. #else
  369.     #define _ALS_OnPlayerSpawn
  370. #endif
  371.  
  372. #define OnPlayerSpawn ExOnPlayerSpawn
  373. forward ExOnPlayerSpawn(playerid);
  374.  
  375. public OnPlayerDisconnect(playerid, reason) {
  376.     // Não retire está parte. Isto serve para não enviar mensagens de desconecção quando o player é bot ddos
  377.     if(GetPVarInt(playerid, #jogadorDisponivel)) return false;
  378.     return (pOPDI ? CallLocalFunction("ExOnPlayerDisconnect", "is", playerid, reason) : 1);
  379. }
  380.  
  381. #if defined _ALS_OnPlayerDisconnect
  382.     #undef OnPlayerDisconnect
  383. #else
  384.     #define _ALS_OnPlayerDisconnect
  385. #endif
  386.  
  387. #define OnPlayerDisconnect ExOnPlayerDisconnect
  388. forward ExOnPlayerDisconnect(playerid,reason);
  389.  
  390. new const palavreado[][24] = {
  391.     "daputa", "babaca", "baitola", "piranha", "bicha", "bichona", "biscat", "bitch", "bix", "boiola", "boiolona", "buceta", "bucetudo", "cuzona", "bund", "burr", "fude", "cacet", "viad",
  392.     "caral", "vadi", "carai", "rola", "chup", "idiot", "corno", "nocu", "eucu", "ocu", "cusa", "cusi", "cuza", "cuzinho", "piroca", "embecil", "fdp", "foda", "fode", "fuck", "fud",
  393.     "hetard", "homo", "imbess", "jegu", "kacet", "karai", "karaleo", "kct", "kral", "krl", "noku", "lasarent", "lazarent", "mula", "otari", "pnc", "pereb", "penis","pint", "prosti",
  394.     "punhet", "put", "retardado", "tnc", "viad", "viadi", "vsf", "vtnc", "sobe", "vogelz", "baranga", "vagab", "broxa", "ignorant", "comed", "ejacu", "prosti", "cachorr", "surub", "peni",
  395.     "chup", "pau", "viad", "perere", "bucet", "bicha", "bixa", "gay", "desgra", "troxa", "tomanocu", "seucu"
  396. };
  397.  
  398. public OnPlayerText(playerid, text[]) {
  399.  
  400.     /*--------------------------------------------------
  401.     *
  402.     *  Anti Publicação de IP Inteligente
  403.     *   Usando OnPlayerText com manipulação de strings e outros
  404.     *   A precisão deste sistema está em torno de 95%
  405.     *
  406.     * Detecta: 127.0.0.1 | 1 2    7 .   0  0 1 etc
  407.     -------------------------------------------------*/
  408.  
  409.     static szText[128], numerosNochat, pontosNochat, j;
  410.  
  411.     numerosNochat = -1, pontosNochat = -1, j = 0, szText[0] = EOS;
  412.  
  413.     for(new i; text[i]; i++) {
  414.  
  415.         if(text[i] >= '0' && '9' >= text[i] || (text[i] == '.' || text[i] == ':')) {
  416.             if(text[i] == '.' || text[i] == ':') pontosNochat++;
  417.             else numerosNochat++;
  418.             if(numerosNochat >= 8 && pontosNochat >= 3) {
  419.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_PUBLISH_TEXT);
  420.                 #if defined INVALID_CHAT_BLOCK
  421.                 return false;
  422.                 #else
  423.                 break;
  424.                 #endif
  425.             }
  426.         }
  427.  
  428.         switch(text[i]) {
  429.             case '0':{ szText[j] = 'o'; j++; continue; }
  430.             case '1':{ szText[j] = 'i'; j++; continue; }
  431.             case '2':{ szText[j] = 'z'; j++; continue; }
  432.             case '3':{ szText[j] = 'e'; j++; continue; }
  433.             case '4':{ szText[j] = 'a'; j++; continue; }
  434.             case '5':{ szText[j] = 's'; j++; continue; }
  435.             case '6':{ szText[j] = 'g'; j++; continue; }
  436.             case '7':{ szText[j] = 't'; j++; continue; }
  437.             case '8':{ szText[j] = 'b'; j++; continue; }
  438.             case 65 .. 90, 97 .. 122: { szText[j] = tolower(text[i]); j++; continue; }
  439.         }
  440.     }
  441.  
  442.     /*--------------------------------------------------
  443.     *
  444.     *  Anti Palavreado Inteligente
  445.     *   Usando OnPlayerText com manipulação de strings e outros
  446.     *   A precisão deste sistema está em torno de 85%
  447.     *
  448.     * Detecta: buceta, b - u c |e t-a, buc 3 7 4 etc
  449.     -------------------------------------------------*/
  450.  
  451.     for(new i = 0; i < sizeof(palavreado); i++) {
  452.         if(strfind(szText, palavreado[i], false) != -1) {
  453.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_OFFEND_TEXT);
  454.  
  455.             #if defined INVALID_CHAT_BLOCK
  456.             return false;
  457.             #else
  458.             break;
  459.             #endif
  460.         }
  461.     }
  462.  
  463.     /*--------------------------------------------------
  464.     *
  465.     *  Anti Flood
  466.     *   Usando OnPlayerText com gettime e outros
  467.     *   A precisão deste sistema está em torno de 95%
  468.     *
  469.     -------------------------------------------------*/
  470.  
  471.     if((gettime() - GetPVarInt(playerid, #floodChat)) < 3) {
  472.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FLOOD_TEXT);
  473.         #if defined INVALID_CHAT_BLOCK
  474.         return false;
  475.         #endif
  476.     }
  477.  
  478.     SetPVarInt(playerid, #floodChat, gettime());
  479.     return (pOPT ? CallLocalFunction("ExOnPlayerText", "is", playerid, text) : 1);
  480. }
  481.  
  482. #if defined _ALS_OnPlayerText
  483.     #undef OnPlayerText
  484. #else
  485.     #define _ALS_OnPlayerText
  486. #endif
  487.  
  488. #define OnPlayerText ExOnPlayerText
  489. forward ExOnPlayerText(playerid, text[]);
  490.  
  491. public OnPlayerDeath(playerid,killerid,reason) {
  492.  
  493.     /*--------------------------------------------------
  494.     *
  495.     *  Anti Fake Kill
  496.     *   Usando OnPlayerDeath com gettime e outros
  497.     *   A precisão deste sistema está dividido em partes
  498.     *
  499.     *  PLAYER_DEATHFLOOD_LEVEL1 -> 070%
  500.     *  PLAYER_DEATHFLOOD_LEVEL2 -> 090%
  501.     *  PLAYER_DEATHFLOOD_LEVEL3 -> 100%
  502.     *
  503.     *
  504.     -------------------------------------------------*/
  505.  
  506.     if(gettime() - GetPVarInt(playerid, #registerDeath) < 20) {
  507.         if(GetPVarInt(playerid, #registerValDeath) > 15) {
  508.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL1);
  509.         }
  510.         if(gettime() - GetPVarInt(playerid, #registerDeath) < 2) {
  511.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL2);
  512.         }
  513.         if(gettime() - GetPVarInt(playerid, #registerDeath) < 5) {
  514.             if(GetPVarInt(playerid, #registerValDeath) > 3) {
  515.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL3);
  516.             }
  517.         }
  518.     }
  519.     SetPVarInt(playerid, #registerDeath, gettime());
  520.     SetPVarInt(playerid, #registerValDeath, GetPVarInt(playerid, #registerValDeath) +1);
  521.  
  522.     return (pOPD ? CallLocalFunction("ExOnPlayerDeath", "i", playerid) : 1);
  523. }
  524.  
  525. #if defined _ALS_OnPlayerDeath
  526.     #undef OnPlayerDeath
  527. #else
  528.     #define _ALS_OnPlayerDeath
  529. #endif
  530.  
  531. #define OnPlayerDeath ExOnPlayerDeath
  532. forward ExOnPlayerDeath(playerid, killerid, reason);
  533.  
  534. public OnVehicleMod(playerid, vehicleid, componentid) {
  535.     if(!GetPlayerInterior(playerid)) {
  536.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CPRACE_HACK);
  537.     }
  538.     return (pOVM ? CallLocalFunction("ExOnVehicleMod", "ddd", playerid, vehicleid, componentid) : 1);
  539. }
  540.  
  541. #if defined _ALS_OnVehicleMod
  542.     #undef OnVehicleMod
  543. #else
  544.     #define _ALS_OnVehicleMod
  545. #endif
  546.  
  547. #define OnVehicleMod ExOnVehicleMod
  548. forward ExOnVehicleMod(playerid,vehicleid,componentid);
  549.  
  550. public OnPlayerEnterRaceCheckpoint(playerid) {
  551.     if(IsPlayerInAnyVehicle(playerid)) {
  552.         if(!getPlayerSpeed_pB(playerid)) {
  553.             if(GetPVarInt(playerid, #checkHack) > 3) {
  554.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CPRACE_HACK);
  555.                 SetPVarInt(playerid, #checkHack, 0);
  556.             }
  557.             SetPVarInt(playerid, #checkHack, GetPVarInt(playerid, #checkHack)+1);
  558.         }
  559.     }
  560.     return (pOPERCP ? CallLocalFunction("ExOnPlayerEnterRaceCP", "i", playerid) : 1);
  561. }
  562.  
  563. #if defined _ALS_OnPlayerEnterRaceCP
  564.     #undef OnPlayerEnterRaceCheckpoint
  565. #else
  566.     #define _ALS_OnPlayerEnterRaceCP
  567. #endif
  568.  
  569. #define OnPlayerEnterRaceCheckpoint ExOnPlayerEnterRaceCP
  570. forward ExOnPlayerEnterRaceCP(playerid);
  571.  
  572. public OnPlayerUpdate(playerid) {
  573.     if(!IsPlayerNPC(playerid)) {
  574.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
  575.  
  576.             /*--------------------------------------------------
  577.             *
  578.             *  Anti Speed Hack
  579.             *   Usando GetPlayerSpeedANTIHACK com variáveis
  580.             *   A precisão deste sistema fica em torno de 100%
  581.             *
  582.             -------------------------------------------------*/
  583.  
  584.             if(GetPVarInt(playerid, #checkSpeedtime)) {
  585.                 if(gettime() - GetPVarInt(playerid, #checkSpeedtime) > 1) {
  586.                     TogglePlayerControllable(playerid, true);
  587.                     SetPVarInt(playerid, "checkSpeedtime", 0);
  588.                 }
  589.             }
  590.             if(getPlayerSpeed_pB(playerid) > 260) {
  591.                 if((gettime() - vehVelocity[GetPlayerVehicleID(playerid)]) > 10) {
  592.                     TogglePlayerControllable(playerid, false);
  593.                     SetPVarInt(playerid, "checkSpeedtime", gettime());
  594.                     return CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SPEED_HACK), true;
  595.                 }
  596.             }
  597.  
  598.             /*--------------------------------------------------
  599.             *
  600.             *  Anti Spider Car
  601.             *   Usando GetVehicleRotationQuat
  602.             *   A precisão deste sistema fica em torno de 75%
  603.             *
  604.             -------------------------------------------------*/
  605.  
  606.             static Float: pW, Float: pX, Float: pY, Float: pZ;
  607.  
  608.             GetVehicleRotationQuat(GetPlayerVehicleID(playerid), pW, pX, pY, pZ);
  609.  
  610.             pW = atan2(2 * ((pY * pZ) + (pX * pW)), (-(pX * pX) - (pY * pY) + (pZ * pZ) + (pW * pW)));
  611.  
  612.             // OBS: Inclinação de 5 graus. Construções mais inclinadas podem
  613.             // fazer o veículo inclinar mais. Mas para evitar falsos reports deixe mais ou menos este valor
  614.  
  615.             if((85.0 < pW < 90.0) || (-85.0 > pW > -90.0)) {
  616.                 SetPVarInt(playerid, #spiderCar, GetPVarInt(playerid, #spiderCar) +1);
  617.                 if(GetPVarInt(playerid, #spiderCar) > 40) {
  618.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SPIDER_HACK);
  619.                     SetPVarInt(playerid, #spiderCar, 0);
  620.                 }
  621.             }
  622.         }
  623.        
  624.         /*--------------------------------------------------
  625.         *
  626.         *  Anti Health/Armour Hack
  627.         *   Usando GetPlayer(Health/Armour) com variáveis server sided
  628.         *   A precisão deste sistema fica em torno de 100%
  629.         *
  630.         -------------------------------------------------*/
  631.  
  632.         static Float: pLife;
  633.         GetPlayerHealth(playerid, pLife);
  634.         if(pLife > GetPVarFloat(playerid, #pHealth)) {
  635.             SetPlayerHealth(playerid, GetPVarFloat(playerid, #pHealth));
  636.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_HEALTH_HACK);
  637.         }
  638.         GetPlayerArmour(playerid, pLife);
  639.         if(pLife > GetPVarFloat(playerid, #pArmour)) {
  640.             SetPlayerArmour(playerid, GetPVarFloat(playerid, #pArmour));
  641.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_ARMOUR_HACK);
  642.         }
  643.  
  644.         /*--------------------------------------------------
  645.         *
  646.         *  Anti Player Bugger
  647.         *   Usando GetPlayerPos com variáveis server sided
  648.         *   A precisão deste sistema fica em torno de 99%
  649.         *   Desbuga o jogador bugado e envia mensagem aos administradores
  650.         *
  651.         -------------------------------------------------*/
  652.  
  653.         static Float: pX, Float: pY, Float:pZ;
  654.         GetPlayerPos(playerid, pX, pY, pZ);
  655.  
  656.         if(pX > 0xdbb9f && pY > 0xdbb9f && pZ > 0xdbb9f) {
  657.             SetTimerEx("verifBugger_pB", 250, false, "i", playerid);
  658.         }
  659.  
  660.         /*--------------------------------------------------
  661.         *
  662.         *  Anti Freeze Hack
  663.         *   Usando GetPlayerPos com variáveis server sided
  664.         *   A precisão deste sistema fica em torno de 90%
  665.         *
  666.         -------------------------------------------------*/
  667.  
  668.         else {
  669.             // checar se realmente está está como MOVIMENTO FALSE
  670.             if(!GetPVarInt(playerid, "PlayerControllable")) {
  671.                 GetPlayerPos(playerid, pX, pY, pZ);
  672.  
  673.                 // Checar seus controle foram realmente bloqueados para diferentes de zero !
  674.  
  675.                 if(GetPVarFloat(playerid,"xPosControll") && GetPVarFloat(playerid,"yPosControll") && GetPVarFloat(playerid,"zPosControll")) {
  676.                     if((GetPVarFloat(playerid,"xPosControll") != pX) ||  (GetPVarFloat(playerid,"yPosControll") != pY) || (GetPVarFloat(playerid,"zPosControll") != pZ)) {
  677.  
  678.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FREEZE_HACK);
  679.  
  680.                         // liberar jogador
  681.                         SetPVarInt(playerid, "PlayerControllable", 1);
  682.                     }
  683.                 }
  684.             }
  685.  
  686.             GetPlayerPos(playerid, pX, pY, pZ);
  687.             if(GetPVarFloat(playerid,"xposSet") != 0 && GetPVarFloat(playerid,"yposSet") != 0 && GetPVarFloat(playerid,"zposSet") != 0) {
  688.                 new Float:MAX_DISTANCE = MAX_DISTANCE_DEF;
  689.  
  690.                 pX = GetPVarFloat(playerid,"xposSet") - pX;
  691.                 pY = GetPVarFloat(playerid,"yposSet") - pY;
  692.                 pZ = GetPVarFloat(playerid,"zposSet") - pZ;
  693.  
  694.                 if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID) {
  695.                     MAX_DISTANCE = 7.0;
  696.                 }
  697.                 if((pX > MAX_DISTANCE || pX < -MAX_DISTANCE) || (pY > MAX_DISTANCE || pY < -MAX_DISTANCE) || (pZ > MAX_DISTANCE || pZ < -MAX_DISTANCE)) {
  698.                     if((gettime() - GetPVarInt(playerid, #tPosSet)) > 3 && GetPVarInt(playerid,"pSpawned")) {
  699.                         GetPlayerPos(playerid, pX, pY, pZ);
  700.                         SetTimerEx("checkPos_pB", 500, false, "ifff", playerid, pX, pY, pZ);
  701.                     }
  702.                 }
  703.                 MAX_DISTANCE = MAX_DISTANCE_DEF;
  704.             }
  705.  
  706.             GetPlayerPos(playerid, pX, pY, pZ);
  707.  
  708.             SetPVarFloat(playerid,"xposSet", pX);
  709.             SetPVarFloat(playerid,"yposSet", pY);
  710.             SetPVarFloat(playerid,"zposSet", pZ);
  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, #registerScore)) {
  734.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SCORE_HACK);
  735.             SetPlayerScore(playerid, GetPVarInt(playerid, #registerScore));
  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, #registerMoney)) {
  747.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_MONEY_HACK);
  748.             GivePlayerMoney(playerid, (ResetPlayerMoney(playerid), GetPVarInt(playerid, #registerMoney)));
  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, pX, pY, pZ);
  761.             if(floatround(floatsqroot(floatadd(floatpower(pX, 2), floatpower(pY, 2))) * 200) > 100) {
  762.                 if(!(GetPVarInt(playerid, #WarnsSpeed) % 50)) {
  763.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_PSPEED_HACK);
  764.                 }
  765.                 SetPVarInt(playerid, #WarnsSpeed, (GetPVarInt(playerid, #WarnsSpeed) + 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[2];
  778.         for(new w; w != 13; ++w) {
  779.             GetPlayerWeaponData(playerid, w, wSlot[0], wSlot[1]);
  780.             if(GetPVarInt(playerid, getSlotID_pB(w)) != wSlot[0] && wSlot[0] && wSlot[0] < 47) {
  781.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_WEAPON_HACK);
  782.                 SetPVarInt(playerid, getSlotID_pB(w), wSlot[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[3];
  795.         GetPlayerKeys(playerid, pKey[0], pKey[1], pKey[2]);
  796.         if(isPlayerAiming_pB(playerid) && ((pKey[0] & KEY_FIRE) == KEY_FIRE || (pKey[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") && !IsPlayerInAnyVehicle(playerid)) {
  798.                 SetPVarInt(playerid, #keyWarns, (GetPVarInt(playerid, #keyWarns) + 1));
  799.                 if(!(GetPVarInt(playerid, #keyWarns) % 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, #keyWarns, 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, #registerMoney, GetPlayerMoney(playerid));
  843.         SetPVarInt(playerid, #registerScore, GetPlayerScore(playerid));
  844.     }
  845.     return (pOPU ? CallLocalFunction("ExOnPlayerUpdate", "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 ExOnPlayerUpdate
  855. forward ExOnPlayerUpdate(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, #registerState)) < 2 && (gettime() - GetPVarInt(playerid, #tPosSet)) > 3) {
  869.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_STATE_HACK);
  870.         }
  871.         SetPVarInt(playerid, #registerState, gettime());
  872.     }
  873.     SetPVarInt(playerid, #spiderCar, 0);
  874.     return (pOPSC ? CallLocalFunction("ExOnPlayerStateChange", "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 ExOnPlayerStateChange
  884. forward ExOnPlayerStateChange(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, g_ucPos[0], g_ucPos[1], g_ucPos[2]);
  897.  
  898.     if(IsPlayerInRangeOfPoint(playerid, 1.0, g_ucPos[0], g_ucPos[1], g_ucPos[2])) {
  899.         GetVehicleZAngle(vehicleid, g_ucPos[3]);
  900.         if(g_diferencasAngle[vehicleid] != g_ucPos[3]) {
  901.             if(!IsPlayerInAnyVehicle(playerid)) {
  902.                 GetPlayerPos(vehicleid, g_ucPos[1], g_ucPos[1], g_ucPos[3]);
  903.                 if(g_ucPos[3] > g_ucPos[2]) {
  904.                     SetPVarInt(playerid, #registrosUAF, GetPVarInt(playerid, #registrosUAF) +1);
  905.                     if(GetPVarInt(playerid, #registrosUAF) > 40) {
  906.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SURF_VEHICLE);
  907.                     }
  908.                 }
  909.             }
  910.         }
  911.         g_diferencasAngle[vehicleid] = g_ucPos[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, g_ucPos[0], g_ucPos[1], g_ucPos[2])) {
  924.         if(!IsPlayerInAnyVehicle(playerid) && (gettime() - GetPVarInt(playerid, #tPosSet) > 3) && !vehRespawn[vehicleid]) {
  925.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CAR_TELEPORT);
  926.         } else if(vehRespawn[vehicleid]) vehRespawn[vehicleid] = false;
  927.     }
  928.     return (pOUVU ? CallLocalFunction("ExOnUnoccupiedVehicleUpdate", "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 ExOnUnoccupiedVehicleUpdate
  938. forward ExOnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat);
  939.  
  940. pFunction checkPos_pB(i, Float: pX, Float: pY, Float: pZ) {
  941.     if(gettime() - GetPVarInt(i, #airBreakSet) < 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, pX, pY, pZ)) {
  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, #airBreakSet, gettime());
  967.     }
  968.     return true;
  969. }
  970.  
  971. pFunction verifBugger_pB(playerid) {
  972.     new Float: x, Float: y, Float: z;
  973.     GetPlayerPos(playerid, x, y, z);
  974.     if(x > 0xdbb9f && y > 0xdbb9f && z > 0xdbb9f) SetPlayerPos(playerid, GetPVarFloat(playerid,"xposSet"),  GetPVarFloat(playerid,"yposSet"),  GetPVarFloat(playerid,"zposSet"));
  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, #jogadorDisponivel, 1);
  995.     if(IsPlayerConnected(playerid) && GetPlayerPing(playerid)  == 0xFFFF) {
  996.         static tmpip[20];
  997.         GetPlayerIp(playerid, tmpip, 20);
  998.         if(0x1c5 > (gettime() - varGet(tmpip))) {
  999.             tmpip[(strlen(tmpip) - 1)] = 'x';
  1000.             if(varGet(tmpip) > 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 registrarJogador_pB(playerid) {
  1012.     static tmpip[20];
  1013.  
  1014.     g_diferencasAngle[playerid] = 0;
  1015.     GetPlayerIp(playerid, tmpip, 20);
  1016.     varSet(tmpip, gettime()); ++connect;
  1017.  
  1018.     if(connect == MAX_PLAYERS - 1) {
  1019.         for(connect = 0; databaseIP[connect][0]; connect++) continue;
  1020.     }
  1021.     SetTimerEx("resetBot_pB", 50000, false, "i", connect);
  1022.  
  1023.     tmpip[strlen(tmpip)-1] = 'x';
  1024.     format(databaseIP[connect], 20, tmpip);
  1025.     varSet(tmpip, varGet(tmpip) +1);
  1026.  
  1027.     SetPVarInt(playerid, #tPosSet, gettime());
  1028.     return SetTimerEx("registerBot_pB", 700, false, #i , playerid);
  1029. }
  1030.  
  1031. pFunction resetBot_pB(botid) {
  1032.     varSet(databaseIP[botid], 0);
  1033.     return databaseIP[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