SA-MP Forums Archive
[Include] Is Valid - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Is Valid (/showthread.php?tid=309416)



Is Valid - T0pAz - 07.01.2012

Introduction
Is Valid is an include which checks if it's a valid interior id, sound id, weather id, color id, pickup type, pickup id, weapon id, explosion, crime, vehicle id.





Features
  • Uses Macros
  • Portable







Installation
  • Not needed








How to use
Paste the code on top of your script or download it as an include file and include it.








Change Log
Код:
v1.0
++
Initial Release






Download

pawn Код:
#define IsValidInteriorID(%0) \
    ((%0) != 13 && (%0) < 19)
   
#define IsValidSoundID(%0) \  //Thanks to ******
        (999 < (%0) < 45399)
   
#define IsValidWeatherID(%0) \
    (%0 < 46)
   
#define IsValidColorID(%0) \
    (%0 < 127)

#define IsValidPickupType(%0) \
    (%0 < 24)
   
#define IsValidPickupModel(%0) \
    ((%0 > 1239) && (%0 < 1280))
   
#define IsValidWeaponID(%0) \
    (%0 < 47)

#define IsValidExplosion(%0) \
    (%0 < 14)
   
#define IsValidCrime(%0) \
    ((%0 > 2) && (%0 < 23))
   
#define IsValidVehicleModel(%0) \
    ((%0 > 399) && (%0 < 612))









Credits


Re: Is Valid - Kaperstone - 07.01.2012

nice
love it <3
thanks!


Re: Is Valid - RyDeR` - 07.01.2012

Some of them aren't quite acurate.


Re: Is Valid - T0pAz - 07.01.2012

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
Some of them aren't quite acurate.
Can you specify them?


Re: Is Valid - Joe_ - 07.01.2012

There are many more valid weather IDs, but there's not much use to this as it doesn't make invalid checks faster, just easier to read I guess, but good effort anyway.


Re: Is Valid - T0pAz - 07.01.2012

Quote:
Originally Posted by Joe_
Посмотреть сообщение
There are many more valid weather IDs, but there's not much use to this as it doesn't make invalid checks faster, just easier to read I guess, but good effort anyway.
I excluded the weather ids which causes crash and bugs.


Re: Is Valid - T0pAz - 07.01.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
pawn Код:
#define IsValidInteriorID(%0) \
    ((%0) != 13 && (%0) < 19)
   
#define IsValidSoundID(%0) \
    (999 < (%0) < 45399)
   
#define IsValidWeatherID(%0) \
    (%0 < 46)
   
#define IsValidColorID(%0) \
    (%0 < 127)

#define IsValidPickupType(%0) \
    (%0 < 24)
   
#define IsValidPickupID(%0) \
    (1239 < (%0) < 1280)
   
#define IsValidWeaponID(%0) \
    (%0 < 47)

#define IsValidExplosion(%0) \
    (%0 < 14)
   
#define IsValidCrime(%0) \
    (2 < (%0) < 23)
   
#define IsValidVehicleID(%0) \
    (399 < (%0) < 612)
Could you please tell me what have you changed and for what reason?


Re: Is Valid - CyNiC - 07.01.2012

pawn Код:
IsValidVehicleID
Vehicles ids" are ids of creation(returned from function), you should change the function name for IsValidVehicleModel.

Same for IsValidPickupID, and you need to know that any object model id can be used as pickup model id.


Re: Is Valid - RyDeR` - 07.01.2012

IsValidSoundID for example is not correct. There are invalid ID's between those values.

http://pastebin.com/B5sJPnzH


Re: Is Valid - T0pAz - 07.01.2012

@Ryder and @Cynic I will check them. Thanks for informing.