11.09.2011, 11:06
I had a pain in the ass hour of adding all of the 194 names of vehicle components.
I decided to release the stock function I made, because I seriously don't want anyone to have to do this again.
It works as simply as
GetComponentName
Parameters:
component ID - The ID of the component (Can be found here
returns A string which contains the name of the component.
Here's the code:
Added, here is the ModFitsForCar.
ModFitsForCar
Parameters:
model - The vehicle model ID
component - The component ID
Returns - 1 If it fits for the vehicle, 0 if it doesn't
Here's the code:
I hope you'll appriciate it.
I decided to release the stock function I made, because I seriously don't want anyone to have to do this again.
It works as simply as
GetComponentName
Parameters:
pawn Код:
(component)
returns A string which contains the name of the component.
Here's the code:
pawn Код:
stock GetComponentName(component)
{
new modname[50];
switch(component)
{
case 1000: format(modname, sizeof(modname), "Pro Spoiler");
case 1001: format(modname, sizeof(modname), "Win Spoiler");
case 1002: format(modname, sizeof(modname), "Drag Spoiler");
case 1003: format(modname, sizeof(modname), "Alpha Spoiler");
case 1004: format(modname, sizeof(modname), "Champ Scoop");
case 1005: format(modname, sizeof(modname), "Fury Scoop");
case 1006: format(modname, sizeof(modname), "Roof Scoop");
case 1007: format(modname, sizeof(modname), "Right Sideskirt");
case 1008: format(modname, sizeof(modname), "Nitrous x5");
case 1009: format(modname, sizeof(modname), "Nitrous x2");
case 1010: format(modname, sizeof(modname), "Nitrous x10");
case 1011: format(modname, sizeof(modname), "Race Scoop");
case 1012: format(modname, sizeof(modname), "Worx Scoop");
case 1013: format(modname, sizeof(modname), "Round Fog Lights");
case 1014: format(modname, sizeof(modname), "Champ Spoiler");
case 1015: format(modname, sizeof(modname), "Race Spoiler");
case 1016: format(modname, sizeof(modname), "Worx Spoiler");
case 1017: format(modname, sizeof(modname), "Left Sideskirt");
case 1018: format(modname, sizeof(modname), "Upswept Exhaust");
case 1019: format(modname, sizeof(modname), "Twin Exhaust");
case 1020: format(modname, sizeof(modname), "Large Exhaust");
case 1021: format(modname, sizeof(modname), "Medium Exhaust");
case 1022: format(modname, sizeof(modname), "Small Exhaust");
case 1023: format(modname, sizeof(modname), "Fury Spoiler");
case 1024: format(modname, sizeof(modname), "Square Fog Lights");
case 1025: format(modname, sizeof(modname), "Offroad Wheels");
case 1026, 1036, 1047, 1056, 1069, 1090: format(modname, sizeof(modname), "Right Alien Sideskirt");
case 1027, 1040, 1051, 1062, 1071, 1094: format(modname, sizeof(modname), "Left Alien Sideskirt");
case 1028, 1034, 1046, 1064, 1065, 1092: format(modname, sizeof(modname), "Alien Exhaust");
case 1029, 1037, 1045, 1059, 1066, 1089: format(modname, sizeof(modname), "X-Flow Exhaust");
case 1030, 1039, 1048, 1057, 1070, 1095: format(modname, sizeof(modname), "Right X-Flow Sideskirt");
case 1031, 1041, 1052, 1063, 1072, 1093: format(modname, sizeof(modname), "Left X-Flow Sideskirt");
case 1032, 1038, 1054, 1055, 1067, 1088: format(modname, sizeof(modname), "Alien Roof Vent");
case 1033, 1035, 1053, 1061, 1068, 1091: format(modname, sizeof(modname), "X-Flow Roof Vent");
case 1042: format(modname, sizeof(modname), "Right Chrome Sideskirt");
case 1099: format(modname, sizeof(modname), "Left Chrome Sideskirt");
case 1043, 1105, 1114, 1127, 1132, 1135: format(modname, sizeof(modname), "Slamin Exhaust");
case 1044, 1104, 1113, 1126, 1129, 1136: format(modname, sizeof(modname), "Chrome Exhaust");
case 1050, 1058, 1139, 1146, 1158, 1163: format(modname, sizeof(modname), "X-Flow Spoiler");
case 1049, 1060, 1138, 1147, 1162, 1164: format(modname, sizeof(modname), "Alien Spoiler");
case 1073: format(modname, sizeof(modname), "Shadow Wheels");
case 1074: format(modname, sizeof(modname), "Mega Wheels");
case 1075: format(modname, sizeof(modname), "Rimshine Wheels");
case 1076: format(modname, sizeof(modname), "Wires Wheels");
case 1077: format(modname, sizeof(modname), "Classic Wheels");
case 1078: format(modname, sizeof(modname), "Twist Wheels");
case 1079: format(modname, sizeof(modname), "Cutter Wheels");
case 1080: format(modname, sizeof(modname), "Stitch Wheels");
case 1081: format(modname, sizeof(modname), "Grove Wheels");
case 1082: format(modname, sizeof(modname), "Import Wheels");
case 1083: format(modname, sizeof(modname), "Dollar Wheels");
case 1084: format(modname, sizeof(modname), "Trance Wheels");
case 1085: format(modname, sizeof(modname), "Atomic Wheels");
case 1086: format(modname, sizeof(modname), "Stereo");
case 1087: format(modname, sizeof(modname), "Hydraulics");
case 1096: format(modname, sizeof(modname), "Ahab Wheels");
case 1097: format(modname, sizeof(modname), "Virtual Wheels");
case 1098: format(modname, sizeof(modname), "Access Wheels");
case 1100: format(modname, sizeof(modname), "Chrome Grill");
case 1101: format(modname, sizeof(modname), "Left Chrome Flames Sideskirt");
case 1102, 1107: format(modname, sizeof(modname), "Left Chrome Strip Sideskirt");
case 1103: format(modname, sizeof(modname), "Convertible Roof");
case 1106, 1124: format(modname, sizeof(modname), "Left Chrome Arches Sideskirt");
case 1108, 1133, 1134: format(modname, sizeof(modname), "Right Chrome Strip Sideskirt");
case 1109: format(modname, sizeof(modname), "Chrome Rear Bullbars");
case 1110: format(modname, sizeof(modname), "Slamin Rear Bullbars");
case 1111, 1112: format(modname, sizeof(modname), "Front Sign");
case 1115: format(modname, sizeof(modname), "Chrome Front Bullbars");
case 1116: format(modname, sizeof(modname), "Slamin Front Bullbars");
case 1117, 1174, 1179, 1182, 1189, 1191: format(modname, sizeof(modname), "Chrome Front Bumper");
case 1175, 1181, 1185, 1188, 1190: format(modname, sizeof(modname), "Slamin Front Bumper");
case 1176, 1180, 1184, 1187, 1192: format(modname, sizeof(modname), "Chrome Rear Bumper");
case 1177, 1178, 1183, 1186, 1193: format(modname, sizeof(modname), "Slamin Rear Bumper");
case 1118: format(modname, sizeof(modname), "Right Chrome Trim Sideskirt");
case 1119: format(modname, sizeof(modname), "Right Wheelcovers Sideskirt");
case 1120: format(modname, sizeof(modname), "Left Chrome Trim Sideskirt");
case 1121: format(modname, sizeof(modname), "Left Wheelcovers Sideskirt");
case 1122: format(modname, sizeof(modname), "Right Chrome Flames Sideskirt");
case 1123: format(modname, sizeof(modname), "Bullbar Chrome Bars");
case 1125: format(modname, sizeof(modname), "Bullbar Chrome Lights");
case 1128: format(modname, sizeof(modname), "Vinyl Hardtop Roof");
case 1130: format(modname, sizeof(modname), "Hardtop Roof");
case 1131: format(modname, sizeof(modname), "Softtop Roof");
case 1140, 1148, 1151, 1156, 1161, 1167: format(modname, sizeof(modname), "X-Flow Rear Bumper");
case 1141, 1149, 1150, 1154, 1159, 1168: format(modname, sizeof(modname), "Alien Rear Bumper");
case 1142: format(modname, sizeof(modname), "Left Oval Vents");
case 1143: format(modname, sizeof(modname), "Right Oval Vents");
case 1144: format(modname, sizeof(modname), "Left Square Vents");
case 1145: format(modname, sizeof(modname), "Right Square Vents");
case 1152, 1157, 1165, 1170, 1172, 1173: format(modname, sizeof(modname), "X-Flow Front Bumper");
case 1153, 1155, 1160, 1166, 1169, 1171: format(modname, sizeof(modname), "Alien Front Bumper");
}
return modname;
}
Added, here is the ModFitsForCar.
ModFitsForCar
Parameters:
pawn Код:
(model, component)
component - The component ID
Returns - 1 If it fits for the vehicle, 0 if it doesn't
Here's the code:
pawn Код:
stock ModFitsForCar(model, component)
{
new thing = 0;
if(model == 560 || model == 562 || model == 575 || model == 565 || model == 561 || model == 559 || model == 558 || model == 534 || model == 567 || model == 536 || model == 535 || model == 576)
{
switch(component)
{
case 1000: thing = 1;
case 1001: thing = 1;
case 1002: thing = 1;
case 1003: thing = 1;
case 1004: thing = 1;
case 1005: thing = 1;
case 1006: thing = 1;
case 1007: thing = 1;
case 1011: thing = 1;
case 1012: thing = 1;
case 1013: thing = 1;
case 1014: thing = 1;
case 1015: thing = 1;
case 1016: thing = 1;
case 1017: thing = 1;
case 1023: thing = 1;
case 1024: thing = 1;
case 1025: thing = 1;
case 1142: thing = 1;
case 1143: thing = 1;
case 1144: thing = 1;
case 1145: thing = 1;
}
switch(model)
{
case 560:
{
switch(component)
{
case 1026: thing = 1;
case 1027: thing = 1;
case 1028: thing = 1;
case 1029: thing = 1;
case 1030: thing = 1;
case 1031: thing = 1;
case 1032: thing = 1;
case 1033: thing = 1;
case 1138: thing = 1;
case 1139: thing = 1;
case 1140: thing = 1;
case 1141: thing = 1;
case 1169: thing = 1;
case 1170: thing = 1;
}
}
case 562:
{
switch(component)
{
case 1034: thing = 1;
case 1035: thing = 1;
case 1036: thing = 1;
case 1037: thing = 1;
case 1038: thing = 1;
case 1039: thing = 1;
case 1040: thing = 1;
case 1041: thing = 1;
case 1146: thing = 1;
case 1147: thing = 1;
case 1148: thing = 1;
case 1149: thing = 1;
case 1171: thing = 1;
case 1172: thing = 1;
}
}
case 575:
{
switch(component)
{
case 1042: thing = 1;
case 1043: thing = 1;
case 1044: thing = 1;
case 1099: thing = 1;
case 1174: thing = 1;
case 1175: thing = 1;
case 1176: thing = 1;
case 1177: thing = 1;
}
}
case 565:
{
switch(component)
{
case 1045: thing = 1;
case 1046: thing = 1;
case 1047: thing = 1;
case 1048: thing = 1;
case 1049: thing = 1;
case 1050: thing = 1;
case 1051: thing = 1;
case 1052: thing = 1;
case 1053: thing = 1;
case 1054: thing = 1;
case 1150: thing = 1;
case 1151: thing = 1;
case 1152: thing = 1;
case 1153: thing = 1;
}
}
case 561:
{
switch(component)
{
case 1055: thing = 1;
case 1056: thing = 1;
case 1057: thing = 1;
case 1058: thing = 1;
case 1059: thing = 1;
case 1060: thing = 1;
case 1061: thing = 1;
case 1062: thing = 1;
case 1063: thing = 1;
case 1064: thing = 1;
case 1154: thing = 1;
case 1155: thing = 1;
case 1156: thing = 1;
case 1157: thing = 1;
}
}
case 559:
{
switch(component)
{
case 1065: thing = 1;
case 1066: thing = 1;
case 1067: thing = 1;
case 1068: thing = 1;
case 1069: thing = 1;
case 1070: thing = 1;
case 1071: thing = 1;
case 1072: thing = 1;
case 1158: thing = 1;
case 1159: thing = 1;
case 1160: thing = 1;
case 1161: thing = 1;
case 1162: thing = 1;
case 1173: thing = 1;
}
}
case 558:
{
switch(component)
{
case 1088: thing = 1;
case 1089: thing = 1;
case 1090: thing = 1;
case 1091: thing = 1;
case 1092: thing = 1;
case 1093: thing = 1;
case 1094: thing = 1;
case 1095: thing = 1;
case 1163: thing = 1;
case 1164: thing = 1;
case 1165: thing = 1;
case 1166: thing = 1;
case 1167: thing = 1;
case 1168: thing = 1;
}
}
case 534:
{
switch(component)
{
case 1100: thing = 1;
case 1101: thing = 1;
case 1122: thing = 1;
case 1123: thing = 1;
case 1124: thing = 1;
case 1125: thing = 1;
case 1126: thing = 1;
case 1127: thing = 1;
case 1178: thing = 1;
case 1179: thing = 1;
case 1180: thing = 1;
case 1185: thing = 1;
}
}
case 567:
{
switch(component)
{
case 1129: thing = 1;
case 1130: thing = 1;
case 1131: thing = 1;
case 1132: thing = 1;
case 1133: thing = 1;
case 1186: thing = 1;
case 1187: thing = 1;
case 1188: thing = 1;
case 1189: thing = 1;
}
}
case 536:
{
switch(component)
{
case 1103: thing = 1;
case 1104: thing = 1;
case 1105: thing = 1;
case 1107: thing = 1;
case 1108: thing = 1;
case 1128: thing = 1;
case 1181: thing = 1;
case 1182: thing = 1;
case 1183: thing = 1;
case 1184: thing = 1;
}
}
case 535:
{
switch(component)
{
case 1110: thing = 1;
case 1111: thing = 1;
case 1112: thing = 1;
case 1113: thing = 1;
case 1114: thing = 1;
case 1115: thing = 1;
case 1116: thing = 1;
case 1117: thing = 1;
case 1118: thing = 1;
case 1119: thing = 1;
case 1120: thing = 1;
case 1121: thing = 1;
}
}
case 576:
{
switch(component)
{
case 1134: thing = 1;
case 1135: thing = 1;
case 1136: thing = 1;
case 1137: thing = 1;
case 1190: thing = 1;
case 1191: thing = 1;
case 1192: thing = 1;
case 1193: thing = 1;
}
}
}
}
switch(component)
{
case 1008: thing = 1;
case 1009: thing = 1;
case 1010: thing = 1;
case 1018: thing = 1;
case 1019: thing = 1;
case 1020: thing = 1;
case 1021: thing = 1;
case 1022: thing = 1;
case 1073: thing = 1;
case 1074: thing = 1;
case 1075: thing = 1;
case 1076: thing = 1;
case 1077: thing = 1;
case 1078: thing = 1;
case 1079: thing = 1;
case 1080: thing = 1;
case 1081: thing = 1;
case 1082: thing = 1;
case 1083: thing = 1;
case 1084: thing = 1;
case 1085: thing = 1;
case 1086: thing = 1;
case 1087: thing = 1;
case 1096: thing = 1;
case 1097: thing = 1;
case 1098: thing = 1;
}
return thing;
}