How to check if an object model id is valid?
#1

How can I check if a provided object model ID is a valid id?
Reply
#2

Код:
stock IsValidObjectModelID(ModelID)
{
	if((ModelID >= 321 && ModelID <= 326) || (ModelID >= 330 && ModelID <= 331) || (ModelID >= 333 && ModelID <= 339) || (ModelID >= 341 && ModelID <= 344) || (ModelID >= 346 && ModelID <= 363) || (ModelID >= 365 && ModelID <= 372) || (ModelID >= 1433 && ModelID <= 13594) || (ModelID >= 5482 && ModelID <= 5512) || (ModelID >= 966 && ModelID <= 998) || (ModelID >= 1210 && ModelID <= 1325) || (ModelID >= 1420 && ModelID <= 1620) || (ModelID >= 1971 && ModelID <= 4522)) return 1;
	return 0;
}
Reply
#3

There is no such function.

Only if(IsValidObject(objectid)).
Reply
#4

https://sampwiki.blast.hk/wiki/IsValidObject
Reply
#5

There are 15693 actual valid object model IDs in the game from ide range 615 to 19999, so 3691 are actually unused (invalid).

I made a function with generated switch for checking if an ide number is valid, returns true / false accordingly and is based on game ide data that you can use to really make sure your IDE values are valid.

Quote:

stock IsIDEValid(input) {

switch(input) {
case 615..661: {
return true;
}
case 664: {
return true;
}
case 669..698: {
return true;
}
case 700..792: {
return true;
}
case 800..906: {
return true;
}
case 910..964: {
return true;
}
case 966..998: {
return true;
}
case 1000..1193: {
return true;
}
case 1207..1325: {
return true;
}
case 1327..1572: {
return true;
}
case 1574..1698: {
return true;
}
case 1700..2882: {
return true;
}
case 2885..3135: {
return true;
}
case 3167..3175: {
return true;
}
case 3178: {
return true;
}
case 3187: {
return true;
}
case 3193: {
return true;
}
case 3214: {
return true;
}
case 3221: {
return true;
}
case 3241..3244: {
return true;
}
case 3246: {
return true;
}
case 3249..3250: {
return true;
}
case 3252..3253: {
return true;
}
case 3255..3265: {
return true;
}
case 3267..3347: {
return true;
}
case 3350..3415: {
return true;
}
case 3417..3428: {
return true;
}
case 3430..3609: {
return true;
}
case 3612..3783: {
return true;
}
case 3785..3869: {
return true;
}
case 3872..3882: {
return true;
}
case 3884..3888: {
return true;
}
case 3890..3973: {
return true;
}
case 3975..4541: {
return true;
}
case 4550..4762: {
return true;
}
case 4806..5084: {
return true;
}
case 5086..5089: {
return true;
}
case 5105..5375: {
return true;
}
case 5390..5682: {
return true;
}
case 5703..6010: {
return true;
}
case 6035..6253: {
return true;
}
case 6255..6257: {
return true;
}
case 6280..6347: {
return true;
}
case 6349..6525: {
return true;
}
case 6863..7392: {
return true;
}
case 7415..7973: {
return true;
}
case 7978..9193: {
return true;
}
case 9205..9267: {
return true;
}
case 9269..9478: {
return true;
}
case 9482..10310: {
return true;
}
case 10315..10744: {
return true;
}
case 10750..11417: {
return true;
}
case 11420..11753: {
return true;
}
case 12800..13563: {
return true;
}
case 13590..13667: {
return true;
}
case 13672..13890: {
return true;
}
case 14383..14528: {
return true;
}
case 14530..14554: {
return true;
}
case 14556: {
return true;
}
case 14558..14643: {
return true;
}
case 14650..14657: {
return true;
}
case 14660..14695: {
return true;
}
case 14699..14728: {
return true;
}
case 14735..14765: {
return true;
}
case 14770..14856: {
return true;
}
case 14858..14883: {
return true;
}
case 14885..14898: {
return true;
}
case 14900..14903: {
return true;
}
case 15025..15064: {
return true;
}
case 16000..16790: {
return true;
}
case 17000..17474: {
return true;
}
case 17500..17974: {
return true;
}
case 17976: {
return true;
}
case 17978: {
return true;
}
case 18000..18036: {
return true;
}
case 18038..18102: {
return true;
}
case 18104..18105: {
return true;
}
case 18109: {
return true;
}
case 18112: {
return true;
}
case 18200..18859: {
return true;
}
case 18862..19198: {
return true;
}
case 19200..19274: {
return true;
}
case 19277..19595: {
return true;
}
case 19597..19999: {
return true;
}
}

return false;

}

