Advertisement
Guest User

anticheat_nick.inc

a guest
Apr 26th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.90 KB | None | 0 0
  1. // Include AntiCheat by NicK
  2. #define PLAYER_CHEAT_CARSPAM 1
  3. #define PLAYER_CHEAT_CRASHBULLET 2
  4. #define PLAYER_CHEAT_CRASHATTACH 3
  5. #define PLAYER_CHEAT_FAKEKILL 4
  6. #define PLAYER_CHEAT_FLOODPINT 5
  7. #define PLAYER_CHEAT_CRASHMOD 6
  8. #define PLAYER_CHEAT_CRASHBIKE 7
  9. forward OnPlayerCheat(playerid, cheat); // Detecção do cheating
  10. public OnPlayerStateChange(playerid, newstate, oldstate) {
  11. if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_PASSENGER) {
  12. if(GetPVarInt(playerid, "anticheat_crashbike") > gettime())
  13. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_CRASHBIKE);
  14. SetPVarInt(playerid, "anticheat_crashbike", gettime() + 1);
  15. }
  16. if(newstate == PLAYER_STATE_DRIVER) {
  17. if(GetPVarInt(playerid, "anticheat_carspamtime") > gettime()) {
  18. if(GetPVarInt(playerid, "anticheat_carspam") > 2)
  19. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_CARSPAM);
  20. SetPVarInt(playerid, "anticheat_carspam", GetPVarInt(playerid, "anticheat_carspam")+1);
  21. }
  22. else
  23. SetPVarInt(playerid, "anticheat_carspam",0);
  24. SetPVarInt(playerid, "anticheat_carspamtime", gettime() + 2);
  25. }
  26. return CallLocalFunction("AntiCheat_OnPlayerStateChange", "iii", playerid, newstate, oldstate);
  27. }
  28. forward AntiCheat_OnPlayerStateChange(playerid, newstate, oldstate);
  29.  
  30. #if defined _ALS_OnPlayerStateChange
  31. #undef OnPlayerStateChange
  32. #else
  33. #define _ALS_OnPlayerStateChange
  34. #endif
  35. #define OnPlayerStateChange AntiCheat_OnPlayerStateChange
  36.  
  37. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) {
  38. if(hittype != BULLET_HIT_TYPE_NONE) {
  39. if((fX <= -1000.0 || fX >= 1000.0) || (fY <= -1000.0 || fY >= 1000.0) || (fZ <= -1000.0 || fZ >= 1000.0)) {
  40. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_CRASHBULLET), 0;
  41. }
  42. }
  43. return CallLocalFunction("AntiCheat_OnPlayerWeaponShot", "iiiifff", playerid, weaponid, hittype, hitid, fX, fY, fZ);
  44. }
  45. forward AntiCheat_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
  46. #if defined _ALS_OnPlayerWeaponShot
  47. #undef OnPlayerWeaponShot
  48. #else
  49. #define _ALS_OnPlayerWeaponShot
  50. #endif
  51. #define OnPlayerWeaponShot AntiCheat_OnPlayerWeaponShot
  52.  
  53. public OnPlayerDeath(playerid, killerid, reason) {
  54. if(killerid != INVALID_PLAYER_ID) {
  55. if(playerid == killerid) return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_FAKEKILL);
  56. if(GetPlayerTeam(playerid) != NO_TEAM)
  57. if(GetPlayerTeam(playerid) == GetPlayerTeam(killerid))
  58. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_FAKEKILL);
  59. if(GetPVarInt(playerid, "anticheat_fakekilltime") > gettime()) {
  60. if(GetPVarInt(playerid, "anticheat_fakekill") > 2)
  61. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_FAKEKILL);
  62. SetPVarInt(playerid, "anticheat_fakekill", GetPVarInt(playerid, "anticheat_fakekill")+1);
  63. }
  64. else
  65. SetPVarInt(playerid, "anticheat_fakekill",0);
  66. SetPVarInt(playerid, "anticheat_fakekilltime", gettime() + 3);
  67. }
  68. return CallLocalFunction("AntiCheat_OnPlayerDeath", "iii", playerid, killerid, reason);
  69. }
  70. forward AntiCheat_OnPlayerDeath(playerid, killerid, reason);
  71. #if defined _ALS_OnPlayerDeath
  72. #undef OnPlayerDeath
  73. #else
  74. #define _ALS_OnPlayerDeath
  75. #endif
  76. #define OnPlayerDeath AntiCheat_OnPlayerDeath
  77.  
  78. public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid,Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,Float:fRotX, Float:fRotY, Float:fRotZ,Float:fScaleX, Float:fScaleY, Float:fScaleZ) {
  79. if((modelid == 392) || (fOffsetX <= -1000.0 || fOffsetX >= 1000.0) || (fOffsetY <= -1000.0 || fOffsetY >= 1000.0) || (fOffsetZ <= -1000.0 || fOffsetZ >= 1000.0) || (fScaleX <= -1000.0 || fScaleX >= 1000.0) || (fScaleY <= -1000.0 || fScaleY >= 1000.0) || (fScaleZ <= -1000.0 || fScaleZ >= 1000.0))
  80. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_CRASHATTACH);
  81. return CallLocalFunction("Ant_OnPlayerEditAttachedObject", "iiiiifffffffff", playerid, response, index, modelid, boneid, fOffsetX,fOffsetY, fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
  82. }
  83. forward Ant_OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid,Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ,Float:fRotX, Float:fRotY, Float:fRotZ,Float:fScaleX, Float:fScaleY, Float:fScaleZ);
  84. #if defined _ALS_OnPlayerEditAttachedObject
  85. #undef OnPlayerEditAttachedObject
  86. #else
  87. #define _ALS_OnPlayerEditAttachedObject
  88. #endif
  89. #define OnPlayerEditAttachedObject Ant_OnPlayerEditAttachedObject
  90.  
  91. new AntiCheat_legalmods[49][22] = {
  92. {400, 1024,1021,1020,1019,1018,1013,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  93. {401, 1145,1144,1143,1142,1020,1019,1017,1013,1007,1006,1005,1004,1003,1001,0000,0000,0000,0000},
  94. {404, 1021,1020,1019,1017,1016,1013,1007,1002,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  95. {405, 1023,1021,1020,1019,1018,1014,1001,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  96. {410, 1024,1023,1021,1020,1019,1017,1013,1007,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000},
  97. {415, 1023,1019,1018,1017,1007,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  98. {418, 1021,1020,1016,1006,1002,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  99. {420, 1021,1019,1005,1004,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  100. {421, 1023,1021,1020,1019,1018,1016,1014,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  101. {422, 1021,1020,1019,1017,1013,1007,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  102. {426, 1021,1019,1006,1005,1004,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  103. {436, 1022,1021,1020,1019,1017,1013,1007,1006,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000},
  104. {439, 1145,1144,1143,1142,1023,1017,1013,1007,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000},
  105. {477, 1021,1020,1019,1018,1017,1007,1006,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  106. {478, 1024,1022,1021,1020,1013,1012,1005,1004,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  107. {489, 1024,1020,1019,1018,1016,1013,1006,1005,1004,1002,1000,0000,0000,0000,0000,0000,0000,0000},
  108. {491, 1145,1144,1143,1142,1023,1021,1020,1019,1018,1017,1014,1007,1003,0000,0000,0000,0000,0000},
  109. {492, 1016,1006,1005,1004,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  110. {496, 1143,1142,1023,1020,1019,1017,1011,1007,1006,1003,1002,1001,0000,0000,0000,0000,0000,0000},
  111. {500, 1024,1021,1020,1019,1013,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  112. {516, 1021,1020,1019,1018,1017,1016,1015,1007,1004,1002,1000,0000,0000,0000,0000,0000,0000,0000},
  113. {517, 1145,1144,1143,1142,1023,1020,1019,1018,1017,1016,1007,1003,1002,0000,0000,0000,0000,0000},
  114. {518, 1145,1144,1143,1142,1023,1020,1018,1017,1013,1007,1006,1005,1003,1001,0000,0000,0000,0000},
  115. {527, 1021,1020,1018,1017,1015,1014,1007,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  116. {529, 1023,1020,1019,1018,1017,1012,1011,1007,1006,1003,1001,0000,0000,0000,0000,0000,0000,0000},
  117. {534, 1185,1180,1179,1178,1127,1126,1125,1124,1123,1122,1106,1101,1100,0000,0000,0000,0000,0000},
  118. {535, 1121,1120,1119,1118,1117,1116,1115,1114,1113,1110,1109,0000,0000,0000,0000,0000,0000,0000},
  119. {536, 1184,1183,1182,1181,1128,1108,1107,1105,1104,1103,0000,0000,0000,0000,0000,0000,0000,0000},
  120. {540, 1145,1144,1143,1142,1024,1023,1020,1019,1018,1017,1007,1006,1004,1001,0000,0000,0000,0000},
  121. {542, 1145,1144,1021,1020,1019,1018,1015,1014,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  122. {546, 1145,1144,1143,1142,1024,1023,1019,1018,1017,1007,1006,1004,1002,1001,0000,0000,0000,0000},
  123. {547, 1143,1142,1021,1020,1019,1018,1016,1003,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  124. {549, 1145,1144,1143,1142,1023,1020,1019,1018,1017,1012,1011,1007,1003,1001,0000,0000,0000,0000},
  125. {550, 1145,1144,1143,1142,1023,1020,1019,1018,1006,1005,1004,1003,1001,0000,0000,0000,0000,0000},
  126. {551, 1023,1021,1020,1019,1018,1016,1006,1005,1003,1002,0000,0000,0000,0000,0000,0000,0000,0000},
  127. {558, 1168,1167,1166,1165,1164,1163,1095,1094,1093,1092,1091,1090,1089,1088,0000,0000,0000,0000},
  128. {559, 1173,1162,1161,1160,1159,1158,1072,1071,1070,1069,1068,1067,1066,1065,0000,0000,0000,0000},
  129. {560, 1170,1169,1141,1140,1139,1138,1033,1032,1031,1030,1029,1028,1027,1026,0000,0000,0000,0000},
  130. {561, 1157,1156,1155,1154,1064,1063,1062,1061,1060,1059,1058,1057,1056,1055,1031,1030,1027,1026},
  131. {562, 1172,1171,1149,1148,1147,1146,1041,1040,1039,1038,1037,1036,1035,1034,0000,0000,0000,0000},
  132. {565, 1153,1152,1151,1150,1054,1053,1052,1051,1050,1049,1048,1047,1046,1045,0000,0000,0000,0000},
  133. {567, 1189,1188,1187,1186,1133,1132,1131,1130,1129,1102,0000,0000,0000,0000,0000,0000,0000,0000},
  134. {575, 1177,1176,1175,1174,1099,1044,1043,1042,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  135. {576, 1193,1192,1191,1190,1137,1136,1135,1134,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  136. {580, 1023,1020,1018,1017,1007,1006,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  137. {585, 1145,1144,1143,1142,1020,1019,1017,1013,1007,1006,1005,1004,1003,1001,1018,1023,0000,0000},
  138. {589, 1145,1144,1024,1020,1018,1017,1016,1013,1007,1006,1005,1004,1000,0000,0000,0000,0000,0000},
  139. {600, 1022,1020,1018,1017,1013,1007,1006,1005,1004,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  140. {603, 1145,1144,1143,1142,1024,1023,1020,1019,1018,1017,1007,1006,1001,0000,0000,0000,0000,0000}
  141. };
  142. AntiCheat_iswheelmodel(modelid)
  143. {
  144. new wheelmodels[17] = {1025,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1096,1097,1098};
  145. for(new i; i < sizeof(wheelmodels); i++)
  146. {
  147. if (modelid == wheelmodels[i])
  148. return true;
  149. }
  150. return false;
  151. }
  152. AntiCheat_IllegalCarNitroIde(carmodel)
  153. {
  154. new illegalvehs[29] = { 581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 509, 481, 510, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 590, 569, 537, 538, 570, 449 };
  155. for(new i; i < sizeof(illegalvehs); i++)
  156. {
  157. if (carmodel == illegalvehs[i])
  158. return true;
  159. }
  160.  
  161. return false;
  162. }
  163. AntiCheat_islegalcarmod(vehicleide, componentid) {
  164.  
  165. new modok = false;
  166. // stereo, hydraulics & nos (1x 2x 3x) are special.
  167. if ( (AntiCheat_iswheelmodel(componentid)) || (componentid == 1086) || (componentid == 1087) || ((componentid >= 1008) && (componentid <= 1010))) {
  168. new nosblocker = AntiCheat_IllegalCarNitroIde(vehicleide);
  169. if (!nosblocker)
  170. modok = true;
  171. } else {
  172.  
  173. // check if the specified model CAN use this particular mod.
  174. for(new I; I < sizeof(AntiCheat_legalmods); I++) {
  175.  
  176. if (AntiCheat_legalmods[I][0] == vehicleide) { // first is car IDE
  177.  
  178. for(new J = 1; J < 22; J++) { // start with 1
  179. if (AntiCheat_legalmods[I][J] == componentid)
  180. modok = true;
  181. }
  182.  
  183. }
  184.  
  185. }
  186.  
  187. }
  188. return modok;
  189. }
  190.  
  191. public OnVehicleMod(playerid, vehicleid, componentid)
  192. {
  193. if(!AntiCheat_islegalcarmod(vehicleid, componentid))
  194. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_CRASHMOD), 0;
  195. return CallLocalFunction("AntiCheat_OnVehicleMod", "iii", playerid, vehicleid, componentid);
  196. }
  197. forward AntiCheat_OnVehicleMod(playerid, vehicleid, componentid);
  198. #if defined _ALS_OnVehicleMod
  199. #undef OnVehicleMod
  200. #else
  201. #define _ALS_OnVehicleMod
  202. #endif
  203. #define OnVehicleMod AntiCheat_OnVehicleMod
  204.  
  205. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  206. {
  207. if(GetPVarInt(playerid, "anticheat_respraytime") > gettime()) {
  208. if(GetPVarInt(playerid, "anticheat_respray") > 1)
  209. return CallLocalFunction("OnPlayerCheat", "ii", playerid, PLAYER_CHEAT_FLOODPINT);
  210. SetPVarInt(playerid, "anticheat_respray", GetPVarInt(playerid, "anticheat_respray")+1);
  211. }
  212. else
  213. SetPVarInt(playerid, "anticheat_respray",0);
  214. SetPVarInt(playerid, "anticheat_respraytime", gettime() + 2);
  215. return CallLocalFunction("AntiCheat_OnVehicleRespray", "iiii", playerid, vehicleid, color1, color2);
  216. }
  217. forward AntiCheat_OnVehicleRespray(playerid, vehicleid, color1, color2);
  218. #if defined _ALS_OnVehicleRespray
  219. #undef OnVehicleRespray
  220. #else
  221. #define _ALS_OnVehicleRespray
  222. #endif
  223. #define OnVehicleRespray AntiCheat_OnVehicleRespray
  224.  
  225. /*
  226. Include gerada em 28/03/2015 por Nícolas Corrêa
  227. www.brasilmegatrucker.com
  228. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement