samp-stdlib icon indicating copy to clipboard operation
samp-stdlib copied to clipboard

More INVALID constants

Open WoutProvost opened this issue 6 years ago • 2 comments

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.

WoutProvost avatar Jul 12 '19 20:07 WoutProvost

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

Daniel-Cortez avatar Jul 14 '19 10:07 Daniel-Cortez

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

WoutProvost avatar Jul 14 '19 11:07 WoutProvost