SA-MP Forums Archive
IsValidObjectModelID for objects - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: IsValidObjectModelID for objects (/showthread.php?tid=287511)



IsValidObjectModelID for objects - Libra_PL - 03.10.2011

Hey!

I need a 'function' which returns true or false if object model ID exists... It's something like IsValidObjectModelID(modelid), but I couldn't find anywhere and there are thousands IDs I would need to check is valid or not (it would take days!).

Thanks for anwsers.


Re: IsValidObjectModelID for objects - Pharrel - 03.10.2011

pawn Код:
public IsValidObjectID( objectid )
{
    if(
    //weapons
    ( objectid >= 321 && objectid <= 326 )
    || ( objectid >= 330 && objectid <= 331 )
    || ( objectid >= 333 && objectid <= 339 )
    || ( objectid >= 341 && objectid <= 344 )
    || ( objectid >= 346 && objectid <= 363 )
    || ( objectid >= 365 && objectid <= 372 )

    //fun stuff
    || ( objectid >= 1433 && objectid <= 13594 )

    //roads
    || ( objectid >= 5482 && objectid <= 5512 )

    //barriers
    || ( objectid >= 966 && objectid <= 998 )

    //misc 1210-1325
    || ( objectid >= 1210 && objectid <= 1325 )

    //misc 1420-1620
    || ( objectid >= 1420 && objectid <= 1620 )

    //misc 1971-4522
    || ( objectid >= 1971 && objectid <= 4522 ) )
    {
     return 1;
    }
    return 0;
}
dont have the 0.3c objects i think...


Re: IsValidObjectModelID for objects - iPLEOMAX - 03.10.2011

I have the array of Valid objects with their names in the script of this FS: https://sampforum.blast.hk/showthread.php?tid=282883