Skip to content

Handling data types

dotSILENT edited this page Nov 29, 2018 · 3 revisions

Most of the handling attributes are floats, however some of them are different and need to be treated according to their data type.

Table of CHandling data types and functions that should be used for them

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);
Clone this wiki locally