-
Notifications
You must be signed in to change notification settings - Fork 3
Handling data types
dotSILENT edited this page Nov 29, 2018
·
3 revisions
Most of the handling attributes are float
s, however some of them are different and need to be treated according to their data type.
Type | Description | Functions to use |
---|---|---|
TYPE_NONE | N/A | N/A |
TYPE_UINT | Unsigned Integer (32 bit) | Get*HandlingInt, Set*HandlingInt |
TYPE_FLOAT | Float (32 bit) | Get*HandlingFloat, Set*HandlingFloat |
TYPE_BYTE | Unsigned char (8 bit) | Same as TYPE_UINT |
TYPE_FLAG | Unsigned integer (32 bit) | Same as TYPE_UINT |
As you can see, you only need to consider float and integer when using Get and Set functions, however using GetHandlingAttribType() will return the proper data type of the requested attribute, so you need to take it into consideration when checking the type in Pawn. Example:
new attrib; // let's assume it's loaded from an database for example
new Float:floatval, intval; // and this is also laoded from an database
new CHandlingAttribType:type = GetHandlingAttribType(attrib);
if(type == TYPE_UINT || TYPE == TYPE_FLAG || TYPE == TYPE_BYTE) // any of these types can be set with Set*HandlingInt
SetVehicleHandlingInt(vehicleid, attrib, intval);
else
SetVehicleHandlingFloat(vehicleid, attrib, floatval);