Yes, i am crazy.
Reply
#6

To check if object is dynamic (object.dat):

Quote:

stock IsIDEDynamic(input) {

switch(input) {
case 625..633: {
return true;
}
case 642..644: {
return true;
}
case 646: {
return true;
}
case 650: {
return true;
}
case 716..717: {
return true;
}
case 737..738: {
return true;
}
case 792: {
return true;
}
case 858: {
return true;
}
case 881..895: {
return true;
}
case 904..905: {
return true;
}
case 929: {
return true;
}
case 934: {
return true;
}
case 941: {
return true;
}
case 943: {
return true;
}
case 945..947: {
return true;
}
case 952: {
return true;
}
case 955..956: {
return true;
}
case 958..959: {
return true;
}
case 961: {
return true;
}
case 969: {
return true;
}
case 971..972: {
return true;
}
case 975: {
return true;
}
case 977: {
return true;
}
case 981: {
return true;
}
case 985..986: {
return true;
}
case 988: {
return true;
}
case 990: {
return true;
}
case 993: {
return true;
}
case 996: {
return true;
}
case 1209..1235: {
return true;
}
case 1238..1244: {
return true;
}
case 1246..1249: {
return true;
}
case 1251..1255: {
return true;
}
case 1257..1258: {
return true;
}
case 1262: {
return true;
}
case 1264..1265: {
return true;
}
case 1269..1271: {
return true;
}
case 1273: {
return true;
}
case 1275..1277: {
return true;
}
case 1280..1291: {
return true;
}
case 1293..1294: {
return true;
}
case 1297: {
return true;
}
case 1299..1300: {
return true;
}
case 1302..1305: {
return true;
}
case 1310: {
return true;
}
case 1315: {
return true;
}
case 1319..1324: {
return true;
}
case 1328..1334: {
return true;
}
case 1338: {
return true;
}
case 1340..1344: {
return true;
}
case 1349..1352: {
return true;
}
case 1369..1370: {
return true;
}
case 1372..1395: {
return true;
}
case 1398..1400: {
return true;
}
case 1403..1404: {
return true;
}
case 1407..1415: {
return true;
}
case 1417..1426: {
return true;
}
case 1428..1438: {
return true;
}
case 1440..1441: {
return true;
}
case 1443..1452: {
return true;
}
case 1456..1483: {
return true;
}
case 1489: {
return true;
}
case 1491..1508: {
return true;
}
case 1514: {
return true;
}
case 1517..1518: {
return true;
}
case 1520: {
return true;
}
case 1522..1523: {
return true;
}
case 1532..1536: {
return true;
}
case 1538: {
return true;
}
case 1543..1545: {
return true;
}
case 1549..1551: {
return true;
}
case 1553..1558: {
return true;
}
case 1560..1561: {
return true;
}
case 1563..1564: {
return true;
}
case 1566..1569: {
return true;
}
case 1574: {
return true;
}
case 1581..1592: {
return true;
}
case 1598..1612: {
return true;
}
case 1632: {
return true;
}
case 1634: {
return true;
}
case 1636: {
return true;
}
case 1640..1647: {
return true;
}
case 1649..1651: {
return true;
}
case 1654..1656: {
return true;
}
case 1662: {
return true;
}
case 1664: {
return true;
}
case 1666..1670: {
return true;
}
case 1672: {
return true;
}
case 1676: {
return true;
}
case 1684..1686: {
return true;
}
case 1698: {
return true;
}
case 1701: {
return true;
}
case 1711..1712: {
return true;
}
case 1715: {
return true;
}
case 1717..1719: {
return true;
}
case 1775..1776: {
return true;
}
case 1826..1830: {
return true;
}
case 1858: {
return true;
}
case 1894..1898: {
return true;
}
case 1901..1904: {
return true;
}
case 1911: {
return true;
}
case 1921: {
return true;
}
case 1923..1927: {
return true;
}
case 1930..1931: {
return true;
}
case 1942..1945: {
return true;
}
case 1949..1951: {
return true;
}
case 1960..1962: {
return true;
}
case 1965..1967: {
return true;
}
case 1975..1980: {
return true;
}
case 1985: {
return true;
}
case 1997: {
return true;
}
case 2003..2004: {
return true;
}
case 2028: {
return true;
}
case 2188: {
return true;
}
case 2212..2223: {
return true;
}
case 2325: {
return true;
}
case 2332: {
return true;
}
case 2347..2349: {
return true;
}
case 2351..2355: {
return true;
}
case 2589..2590: {
return true;
}
case 2601: {
return true;
}
case 2627..2631: {
return true;
}
case 2634: {
return true;
}
case 2640: {
return true;
}
case 2647: {
return true;
}
case 2663: {
return true;
}
case 2669: {
return true;
}
case 2678..2683: {
return true;
}
case 2702..2703: {
return true;
}
case 2754: {
return true;
}
case 2757..2761: {
return true;
}
case 2778..2779: {
return true;
}
case 2785: {
return true;
}
case 2803..2806: {
return true;
}
case 2872..2873: {
return true;
}
case 2875..2881: {
return true;
}
case 2885..2920: {
return true;
}
case 2922..2923: {
return true;
}
case 2925..2940: {
return true;
}
case 2942..2952: {
return true;
}
case 2955..2959: {
return true;
}
case 2963..2966: {
return true;
}
case 2968..2978: {
return true;
}
case 2984..3015: {
return true;
}
case 3017..3032: {
return true;
}
case 3034..3047: {
return true;
}
case 3049..3050: {
return true;
}
case 3052..3061: {
return true;
}
case 3063..3069: {
return true;
}
case 3071..3072: {
return true;
}
case 3074..3093: {
return true;
}
case 3095..3109: {
return true;
}
case 3111: {
return true;
}
case 3113..3115: {
return true;
}
case 3117: {
return true;
}
case 3120..3127: {
return true;
}
case 3129..3133: {
return true;
}
case 3135: {
return true;
}
case 3221: {
return true;
}
case 3260..3265: {
return true;
}
case 3267: {
return true;
}
case 3275..3276: {
return true;
}
case 3278: {
return true;
}
case 3280..3282: {
return true;
}
case 3294: {
return true;
}
case 3302: {
return true;
}
case 3374: {
return true;
}
case 3379..3380: {
return true;
}
case 3407..3409: {
return true;
}
case 3460: {
return true;
}
case 3496..3497: {
return true;
}
case 3516: {
return true;
}
case 3593..3594: {
return true;
}
case 3794..3795: {
return true;
}
case 3797: {
return true;
}
case 3850..3851: {
return true;
}
case 3853: {
return true;
}
case 3855: {
return true;
}
case 3857..3859: {
return true;
}
case 3864: {
return true;
}
case 3872: {
return true;
}
case 3884: {
return true;
}
case 4084: {
return true;
}
case 5020: {
return true;
}
case 5043: {
return true;
}
case 5056: {
return true;
}
case 5061: {
return true;
}
case 5302: {
return true;
}
case 5340: {
return true;
}
case 5422: {
return true;
}
case 5678: {
return true;
}
case 5779: {
return true;
}
case 5856: {
return true;
}
case 6400: {
return true;
}
case 6517: {
return true;
}
case 7707: {
return true;
}
case 7709: {
return true;
}
case 7891: {
return true;
}
case 7927: {
return true;
}
case 7930..7931: {
return true;
}
case 8378: {
return true;
}
case 8948: {
return true;
}
case 8957: {
return true;
}
case 9093: {
return true;
}
case 9099: {
return true;
}
case 9625: {
return true;
}
case 9823: {
return true;
}
case 10149..10150: {
return true;
}
case 10182: {
return true;
}
case 10184: {
return true;
}
case 10246: {
return true;
}
case 10558: {
return true;
}
case 10575: {
return true;
}
case 10671: {
return true;
}
case 11102..11103: {
return true;
}
case 11225: {
return true;
}
case 11313: {
return true;
}
case 11319: {
return true;
}
case 11327: {
return true;
}
case 11416: {
return true;
}
case 12840: {
return true;
}
case 13028: {
return true;
}
case 13187..13188: {
return true;
}
case 13817: {
return true;
}
case 16328..16331: {
return true;
}
case 16333: {
return true;
}
case 16368: {
return true;
}
case 16500..16501: {
return true;
}
case 16627..16637: {
return true;
}
case 16732: {
return true;
}
case 16773: {
return true;
}
case 16775: {
return true;
}
case 17566: {
return true;
}
case 17951: {
return true;
}
case 17968: {
return true;
}
case 18553: {
return true;
}
}

return false;

}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)