pawn-lang / samp-stdlib

The San Andreas Multiplayer Pawn Standard Library Package - designed for the sampctl package management system.
http://sampctl.com
48 stars 30 forks source link

More INVALID constants #19

Open WoutProvost opened 5 years ago

WoutProvost commented 5 years ago

Add commonly used INVALID constants, taken from here:

#define INVALID_SKIN_ID                 -1
#define INVALID_MODEL_ID                -1
#define INVALID_CHECKPOINT_ID               -1
#define INVALID_MAPICON_ID              -1
#define INVALID_PICKUP_ID               -1
#define INVALID_AREA_ID                 -1
#define INVALID_TIMER_ID                -1
#define INVALID_VIRTUAL_WORLD_ID            -1
#define INVALID_INTERIOR_ID             -1
#define INVALID_CLASS_ID                -1
#define INVALID_PAINTJOB_ID             -1
#define INVALID_VEHICLE_COLOR_ID            -2
#define INVALID_WEAPON_ID               -1

There might be others I haven't thought of.

Daniel-Cortez commented 5 years ago

define INVALID_VEHICLE_COLOR_ID -2

How is this one "invalid"? When you pass a vehicle color ID to SA-MP natives (ChangeVehicleColor, for example), the value gets truncated to just one byte, so for INVALID_VEHICLE_COLOR_ID the value -2 (0xFFFFFFFE) will be treated as 254 (0xFE), which is a valid color ID.

WoutProvost commented 5 years ago

Just see it as having a special meaning, in the same way that often -1 has a special meaning for vehicle colors: https://forum.sa-mp.com/showthread.php?t=339088 https://github.com/Open-GTO/sa-mp-fixes/issues/36