[Include] Is Valid
#1

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
  • Y-Less: For this tutorial.
Reply
#2

nice
love it <3
thanks!
Reply
#3

Some of them aren't quite acurate.
Reply
#4

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

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.
Reply
#6

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.
Reply
#7

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?
Reply
#8

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.
Reply
#9

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

http://pastebin.com/B5sJPnzH
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)