29.02.2012, 15:06
Returning a value is only relevant if that value is actually used in an assignment or a comparison. Most people tend to use -1 as an invalid value if a valid value that can be returned also includes 0 (e.g. an array index or playerid).
However, it is advised to use INVALID_PLAYER_ID, INVALID_VEHICLE_ID, etc if an invalid value is to be returned. This makes it easier to check and easier to read when viewing that part of the code again several weeks or months later.
However, it is advised to use INVALID_PLAYER_ID, INVALID_VEHICLE_ID, etc if an invalid value is to be returned. This makes it easier to check and easier to read when viewing that part of the code again several weeks or months later.