ricop522

[FS] Anti VehicleMods

Feb 20th, 2012
1,395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.53 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <foreach>
  5.  
  6. new legalmods[48][22] = {
  7.         {400, 1024,1021,1020,1019,1018,1013,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  8.         {401, 1145,1144,1143,1142,1020,1019,1017,1013,1007,1006,1005,1004,1003,1001,0000,0000,0000,0000},
  9.         {404, 1021,1020,1019,1017,1016,1013,1007,1002,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  10.         {405, 1023,1021,1020,1019,1018,1014,1001,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  11.         {410, 1024,1023,1021,1020,1019,1017,1013,1007,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000},
  12.         {415, 1023,1019,1018,1017,1007,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  13.         {418, 1021,1020,1016,1006,1002,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  14.         {420, 1021,1019,1005,1004,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  15.         {421, 1023,1021,1020,1019,1018,1016,1014,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  16.         {422, 1021,1020,1019,1017,1013,1007,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  17.         {426, 1021,1019,1006,1005,1004,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  18.         {436, 1022,1021,1020,1019,1017,1013,1007,1006,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000},
  19.         {439, 1145,1144,1143,1142,1023,1017,1013,1007,1003,1001,0000,0000,0000,0000,0000,0000,0000,0000},
  20.         {477, 1021,1020,1019,1018,1017,1007,1006,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  21.         {478, 1024,1022,1021,1020,1013,1012,1005,1004,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  22.         {489, 1024,1020,1019,1018,1016,1013,1006,1005,1004,1002,1000,0000,0000,0000,0000,0000,0000,0000},
  23.         {491, 1145,1144,1143,1142,1023,1021,1020,1019,1018,1017,1014,1007,1003,0000,0000,0000,0000,0000},
  24.         {492, 1016,1006,1005,1004,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  25.         {496, 1143,1142,1023,1020,1019,1017,1011,1007,1006,1003,1002,1001,0000,0000,0000,0000,0000,0000},
  26.         {500, 1024,1021,1020,1019,1013,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  27.         {516, 1021,1020,1019,1018,1017,1016,1015,1007,1004,1002,1000,0000,0000,0000,0000,0000,0000,0000},
  28.         {517, 1145,1144,1143,1142,1023,1020,1019,1018,1017,1016,1007,1003,1002,0000,0000,0000,0000,0000},
  29.         {518, 1145,1144,1143,1142,1023,1020,1018,1017,1013,1007,1006,1005,1003,1001,0000,0000,0000,0000},
  30.         {527, 1021,1020,1018,1017,1015,1014,1007,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  31.         {529, 1023,1020,1019,1018,1017,1012,1011,1007,1006,1003,1001,0000,0000,0000,0000,0000,0000,0000},
  32.         {534, 1185,1180,1179,1178,1127,1126,1125,1124,1123,1122,1106,1101,1100,0000,0000,0000,0000,0000},
  33.         {535, 1121,1120,1119,1118,1117,1116,1115,1114,1113,1110,1109,0000,0000,0000,0000,0000,0000,0000},
  34.         {536, 1184,1183,1182,1181,1128,1108,1107,1105,1104,1103,0000,0000,0000,0000,0000,0000,0000,0000},
  35.         {540, 1145,1144,1143,1142,1024,1023,1020,1019,1018,1017,1007,1006,1004,1001,0000,0000,0000,0000},
  36.         {542, 1145,1144,1021,1020,1019,1018,1015,1014,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  37.         {546, 1145,1144,1143,1142,1024,1023,1019,1018,1017,1007,1006,1004,1002,1001,0000,0000,0000,0000},
  38.         {547, 1143,1142,1021,1020,1019,1018,1016,1003,1000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  39.         {549, 1145,1144,1143,1142,1023,1020,1019,1018,1017,1012,1011,1007,1003,1001,0000,0000,0000,0000},
  40.         {550, 1145,1144,1143,1142,1023,1020,1019,1018,1006,1005,1004,1003,1001,0000,0000,0000,0000,0000},
  41.         {551, 1023,1021,1020,1019,1018,1016,1006,1005,1003,1002,0000,0000,0000,0000,0000,0000,0000,0000},
  42.         {558, 1168,1167,1166,1165,1164,1163,1095,1094,1093,1092,1091,1090,1089,1088,0000,0000,0000,0000},
  43.         {559, 1173,1162,1161,1160,1159,1158,1072,1071,1070,1069,1068,1067,1066,1065,0000,0000,0000,0000},
  44.         {560, 1170,1169,1141,1140,1139,1138,1033,1032,1031,1030,1029,1028,1027,1026,0000,0000,0000,0000},
  45.         {561, 1157,1156,1155,1154,1064,1063,1062,1061,1060,1059,1058,1057,1056,1055,1031,1030,1027,1026},
  46.         {562, 1172,1171,1149,1148,1147,1146,1041,1040,1039,1038,1037,1036,1035,1034,0000,0000,0000,0000},
  47.         {565, 1153,1152,1151,1150,1054,1053,1052,1051,1050,1049,1048,1047,1046,1045,0000,0000,0000,0000},
  48.         {567, 1189,1188,1187,1186,1133,1132,1131,1130,1129,1102,0000,0000,0000,0000,0000,0000,0000,0000},
  49.         {575, 1177,1176,1175,1174,1099,1044,1043,1042,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  50.         {576, 1193,1192,1191,1190,1137,1136,1135,1134,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  51.         {580, 1023,1020,1018,1017,1007,1006,1001,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  52.         {589, 1145,1144,1024,1020,1018,1017,1016,1013,1007,1006,1005,1004,1000,0000,0000,0000,0000,0000},
  53.         {600, 1022,1020,1018,1017,1013,1007,1006,1005,1004,0000,0000,0000,0000,0000,0000,0000,0000,0000},
  54.         {603, 1145,1144,1143,1142,1024,1023,1020,1019,1018,1017,1007,1006,1001,0000,0000,0000,0000,0000}
  55. };
  56.  
  57.  
  58. public OnFilterScriptInit()
  59. {
  60.     print("\n--------------------------------------");
  61.     print(" Blank Filterscript by your name here");
  62.     print("--------------------------------------\n");
  63.     return 1;
  64. }
  65.  
  66. public OnFilterScriptExit()
  67. {
  68.     return 1;
  69. }
  70.  
  71.  
  72. public OnVehicleMod(playerid, vehicleid, componentid) {
  73.     new vehicleide = GetVehicleModel(vehicleid);
  74.     new modok = islegalcarmod(vehicleide, componentid);
  75.     new Name[24];
  76.     GetPlayerName(playerid, Name, 24);
  77.     if (!modok) {
  78.         printf("[invalid_mod] %s %d %d %d %d %d", Name, playerid, vehicleid, vehicleide, componentid);
  79.         BanEx(playerid, "Fuck you and your mods!");
  80.     }
  81.     return 1;
  82. }
  83.  
  84. stock iswheelmodel(modelid) {
  85.  
  86.     new wheelmodels[17] = {1025,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1096,1097,1098};
  87.  
  88.     for(new I = 0, b = sizeof(wheelmodels); I != b; ++I) {
  89.         if (modelid == wheelmodels[I])
  90.             return true;
  91.  
  92.     }
  93.  
  94.     return false;
  95. }
  96.  
  97. stock IllegalCarNitroIde(carmodel) {
  98.  
  99.     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 };
  100.  
  101.     for(new I = 0, b = sizeof(illegalvehs); I != b; ++I) {
  102.  
  103.         if (carmodel == illegalvehs[I])
  104.             return true;
  105.  
  106.     }
  107.  
  108.     return false;
  109. }
  110.  
  111. // assumes player is in a car - make sure it is.
  112. stock illegal_nos_vehicle(PlayerID) {
  113.  
  114.     new carid = GetPlayerVehicleID(PlayerID);
  115.     new playercarmodel = GetVehicleModel(carid);
  116.  
  117.     return IllegalCarNitroIde(playercarmodel);
  118.  
  119. }
  120.  
  121. stock islegalcarmod(vehicleide, componentid) {
  122.  
  123.     new modok = false;
  124.  
  125.     // stereo, hydraulics & nos (1x 2x 3x) are special.
  126.     if ( (iswheelmodel(componentid)) || (componentid == 1086) || (componentid == 1087) || ((componentid >= 1008) && (componentid <= 1010))) {
  127.  
  128.         new nosblocker = IllegalCarNitroIde(vehicleide);
  129.  
  130.         if (!nosblocker)
  131.             modok = true;
  132.  
  133.     } else {
  134.  
  135.         // check if the specified model CAN use this particular mod.
  136.         for(new I = 0, b = sizeof(legalmods); I != b; ++I) {
  137.  
  138.             if (legalmods[I][0] == vehicleide) { // first is car IDE
  139.  
  140.                 for(new J = 1; J < 22; J++) { // start with 1
  141.                     if (legalmods[I][J] == componentid)
  142.                         modok = true;
  143.                 }
  144.  
  145.             }
  146.  
  147.         }
  148.  
  149.     }
  150.  
  151.     return modok;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment