Advertisement
ipsBruno

(Pawn) bpProteção. Anti Hacking

Jun 27th, 2012
2,632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 35.81 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. //
  4. //        #### ########   ######     ######## ########    ###    ##     ##
  5. //         ##  ##     ## ##    ##       ##    ##         ## ##   ###   ###
  6. //         ##  ##     ## ##             ##    ##        ##   ##  #### ####
  7. //         ##  ########   ######        ##    ######   ##     ## ## ### ##
  8. //         ##  ##              ##       ##    ##       ######### ##     ##
  9. //         ##  ##        ##    ##       ##    ##       ##     ## ##     ##
  10. //        #### ##         ######        ##    ######## ##     ## ##     ##
  11. //
  12. //
  13. //          Por Bruno da Silva (iPs DraKiNs) e  PauloTerroR (iPs Paulo)
  14. //
  15. //          Acesse meu blog sobre programação www.brunodasilva.com
  16. //
  17. //
  18. //      -----------------------------------
  19. //
  20. //          Detectar:
  21. //          bots,
  22. //          ataques ddos
  23. //          fake kill
  24. //          player surf vehicle (cleo)
  25. //          player car teleport
  26. //          player car teleport
  27. //          car teleport player
  28. //          player state hack (player push/get cars)
  29. //          weapon hack
  30. //          ammo hack
  31. //          no reload hack
  32. //          freeze hack
  33. //          score hack
  34. //          hack
  35. //          ofensa
  36. //          flood
  37. //          spam
  38. //          publicação
  39. //          teleport
  40. //          air break
  41. //          high ping
  42. //          anti spider car hack,
  43. //          cprace hack
  44. //          speed hack
  45. //          fly hack
  46. //          anti god mode
  47. //          sync lag shoot
  48. //          armour hack
  49. //         
  50. //
  51. //
  52. //      ------------------------------------
  53. //
  54. //                 www.brunodasilva.com
  55. //
  56. //              Ingresse também na [iPs]TeaM
  57. //              wwww.ips-team.forumeiros.com
  58. //
  59. //////////////////////////////////////////////////////////////////////////////////
  60.  
  61. #if defined _ALS_OnPlayerConnect
  62. #undef OnPlayerConnect
  63. #else
  64. #define _ALS_OnPlayerConnect
  65. #endif
  66.  
  67.  
  68. #if defined _ALS_OnPlayerDisconnect
  69. #undef OnPlayerDisconnect
  70. #else
  71. #define _ALS_OnPlayerDisconnect
  72. #endif
  73.  
  74. #if defined _ALS_OnPlayerUpdate
  75. #undef OnPlayerUpdate
  76. #else
  77. #define _ALS_OnPlayerUpdate
  78. #endif
  79.  
  80. #if defined _ALS_OnUnoccupiedVehicleUpdate
  81. #undef OnUnoccupiedVehicleUpdate
  82. #else
  83. #define _ALS_OnUnoccupiedVehicleUpdate
  84. #endif
  85.  
  86. #if defined _ALS_OnPlayerStateChange
  87. #undef OnPlayerStateChange
  88. #else
  89. #define _ALS_OnPlayerStateChange
  90. #endif
  91.  
  92.  
  93. //#if defined _ALS_OnPlayerEnterRaceCheckpoint
  94. //    #undef OnPlayerEnterRaceCheckpoint
  95. //#else
  96. //    #define _ALS_OnPlayerEnterRaceCheckpoint
  97. //#endif
  98.  
  99. #if defined _ALS_OnPlayerDeath
  100. #undef OnPlayerDeath
  101. #else
  102. #define _ALS_OnPlayerDeath
  103. #endif
  104.  
  105. #if defined _ALS_OnPlayerGiveDamage
  106. #undef OnPlayerGiveDamage
  107. #else
  108. #define _ALS_OnPlayerGiveDamage
  109. #endif
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. enum {
  117.     // Anti DDos Bots
  118.     PLAYER_BOT_LEVEL3,
  119.     PLAYER_BOT_LEVEL2,
  120.     PLAYER_BOT_LEVEL1,
  121.  
  122.     // Anti Cleo4 Fake-kill
  123.     PLAYER_DEATHFLOOD_LEVEL3,
  124.     PLAYER_DEATHFLOOD_LEVEL2,
  125.     PLAYER_DEATHFLOOD_LEVEL1,
  126.  
  127.     // Anti Bug Cars
  128.     PLAYER_SURF_VEHICLE,
  129.     PLAYER_CAR_TELEPORT,
  130.     PLAYER_STATE_HACK,
  131.  
  132.     // Ammo Weapon
  133.     PLAYER_NORELOAD_HACK,
  134.     PLAYER_WEAPON_HACK,
  135.     PLAYER_AMMO_HACK,
  136.  
  137.  
  138.     // hackings
  139.     PLAYER_FREEZE_HACK,
  140.     PLAYER_SCORE_HACK,
  141.     PLAYER_MONEY_HACK,
  142.  
  143.     // Text Chat
  144.     PLAYER_PUBLISH_TEXT,
  145.     PLAYER_OFFEND_TEXT,
  146.     PLAYER_FLOOD_TEXT,
  147.  
  148.     // pos cheat
  149.     PLAYER_TELEPORT_HACK,
  150.     PLAYER_AIRBREAK_HACK,
  151.  
  152.     // outros
  153.     PLAYER_HIGH_PING,
  154.     PLAYER_SPIDER_HACK,
  155.     PLAYER_CPRACE_HACK,
  156.     PLAYER_SPEED_HACK,
  157.     PLAYER_FLY_HACK
  158. }
  159.  
  160.  
  161. new connect = -1;
  162. new Float:g_ucPos[4];
  163. new databaseIP[MAX_PLAYERS][20];
  164. new Float:g_diferencasAngle[MAX_VEHICLES];
  165. new vehVelocity[MAX_VEHICLES];
  166. new scoreMoneyDelay[MAX_PLAYERS];
  167.  
  168. stock resetBot(o);
  169. stock registerBot(p);
  170. stock registrarJogador(playerid);
  171.  
  172. forward OnPlayerHacking(playerid, hackid);
  173.  
  174. #define INVALID_CHAT_BLOCK
  175.  
  176. #define MAX_STRING_CHAT     (0128)
  177.  
  178. #define SERVER_SIDE_DELAY   (0002)
  179.  
  180. #define MAX_DISTANCE_DEF    (83.1)
  181.  
  182. #define MAX_PING            (0800)
  183.  
  184. #define DELAY_PVAR  3
  185.  
  186.  
  187. // =============================================================================
  188. //
  189. // OBSERVAÇõES IMPORTANTES:
  190.  
  191. // #define INVALID_CHAT_BLOCK
  192. // Em caso de não quiser bloquear o texto em caso de texto inválido
  193. // Texto inválido, spam, flood, palavreado, ofensa, publicação. etc
  194.  
  195. // Ping acima de 1 segundo (1000 ms) poderá ocorrer graves problemas de precisão no anti cheater.
  196. // Em caso de ping muito elevado aconselha-se o uso de SERVER_SIDE_DELAY elevado para maior precisão
  197.  
  198. // SERVER_SIDE_DELAY equivale ao tempo de delay entre o uso de uma função registrada
  199. // que influencia no detectamento do anti cheater. Aconselhável 1 a 5 segundos.
  200. // Dependendo da conexão do servidor você coloca maior delay ou menor dealay
  201.  
  202. // MAX_DISTANCE_DEF é essencial para busca e detecção de anti-teleport e air break
  203. // O número padrão foi calculado e não houve bugs por parte do sistema
  204. // A única coisa que pode influenciar será o sistema de SetPlayerPos. Mas o SERVER_SIDE_DELAY supriu isto com precisão
  205.  
  206. // Este sistema apenas detecta cheaters. É aconselhavél a checagem de um administrador real antes de aplicar o banimento.
  207.  
  208. // ========================================================================================================
  209.  
  210.  
  211.  
  212.  
  213. #define Hook%0(%1)  stock %0_Ex(%1)
  214.  
  215. // ---------------------------------------------
  216. //  Nesta parte aparecem funções hookeadas
  217. //  Elas são essenciais para ter controle server-side detalhado
  218. //  Essencial para qualquer anti-hack. Controle minucioso
  219. //  Para o funcionamento disto precisa do filterscript
  220. //  Hookei apenas as mais importantes callbacks nativas da sa:mp.
  221. //  Daria muito trabalho "hookear" todas
  222. // ---------------------------------------------
  223.  
  224.  
  225. Hook GivePlayerMoney(playerid, value) {
  226.     scoreMoneyDelay[playerid] = gettime();
  227.     return SetPVarInt(playerid, #registerMoney, GetPVarInt(playerid, #registerMoney) + value), GivePlayerMoney(playerid, value);
  228. }
  229.  
  230. Hook SetPlayerScore(playerid, value){
  231.     scoreMoneyDelay[playerid] = gettime();
  232.     return SetPVarInt(playerid, #registerScore, value), SetPlayerScore(playerid, value);
  233. }
  234.  
  235. Hook PutPlayerInVehicle(playerid,vehicleid,seatid) {
  236.     return SetPVarInt(playerid, #registerState, gettime()-SERVER_SIDE_DELAY), PutPlayerInVehicle(playerid, vehicleid, seatid);
  237. }
  238.  
  239. Hook SetVehicleVelocity(playerid,Float:x,Float:y,Float:z) {
  240.     return vehVelocity[playerid] = gettime(), SetVehicleVelocity(playerid, x, y, z);
  241. }
  242.  
  243. Hook SetPlayerPos(playerid,Float:x,Float:y,Float:z) {
  244.     return SetPVarInt(playerid,"tposSet", gettime()), SetPlayerPos(playerid, x, y, z);
  245. }
  246.  
  247. Hook GivePlayerWeapon(playerid, weaponid, ammo) {
  248.     return SetPVarInt(playerid, getSlotID(GetWeaponSlot(weaponid)), weaponid), SetPVarInt(playerid, #Ammo, ammo), SetPVarInt(playerid, #Weapon, weaponid), GivePlayerWeapon(playerid, weaponid, ammo);
  249. }
  250.  
  251. Hook ResetPlayerWeapons(playerid) {
  252.     for(new i; i != 13; ++i) SetPVarInt(playerid, getSlotID(i), 0);
  253.     return ResetPlayerWeapons(playerid);
  254. }
  255.  
  256. Hook TogglePlayerC(playerid, bool:control)
  257. {
  258.  
  259.     if(control) {
  260.  
  261.         static Float:x, Float:y, Float:z;
  262.  
  263.         GetPlayerPos(playerid,x, y, z);
  264.         SetPVarFloat(playerid,"xposControll", x),
  265.         SetPVarFloat(playerid,"yposControll", y),
  266.         SetPVarFloat(playerid,"zposControll", z);
  267.  
  268.         TogglePlayerControllable(playerid, true);
  269.     }
  270.     else {
  271.         SetPVarFloat(playerid,"xposControll", 0.0);
  272.         SetPVarFloat(playerid,"yposControll", 0.0);
  273.         SetPVarFloat(playerid,"zposControll", 0.0);
  274.  
  275.         TogglePlayerControllable(playerid, false);
  276.     }
  277.  
  278.     return SetPVarInt(playerid, "PlayerControllable", _:!control);
  279. }
  280.  
  281. Hook SetPlayerHealth(playerid, Float:health) {
  282.     return SetPVarFloat(playerid,"healthServerside", health), SetPlayerHealth(playerid, health);
  283. }
  284.  
  285. Hook SetPlayerArmour(playerid, Float:armour) {
  286.     return SetPVarFloat(playerid,"armourServerside", armour), SetPlayerArmour(playerid, armour);
  287. }
  288.  
  289. IsPlayerInWater(playerid) { //Coords By Synchro
  290.     static Float:fX, Float:fY, Float:fZ; GetPlayerPos(playerid, fX, fY, fZ);
  291.     if((fX >= 2044.6 && fX <= 2192.984 && fY >= 1206.358 && fY <= 1376.552) && fZ < 0xA) return 1;
  292.     else if((fX >= 2048.504 && fX <= 2185.174 && fY >= 1063.239 && fY <= 1202.49) && fZ < 0xA) return 1;
  293.     else if((fX >= 2204.698 && fX <= 2204.698 && fY >= 1426.837 && fY <= 1430.705) && fZ < 0xA) return 1;
  294.     else if((fX >= 2032.885 && fX <= 2114.887 && fY >= 1852.325 && fY <= 1991.575) && fZ < 0xC) return 1;
  295.     else if((fX >= 2517.086 && fX <= 2606.897 && fY >= 2316.493 && fY <= 2420.93) && fZ < 0x16) return 1;
  296.     else if((fX >= 2554.5996 && fX <= 2507.7683 && fY >= 1548.6178 && fY <= 1588.9154) && fZ < 0xF) return 1;
  297.     else if((fX >= -2043.628 && fX <= -1973.561 && fY >= -980.9415 && fY <= -724.0283) && fZ < 0x20) return 1;
  298.     else if((fX >= -2753.912 && fX <= -2665.071 && fY >= -522.3632 && fY <= -380.3444) && fZ < 0x05) return 1;
  299.     else if((fX >= 1219.864 && fX <= 1292.118 && fY >= -2435.881 && fY <= -2325.344) && fZ < 0xF) return 1;
  300.     else if((fX >= 1923.388 && fX <= 2010.854 && fY >= -1223.924 && fY <= -1168.656) && fZ < 0x16) return 1;
  301.     else if((fX >= 1269.301 && fX <= 1314.935 && fY >= -837.0452 && fY <= -781.7769) && fZ < 0x5A) return 1;
  302.     else if((fX >= 1087.3953 && fX <= 1102.3138 && fY >= -682.6734 && fY <= -663.0043) && fZ < 0x71) return 1;
  303.     else if((fX >= 1268.6118 && fX <= 1291.8774 && fY >= -784.2910 && fY <= -764.6104) && fZ < 0x43D) return 1;
  304.     else if(fZ < 0xF) return 1;
  305.     return 0;
  306. }
  307.  
  308. IsPlayerUsingSwimAnim(playerid) { // By Synchro
  309.     if(IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 0;
  310.     static animlib[32], animname[32];
  311.     GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
  312.     if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_GLIDE", true)) return 1;
  313.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_BREAST", true)) return 1;
  314.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_CRAWL", true)) return 1;
  315.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_UNDER", true)) return 1;
  316.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_DIVE_GLIDE", true)) return 1;
  317.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_UNDER", true)) return 1;
  318.     else if(!strcmp(animlib, "SWIM", true) && !strcmp(animname, "SWIM_TREAD", true)) return 1;
  319.     return 0;
  320. }
  321.  
  322. armaBranca(armaid) { // bruno s
  323.     switch(armaid) {
  324.         case 16,17,18,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42: return false;
  325.     }
  326.     return true;
  327. }
  328.  
  329. getSlotID(i) { // Paulor
  330.     static stringSlot[12];
  331.     return format(stringSlot, 12, "WHSlot%i", i), stringSlot;
  332. }
  333.  
  334.  
  335. GetWeaponSlot(weaponid) { // paulor
  336.     if(weaponid >= 0 && weaponid < 2) return 0;
  337.     else if(weaponid > 1 && weaponid < 10) return 1;
  338.     else if(weaponid > 21 && weaponid < 25) return 2;
  339.     else if(weaponid > 24 && weaponid < 28) return 3;
  340.     else if(weaponid > 27 && weaponid < 30 || weaponid == 32) return 4;
  341.     else if(weaponid > 29 && weaponid < 32) return 5;
  342.     else if(weaponid > 32 && weaponid < 35) return 6;
  343.     else if(weaponid > 34 && weaponid < 39) return 7;
  344.     else if(weaponid > 15 && weaponid < 19 || weaponid == 39) return 8;
  345.     else if(weaponid > 40 && weaponid < 44) return 9;
  346.     else if(weaponid > 9 && weaponid < 16) return 10;
  347.     else if(weaponid > 43 && weaponid < 47) return 11;
  348.     else if(weaponid == 40) return 12;
  349.     return -1;
  350. }
  351.  
  352. GetPlayerSpeedANTIHACK(playerid)
  353. {
  354.     static
  355.     Float:ST[3]
  356.     ;
  357.  
  358.     GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
  359.  
  360.     return floatround(floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 155.0);
  361. }
  362.  
  363. GivePlayerHealthArmor(playerid, Float:ammount) {
  364.  
  365.     static
  366.     Float:health,
  367.     Float:armour;
  368.  
  369.     GetPlayerHealth(playerid, health);
  370.     GetPlayerArmour(playerid, armour);
  371.  
  372.     armour += health + (ammount);
  373.  
  374.     if(armour > 100.0) {
  375.         SetPlayerArmour(playerid, armour - 100.0);
  376.         SetPlayerHealth(playerid, 100.0);
  377.     }
  378.     else {
  379.         SetPlayerHealth(playerid, armour);
  380.     }
  381.  
  382.     return true;
  383.  
  384. }
  385.  
  386. ///////////////////////////////////////////////////////////////////////////////
  387.  
  388. #if !defined varGet
  389. #define varGet(%0)  getproperty(0,%0)
  390. #endif
  391.  
  392. #if !defined varSet
  393. #define varSet(%0,%1) setproperty(0, %0, %1)
  394. #endif
  395.  
  396.  
  397. ///////////////////////////////////////////////////////////////////////////////
  398.  
  399.  
  400.  
  401. public OnPlayerConnect(playerid) {
  402.  
  403.     registrarJogador(playerid);
  404.     return CallLocalFunction("ExOnPlayerConnect", "i", playerid);
  405. }
  406.  
  407.  
  408.  
  409. #define OnPlayerConnect ExOnPlayerConnect
  410.  
  411. forward ExOnPlayerConnect(playerid) ;
  412.  
  413. //
  414.  
  415.  
  416. public OnGameModeInit() {
  417.     // nesta parte todos jogadores serão chamados caso houver RELOADFs
  418.  
  419.     for(new i; i != MAX_PLAYERS; i++) if(IsPlayerConnected(i)) registrarJogador(i);
  420.  
  421.     return CallLocalFunction("Ex_OnGameModeInit", "");
  422. }
  423.  
  424.  
  425. #define OnGameModeInit Ex_OnGameModeInit
  426. forward Ex_OnGameModeInit();
  427.  
  428.  
  429. public OnPlayerDisconnect(playerid, reason) {
  430.     // Não retire está parte. Isto serve para não enviar mensagens de desconecção quando o player é bot ddos
  431.     if(GetPVarInt(playerid, #jogadorDisponivel)) return false;
  432.     return CallLocalFunction("ExOnPlayerText", "is", playerid, reason);
  433. }
  434.  
  435.  
  436.  
  437. #define OnPlayerDisconnect ExOnPlayerDisconnect
  438.  
  439. forward ExOnPlayerDisconnect(playerid,reason) ;
  440.  
  441. ////////////////////////////////////////////////////////////////////////////////
  442.  
  443.  
  444.  
  445. new const palavreado[][24] = {
  446.     "daputa","babaca","baitola","piranha","bicha","bichona","biscat","bitch","bix", "boiola","boiolona","buceta","bucetudo","cuzona","bund","burr","fude","cacet",
  447.     "viad","caral","vadi","carai","rola","chup","idiot","corno","nocu","eucu""ocu","cusa","cusi","cuza","cuzinho","piroca","embecil","fdp","foda",
  448.     "fode","fuck","fud","hetard","homo","imbess","jegu","kacet","karai","karaleo","kct","kral", "krl","noku","lasarent","lazarent","mula","otari","pnc","pereb","penis","pint","prosti","punhet",
  449.     "put","retardado","tnc","viad","viadi","vsf","vtnc","sobe","vogelz","baranga", "vagab","broxa","ignorant","comed",
  450.     "ejacu","prosti","cachorr", "surub","peni","chup","pau","viad","perere", "bucet","bicha.","bixa","gay","desgra", "troxa", "tomanocu", "seucu"
  451. };
  452.  
  453. public OnPlayerText(playerid, text[])
  454. {
  455.  
  456.     /*--------------------------------------------------
  457.     *
  458.     *  Anti Publicação de IP Inteligente
  459.     *   Usando OnPlayerText com manipulação de strings e outros
  460.     *   A precisão deste sistema está em torno de 95%
  461.     *
  462.     * Detecta: 127.0.0.1 | 1 2    7 .   0  0 1 etc
  463.     -------------------------------------------------*/
  464.  
  465.     static szText[MAX_STRING_CHAT], numerosNochat, j;
  466.  
  467.     numerosNochat = -1, j = 0, szText[0] = EOS;
  468.  
  469.     for(new i; text[i]; i++) {
  470.  
  471.         if(text[i] >= '0' && '9' >= text[i]) {
  472.             numerosNochat ++ ;
  473.             if(numerosNochat >= 8) {
  474.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_PUBLISH_TEXT);
  475.                 #if defined INVALID_CHAT_BLOCK
  476.                 return false;
  477.                 #else
  478.                 break;
  479.                 #endif
  480.             }
  481.         }
  482.  
  483.         switch(text[i]) {
  484.             case '0':{ szText[j] = 'o'; j++; continue; }
  485.             case '1':{ szText[j] = 'i'; j++; continue; }
  486.             case '2':{ szText[j] = 'z'; j++; continue; }
  487.             case '3':{ szText[j] = 'e'; j++; continue; }
  488.             case '4':{ szText[j] = 'a'; j++; continue; }
  489.             case '5':{ szText[j] = 's'; j++; continue; }
  490.             case '6':{ szText[j] = 'g'; j++; continue; }
  491.             case '7':{ szText[j] = 't'; j++; continue; }
  492.             case '8':{ szText[j] = 'b'; j++; continue; }
  493.             case 65 .. 90, 97 .. 122: { szText[j] = tolower(text[i]); j++; continue; }
  494.         }
  495.     }
  496.  
  497.     /*--------------------------------------------------
  498.     *
  499.     *  Anti Palavreado Inteligente
  500.     *   Usando OnPlayerText com manipulação de strings e outros
  501.     *   A precisão deste sistema está em torno de 85%
  502.     *
  503.     * Detecta: buceta, b - u c |e t-a, buc 3 7 4 etc
  504.     -------------------------------------------------*/
  505.  
  506.     for(new i = 0; i < sizeof(palavreado); i++) {
  507.         if(strfind(szText, palavreado[i], false) != -1) {
  508.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_OFFEND_TEXT);
  509.  
  510.             #if defined INVALID_CHAT_BLOCK
  511.             return false;
  512.             #else
  513.             break;
  514.             #endif
  515.         }
  516.     }
  517.  
  518.     /*--------------------------------------------------
  519.     *
  520.     *  Anti Flood
  521.     *   Usando OnPlayerText com gettime e outros
  522.     *   A precisão deste sistema está em torno de 95%
  523.     *
  524.     -------------------------------------------------*/
  525.  
  526.     if(gettime() - GetPVarInt(playerid, #floodChat) < 3) {
  527.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FLOOD_TEXT);
  528.         #if defined INVALID_CHAT_BLOCK
  529.         return false;
  530.         #endif
  531.     }
  532.  
  533.     SetPVarInt(playerid, #floodChat, gettime());
  534.    
  535.     if(funcidx("ExOnPlayerText") != -1) {
  536.         CallLocalFunction("ExOnPlayerText", "is", playerid, text);
  537.     }
  538.    
  539.     return true;
  540. }
  541.  
  542. #define OnPlayerText ExOnPlayerText
  543.  
  544. forward ExOnPlayerText(playerid,text[]);
  545.  
  546.  
  547.  
  548. public resetBot(o)
  549. {
  550.     varSet(databaseIP[o],0);
  551.     return databaseIP[o][0] = EOS;
  552. }
  553.  
  554.  
  555. public registerBot(p)
  556. {
  557.  
  558.     /*--------------------------------------------------
  559.     *
  560.     *  Anti DDos Bots
  561.     *   Usando GetPlayerPing/OnPlayerConnect com gettime e outros
  562.     *   A precisão deste sistema está dividido em partes
  563.     *
  564.     *  PLAYER_BOT_LEVEL1 -> 70%
  565.     *  PLAYER_BOT_LEVEL2 -> 90%
  566.     *  PLAYER_BOT_LEVEL3 -> 100%
  567.     *
  568.     *
  569.     -------------------------------------------------*/
  570.  
  571.     if(GetPlayerPing(p) != 0xffff && GetPlayerPing(p)  != 0) SetPVarInt(p, #jogadorDisponivel, 1);
  572.     if(IsPlayerConnected(p) && GetPlayerPing(p)  == 0xffff) {
  573.         static tmpip[20];
  574.         GetPlayerIp(p, tmpip, 20);
  575.         if(0x1c5 > gettime() - varGet(tmpip)) {
  576.             tmpip[strlen(tmpip)-1] = 'x';
  577.             if(varGet(tmpip) > 3) {
  578.                 return CallLocalFunction("OnPlayerHacking", "ii", p, PLAYER_BOT_LEVEL3);
  579.             }
  580.             CallLocalFunction("OnPlayerHacking", "ii", p, PLAYER_BOT_LEVEL2);
  581.         }
  582.         CallLocalFunction("OnPlayerHacking", "ii", p, PLAYER_BOT_LEVEL1);
  583.         SetTimerEx("registerBot", 700, false, #i , p);
  584.     }
  585.     return false;
  586. }
  587.  
  588.  
  589.  
  590. public registrarJogador(playerid)
  591. {
  592.     static tmpip[20];
  593.  
  594.     g_diferencasAngle[playerid] = 0;
  595.     GetPlayerIp(playerid, tmpip, 20);
  596.     varSet(tmpip, gettime()); ++connect;
  597.  
  598.     if(connect == MAX_PLAYERS - 1) {
  599.         for(connect = 0; databaseIP[connect][0]; connect++) continue;
  600.     }
  601.     SetTimerEx("resetBot", 50000, false, "i", connect);
  602.  
  603.     tmpip[strlen(tmpip)-1] = 'x';
  604.     format(databaseIP[connect], 20, tmpip);
  605.     varSet(tmpip, varGet(tmpip) +1);
  606.  
  607.     SetTimerEx(#pdataCheck, 1000, true, "i", playerid);
  608.     return SetTimerEx("registerBot", 700, false, #i , playerid);
  609. }
  610.  
  611.  
  612.  
  613. /*
  614.  
  615. -------------------- DEBUG ----------------------------
  616.  
  617. public OnPlayerCommandText(playerid, cmdtext[])
  618. {
  619.  
  620.     if(cmdtext[1] == 'h') {
  621.         static Float:x,Float:y,Float:z;
  622.         GetPlayerPos(playerid, x,y,z);
  623.         PutPlayerInVehicle(playerid, CreateVehicle(411, x,y,z, 82.2873, 0, 1, 60), 0);
  624.         return true;
  625.     }
  626.     if(cmdtext[1] == 'w') {
  627.         GivePlayerWeapon(playerid, 26, 500);
  628.         GivePlayerWeapon(playerid, 32, 500);
  629.         GivePlayerWeapon(playerid, 36, 500);
  630.         GivePlayerWeapon(playerid, 16, 500);
  631.         return true;
  632.     }
  633.  
  634.     if(cmdtext[1] == 't' && cmdtext[2] == 't') {
  635.         TogglePlayerControllable(playerid, true);
  636.         return true;
  637.     }
  638.     if(cmdtext[1] == 't' && cmdtext[2] == 'f') {
  639.         TogglePlayerControllable(playerid, false);
  640.         return true;
  641.     }
  642.  
  643.     if(cmdtext[1] == 'g') {
  644.         GivePlayerMoney(playerid, 5000);
  645.         return true;
  646.     }
  647.     if(cmdtext[1] == 's') {
  648.         SetPlayerScore(playerid, 5000);
  649.         return true;
  650.     }
  651.  
  652.     return false;
  653. }
  654.  
  655. #if defined _ALS_OnPlayerCommandText
  656. #undef OnPlayerCommandText
  657. #else
  658. #define _ALS_OnPlayerCommandText
  659. #endif
  660.  
  661. #define OnPlayerCommandText ExOnPlayerCommandText
  662.  
  663. forward ExOnPlayerCommandText(playerid,cmdtext[]) ;
  664.  
  665. ------------------------------------------------------------
  666.  
  667. */
  668.  
  669. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
  670. {
  671.     if(damagedid != INVALID_PLAYER_ID) {
  672.         if(GetPlayerTeam(playerid) != GetPlayerTeam(damagedid)) {
  673.             GivePlayerHealthArmor(damagedid, -amount);
  674.         }
  675.     }
  676.     return CallLocalFunction("ExOnPlayerGiveDamage", "iifi", playerid, damagedid, Float:amount, weaponid);
  677. }
  678.  
  679. #define OnPlayerGiveDamage ExOnPlayerGiveDamage
  680.  
  681. forward ExOnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
  682.  
  683.  
  684. public OnPlayerDeath(playerid,killerid,reason)
  685. {
  686.  
  687.     /*--------------------------------------------------
  688.     *
  689.     *  Anti Fake Kill
  690.     *   Usando OnPlayerDeath com gettime e outros
  691.     *   A precisão deste sistema está dividido em partes
  692.     *
  693.     *  PLAYER_DEATHFLOOD_LEVEL1 -> 070%
  694.     *  PLAYER_DEATHFLOOD_LEVEL2 -> 090%
  695.     *  PLAYER_DEATHFLOOD_LEVEL3 -> 100%
  696.     *
  697.     *
  698.     -------------------------------------------------*/
  699.  
  700.     if(gettime() - GetPVarInt(playerid, #registerDeath) < 20) {
  701.         if(GetPVarInt(playerid, #registerValDeath) > 15) {
  702.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL1);
  703.         }
  704.         if(gettime() - GetPVarInt(playerid, #registerDeath) < 2) {
  705.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL2);
  706.         }
  707.         if(gettime() - GetPVarInt(playerid, #registerDeath) < 5) {
  708.             if(GetPVarInt(playerid, #registerValDeath) > 3) {
  709.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_DEATHFLOOD_LEVEL3);
  710.             }
  711.         }
  712.     }
  713.     SetPVarInt(playerid, #registerDeath, gettime());
  714.     SetPVarInt(playerid, #registerValDeath, GetPVarInt(playerid, #registerValDeath) +1);
  715.  
  716.     return CallLocalFunction("ExOnPlayerDeath", "i", playerid);
  717. }
  718.  
  719.  
  720. #define OnPlayerDeath ExOnPlayerDeath
  721.  
  722. forward ExOnPlayerDeath(playerid,killerid,reason);
  723.  
  724.  
  725.  
  726.  
  727. public OnVehicleMod(playerid,vehicleid,componentid)
  728. {
  729.     if(GetPlayerInterior(playerid) == 0) {
  730.         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CPRACE_HACK);
  731.     }
  732.     return CallLocalFunction("ExOnVehicleMod", "ddd", playerid, vehicleid, componentid);
  733. }
  734.  
  735. #define OnVehicleMod ExOnVehicleMod
  736.  
  737. forward ExOnVehicleMod(playerid,vehicleid,componentid);
  738.  
  739.  
  740. public OnPlayerEnterRaceCheckpoint(playerid) {
  741.     if(IsPlayerInAnyVehicle(playerid)) {
  742.         if(GetPlayerSpeedANTIHACK(playerid) == 0) {
  743.             if(GetPVarInt(playerid, #checkHack) > 3) {
  744.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CPRACE_HACK);
  745.                 SetPVarInt(playerid, #checkHack, 0);
  746.             }
  747.             SetPVarInt(playerid, #checkHack, GetPVarInt(playerid, #checkHack)+1);
  748.         }
  749.     }
  750.     return CallLocalFunction("ExEnterRaceCheckpoint", "i", playerid);
  751. }
  752.  
  753.  
  754. #define OnPlayerEnterRaceCheckpoint ExEnterRaceCheckpoint
  755.  
  756. forward ExOnPlayerEnterRaceCheckpoint(playerid);
  757.  
  758.  
  759.  
  760. public OnPlayerUpdate(playerid)
  761. {
  762.     if(!IsPlayerNPC(playerid)) {
  763.  
  764.         if(IsPlayerInAnyVehicle(playerid)) {
  765.  
  766.             /*--------------------------------------------------
  767.             *
  768.             *  Anti Speed Hack
  769.             *   Usando GetPlayerSpeedANTIHACK com variáveis
  770.             *   A precisão deste sistema fica em torno de 99%
  771.             *
  772.             -------------------------------------------------*/
  773.  
  774.             if(GetPVarInt(playerid, #checkSpeedtime)) {
  775.                 if(gettime() - GetPVarInt(playerid, #checkSpeedtime) > 1) {
  776.                     TogglePlayerControllable(playerid, true);
  777.                     SetPVarInt(playerid, "checkSpeedtime", 0);
  778.                 }
  779.             }
  780.             if(GetPlayerSpeedANTIHACK(playerid) > 290) {
  781.                 if(gettime() - vehVelocity[GetPlayerVehicleID(playerid)] > 10) {
  782.                     TogglePlayerControllable(playerid, false);
  783.                     SetPVarInt(playerid, "checkSpeedtime", gettime());
  784.                     return CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SPEED_HACK), true;
  785.                 }
  786.             }
  787.  
  788.             /*--------------------------------------------------
  789.             *
  790.             *  Anti Spider Car
  791.             *   Usando GetVehicleRotationQuat
  792.             *   A precisão deste sistema fica em torno de 75%
  793.             *
  794.             -------------------------------------------------*/
  795.  
  796.             static Float:w, Float:x, Float:y, Float:z;
  797.  
  798.             GetVehicleRotationQuat(GetPlayerVehicleID(playerid), w, x, y, z);
  799.  
  800.             w = atan2(2*((y*z)+(x*w)), (-(x*x) -(y*y) +(z*z) +(w*w)));
  801.  
  802.             // OBS: Inclinação de 5 graus. Construções mais inclinadas podem
  803.             // fazer o veículo inclinar mais. Mas para evitar falsos reports deixe mais ou menos este valor
  804.  
  805.             if((85.0 < w < 90.0) || (-85.0 > w > -90.0)) {
  806.                 SetPVarInt(playerid, #spiderCar, GetPVarInt(playerid, #spiderCar) +1);
  807.                 if(GetPVarInt(playerid, #spiderCar) > 40) {
  808.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SPIDER_HACK);
  809.                     SetPVarInt(playerid, #spiderCar, 0);
  810.                 }
  811.             }
  812.         }
  813.  
  814.         /*--------------------------------------------------
  815.         *
  816.         *  Anti Player Bugger
  817.         *   Usando GetPlayerPos com variáveis server sided
  818.         *   A precisão deste sistema fica em torno de 99%
  819.         *   Desbuga o jogador bugado e envia mensagem aos administradores
  820.         *
  821.         -------------------------------------------------*/
  822.  
  823.         static Float:x, Float:y,Float:z;
  824.         GetPlayerPos(playerid, x, y, z);
  825.  
  826.         if(x > 0xdbb9f && y > 0xdbb9f && z > 0xdbb9f) {
  827.             SendClientMessage(playerid, -1, "[Suspeita] Hacking de bugar jogadores detectado");
  828.             SetPlayerPos(playerid, GetPVarFloat(playerid,"xposSet"),  GetPVarFloat(playerid,"yposSet"),  GetPVarFloat(playerid,"zposSet"));
  829.         }
  830.  
  831.         /*--------------------------------------------------
  832.         *
  833.         *  Anti Freeze Hack
  834.         *   Usando GetPlayerPos com variáveis server sided
  835.         *   A precisão deste sistema fica em torno de 90%
  836.         *
  837.         -------------------------------------------------*/
  838.  
  839.         else {
  840.             // checar se realmente está está como MOVIMENTO FALSE
  841.             if(!GetPVarInt(playerid, "PlayerControllable")) {
  842.                 GetPlayerPos(playerid, x, y, z);
  843.  
  844.                 // Checar seus controle foram realmente bloqueados para diferentes de zero !
  845.  
  846.                 if(GetPVarFloat(playerid,"xposControll") && GetPVarFloat(playerid,"yposControll") && GetPVarFloat(playerid,"zposControll")) {
  847.                     if((GetPVarFloat(playerid,"xposControll") != x) ||  (GetPVarFloat(playerid,"yposControll") != y) || (GetPVarFloat(playerid,"zposControll") != z)) {
  848.  
  849.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FREEZE_HACK);
  850.  
  851.                         // liberar jogador
  852.                         SetPVarInt(playerid, "PlayerControllable", 1);
  853.                     }
  854.                 }
  855.             }
  856.  
  857.             GetPlayerPos(playerid, x, y, z);
  858.             if(GetPVarFloat(playerid,"xposSet") != 0 && GetPVarFloat(playerid,"yposSet") != 0 && GetPVarFloat(playerid,"zposSet") != 0) {
  859.                 new Float:MAX_DISTANCE = MAX_DISTANCE_DEF;
  860.  
  861.                 x = GetPVarFloat(playerid,"xposSet") - x;
  862.                 y = GetPVarFloat(playerid,"yposSet") - y;
  863.                 z = GetPVarFloat(playerid,"zposSet") - z;
  864.  
  865.                 if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID) {
  866.                     MAX_DISTANCE = 7.0;
  867.                 }
  868.                 if((x > MAX_DISTANCE || x < -MAX_DISTANCE ) || (y > MAX_DISTANCE  || y < -MAX_DISTANCE ) ||  (z > MAX_DISTANCE  || z < -MAX_DISTANCE )) {
  869.                     if(gettime() - GetPVarInt(playerid,"tposSet") > 2) {
  870.                         GetPlayerPos(playerid, x, y, z);
  871.                         SetTimerEx(#pCheckPos, 500, false, "ifff", playerid, x, y, z);
  872.                     }
  873.                 }
  874.                 MAX_DISTANCE = MAX_DISTANCE_DEF;
  875.             }
  876.  
  877.             GetPlayerPos(playerid, x, y, z);
  878.  
  879.             SetPVarFloat(playerid,"xposSet", x);
  880.             SetPVarFloat(playerid,"yposSet", y);
  881.             SetPVarFloat(playerid,"zposSet", z);
  882.         }
  883.  
  884.         /*--------------------------------------------------
  885.         *
  886.         *  Anti Ping Alto
  887.         *   Usando GetPlayerScore com variáveis server sided
  888.         *   A precisão deste sistema fica em torno de 90%
  889.         *
  890.         -------------------------------------------------*/
  891.  
  892.         if(GetPlayerPing(playerid) > MAX_PING) {
  893.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_HIGH_PING);
  894.         }
  895.  
  896.         /*--------------------------------------------------
  897.         *
  898.         *  Anti Score Hack
  899.         *   Usando GetPlayerScore com variáveis server sided
  900.         *   A precisão deste sistema fica em torno de 100%
  901.         *
  902.         -------------------------------------------------*/
  903.  
  904.         if(GetPlayerScore(playerid) > GetPVarInt(playerid, #registerScore)) {
  905.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SCORE_HACK);
  906.             SetPlayerScore(playerid, GetPVarInt(playerid, #registerScore));
  907.         }
  908.  
  909.         /*--------------------------------------------------
  910.         *
  911.         *  Anti Money Hack
  912.         *   Usando GetPlayerMoney com variáveis server sided
  913.         *   A precisão deste sistema fica em torno de 100%
  914.         *
  915.         -------------------------------------------------*/
  916.  
  917.         if(GetPlayerMoney(playerid) > GetPVarInt(playerid, #registerMoney)) {
  918.             if(gettime() - scoreMoneyDelay[playerid] > 3)
  919.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_MONEY_HACK);
  920.             GivePlayerMoney(playerid, (ResetPlayerMoney(playerid), GetPVarInt(playerid, #registerMoney)));
  921.         }
  922.  
  923.         static armaJogador;
  924.         armaJogador = GetPlayerWeapon(playerid);
  925.  
  926.         /*--------------------------------------------------
  927.         *
  928.         *  Anti No-Reload
  929.         *   Usando GetWeaponState e GetWeaponAmmo
  930.         *   A precisão deste sistema fica em torno de 90%
  931.         *
  932.         -------------------------------------------------*/
  933.  
  934.         static animacaoAtual[32];
  935.         GetAnimationName(GetPlayerAnimationIndex(playerid), animacaoAtual, 32, animacaoAtual, 32);
  936.  
  937.         // detectar se o jogador está atirando
  938.         if((strfind(animacaoAtual, "GUN_STAND", true) != -1 || strfind(animacaoAtual, "COLT45_FIRE", true) != -1)) {
  939.             // checar se não é arma branca ou se a ultima checagem ocorreu a pouco tempo | evita ocorrer bugs com armas re reload lento
  940.             if(!armaBranca(armaJogador) && (gettime() - GetPVarInt(playerid, #keyCheck)) > 1) {
  941.                 // geta as keys dele para ver se ele está realmente atirando
  942.                 static key[3]; GetPlayerKeys(playerid, key[0], key[1], key[2]);
  943.  
  944.                 if(
  945.                 // checar se está com a mesma arma
  946.                 GetPlayerWeapon(playerid) == GetPVarInt(playerid, #keyWeaps) &&
  947.                 // checar se o ammo anterior é igual o ammo de agora
  948.                 GetPVarInt(playerid, #keyFire) == GetPlayerAmmo(playerid) &&
  949.                 // checar se não está no interior (caso tenha comprado ammo)
  950.                 !GetPlayerInterior(playerid) &&
  951.                 // checar se ele está precionando a tecla KEY_FIRE
  952.                 key[0] & KEY_FIRE) {
  953.                     if(GetPVarInt(playerid, #keyWarns) > 2) {
  954.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_NORELOAD_HACK);
  955.                         SetPVarInt(playerid, #keyWarns, 0);
  956.                     }
  957.  
  958.                     SetPVarInt(playerid, #keyWarns, GetPVarInt(playerid, #keyWarns) +1);
  959.                 }
  960.                 SetPVarInt(playerid, #keyFire, GetPlayerAmmo(playerid));
  961.                 SetPVarInt(playerid, #keyWeaps, GetPlayerWeapon(playerid));
  962.                 SetPVarInt(playerid, #keyCheck, gettime());
  963.  
  964.             }
  965.             // caso estiver recarregando a arma. obviamente não é no-reload
  966.             if(GetPlayerWeaponState(playerid) == 3) {
  967.                 SetPVarInt(playerid, #keyWarns, 0);
  968.             }
  969.  
  970.         }
  971.  
  972.         /*--------------------------------------------------
  973.         *
  974.         *  Anti Weapons Hack
  975.         *   Usando GetPlayerWeaponData com variáveis server sided
  976.         *   A precisão deste sistema fica em torno de 100%
  977.         *
  978.         -------------------------------------------------*/
  979.  
  980.         static WSlot[2];
  981.         for(new w; w != 13; ++w) {
  982.             GetPlayerWeaponData(playerid, w, WSlot[0], WSlot[1]);
  983.             if(GetPVarInt(playerid, getSlotID(w)) != WSlot[0] && WSlot[0] && WSlot[0] < 47) {
  984.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_WEAPON_HACK);
  985.                 SetPVarInt(playerid, getSlotID(w), WSlot[0]);
  986.             }
  987.         }
  988.  
  989.         /*--------------------------------------------------
  990.         *
  991.         *  Anti Ammo Hack
  992.         *   Usando GetPlayerAmmo com variáveis server sided
  993.         *   A precisão deste sistema fica em torno de 100%
  994.         *
  995.         -------------------------------------------------*/
  996.  
  997.         if(GetPlayerWeapon(playerid) > 15 && GetPlayerWeapon(playerid) < 43) {
  998.             if(GetPlayerAmmo(playerid) > GetPVarInt(playerid, #Ammo) && GetPlayerWeapon(playerid) == GetPVarInt(playerid, #Weapon)) {
  999.                 if(!IsPlayerInAnyVehicle(playerid)) {
  1000.                     CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_AMMO_HACK);
  1001.                 }
  1002.             }
  1003.             SetPVarInt(playerid, #Ammo, GetPlayerAmmo(playerid));
  1004.             SetPVarInt(playerid, #Weapon, GetPlayerWeapon(playerid));
  1005.         }
  1006.  
  1007.         /*--------------------------------------------------
  1008.         *
  1009.         *   Anti Fly Hack
  1010.         *   Usando Posições e Animções.
  1011.         *   A precisão deste sistema fica em torno de 85%
  1012.         *
  1013.         -------------------------------------------------*/
  1014.  
  1015.         if(!IsPlayerInWater(playerid) && IsPlayerUsingSwimAnim(playerid)) {
  1016.             if(GetPVarInt(playerid, "FlyTime") == 3) {
  1017.                 CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_FLY_HACK);
  1018.                 SetPVarInt(playerid, "FlyTime", 0);
  1019.             }
  1020.             SetPVarInt(playerid, "FlyTime", GetPVarInt(playerid, "FlyTime")+1);
  1021.         }
  1022.  
  1023.         SetPVarInt(playerid, #registerMoney, GetPlayerMoney(playerid));
  1024.         SetPVarInt(playerid, #registerScore, GetPlayerScore(playerid));
  1025.  
  1026.     }
  1027.  
  1028.     return CallLocalFunction("ExOnPlayerUpdate", "i", playerid);
  1029. }
  1030.  
  1031.  
  1032. #define OnPlayerUpdate ExOnPlayerUpdate
  1033.  
  1034. forward ExOnPlayerUpdate(playerid);
  1035.  
  1036.  
  1037. pCheckPos(i, Float:x, Float:y, Float:z);
  1038. public pCheckPos(i, Float:x, Float:y, Float:z) {
  1039.  
  1040.     if(gettime() - GetPVarInt(i, #airBreakSet) < 10)
  1041.     return false;
  1042.  
  1043.     /*--------------------------------------------------
  1044.     *
  1045.     *  Anti Teleport Hack
  1046.     *   Usando GetPlayerPos com variáveis server sided
  1047.     *   A precisão deste sistema fica em torno de 95%
  1048.     *
  1049.     -------------------------------------------------*/
  1050.  
  1051.     if(IsPlayerInRangeOfPoint(i, 2.012837, x, y, z)) {
  1052.         CallLocalFunction("OnPlayerHacking", "ii", i, PLAYER_TELEPORT_HACK);
  1053.     }
  1054.  
  1055.     /*--------------------------------------------------
  1056.     *
  1057.     *  Anti AirBreak Hack
  1058.     *   Usando GetPlayerPos e SetPlayerPos com variáveis server sided
  1059.     *   A precisão deste sistema fica em torno de 95%
  1060.     *
  1061.     -------------------------------------------------*/
  1062.  
  1063.     else {
  1064.         CallLocalFunction("OnPlayerHacking", "ii", i, PLAYER_AIRBREAK_HACK);
  1065.         SetPVarInt(i, #airBreakSet, gettime());
  1066.  
  1067.     }
  1068.     return true;
  1069. }
  1070.  
  1071.  
  1072.  
  1073.  
  1074. public OnPlayerStateChange(playerid, newstate, oldstate)
  1075. {
  1076.  
  1077.  
  1078.     /*--------------------------------------------------
  1079.     *
  1080.     *  Anti State Hack
  1081.     *   Usando OnPlayerStateChange com gettime
  1082.     *   A precisão deste sistema fica em torno de 95%
  1083.     *
  1084.     -------------------------------------------------*/
  1085.  
  1086.     if(newstate == PLAYER_STATE_DRIVER) {
  1087.         if(gettime() - GetPVarInt(playerid, #registerState) < 2 && gettime() - GetPVarInt(playerid,"tposSet") > 3) {
  1088.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_STATE_HACK);
  1089.         }
  1090.         SetPVarInt(playerid, #registerState, gettime());
  1091.     }
  1092.  
  1093.     SetPVarInt(playerid, #spiderCar, 0);
  1094.  
  1095.     return CallLocalFunction("ExOnPlayerStateChange", "idi", playerid, newstate, oldstate);
  1096. }
  1097.  
  1098. #define OnPlayerStateChange ExOnPlayerStateChange
  1099.  
  1100. forward ExOnPlayerStateChange(playerid, newstate, oldstate);
  1101.  
  1102.  
  1103.  
  1104. public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)
  1105. {
  1106.  
  1107.     /*--------------------------------------------------
  1108.     *
  1109.     *  Anti Surfer Vehicle
  1110.     *   Usando OnUnoccupiedVehicleUpdate com gettime e outros
  1111.     *   A precisão deste sistema fica em torno de 85%
  1112.     *
  1113.     -------------------------------------------------*/
  1114.  
  1115.     GetVehiclePos(vehicleid, g_ucPos[0], g_ucPos[1], g_ucPos[2]);
  1116.  
  1117.     if(IsPlayerInRangeOfPoint(playerid, 1.0, g_ucPos[0], g_ucPos[1], g_ucPos[2])) {
  1118.         GetVehicleZAngle(vehicleid, g_ucPos[3]);
  1119.         if(g_diferencasAngle[vehicleid] != g_ucPos[3]) {
  1120.             if(!IsPlayerInAnyVehicle(playerid)) {
  1121.                 GetPlayerPos(vehicleid, g_ucPos[1], g_ucPos[1], g_ucPos[3]);
  1122.                 if(g_ucPos[3] > g_ucPos[2]) {
  1123.                     SetPVarInt(playerid, #registrosUAF, GetPVarInt(playerid, #registrosUAF) +1);
  1124.                     if(GetPVarInt(playerid, #registrosUAF) > 40) {
  1125.                         CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_SURF_VEHICLE);
  1126.                     }
  1127.                 }
  1128.             }
  1129.         }
  1130.         g_diferencasAngle[vehicleid] = g_ucPos[3];
  1131.         return true;
  1132.     }
  1133.  
  1134.     /*--------------------------------------------------
  1135.     *
  1136.     *  Anti Teleport Vehicle
  1137.     *   Usando OnUnoccupiedVehicleUpdate com gettime e outros
  1138.     *   A precisão deste sistema fica em torno de 85%
  1139.     *
  1140.     -------------------------------------------------*/
  1141.  
  1142.     else if(!IsPlayerInRangeOfPoint(playerid, 40.0, g_ucPos[0], g_ucPos[1], g_ucPos[2])) {
  1143.         if(!IsPlayerInAnyVehicle(playerid) && gettime() - GetPVarInt(playerid,"tposSet") > 3) {
  1144.             CallLocalFunction("OnPlayerHacking", "ii", playerid, PLAYER_CAR_TELEPORT);
  1145.         }
  1146.     }
  1147.     return CallLocalFunction("ExOnUnoccupiedVehicleUpdate", "idi", vehicleid, playerid, passenger_seat);
  1148. }
  1149.  
  1150.  
  1151. #define OnUnoccupiedVehicleUpdate ExOnUnoccupiedVehicleUpdate
  1152.  
  1153. forward ExOnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat);
  1154.  
  1155. #define GivePlayerMoney             GivePlayerMoney_Ex
  1156. #define SetPlayerScore              SetPlayerScore_Ex
  1157. #define PutPlayerInVehicle          PutPlayerInVehicle_Ex
  1158. #define PutPlayerInVehicle          PutPlayerInVehicle_Ex
  1159. #define SetPlayerArmour             SetPlayerArmour_Ex
  1160. #define SetPlayerHealth             SetPlayerHealth_Ex
  1161. #define TogglePlayerControllable    TogglePlayerC_Ex
  1162. #define GivePlayerWeapon            GivePlayerWeapon_Ex
  1163. #define ResetPlayerWeapons          ResetPlayerWeapons_Ex
  1164.  
  1165. forward OnPlayerHacking(playerid, hackid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement