Bohemia have recently added getObjectTextures command to the game, to complement setObjectTexture/setObjectTextureGlobal commands. Because I’m going to use this new command in a script, the script will work only with game v1.37+ or on DEV branch right now. The command returns array of textures set on object. The numbers on a kart are also textures, one for 1st digit, one for 2nd digit. Indices for them are 2 and 3 respectfully. So to get kart number one needs to get texture names and parse them to extract numbers.

KK_fnc_getKartNumber = { private ["_tex1", "_tex2"]; _tex1 = (getObjectTextures _this) select 2; _tex2 = (getObjectTextures _this) select 3; format [ "%1%2", _tex1 select [count _tex1 - 8, 1], _tex2 select [count _tex2 - 8, 1] ] };

This function takes 1 argument, which is the kart object and returns a string which contains kart number:

getNum

hint (kart call KK_fnc_getKartNumber); //27

If you need to get a SCALAR and not a STRING you can just parse the string into a number:

_number = parseNumber (kart call KK_fnc_getKartNumber);

To set different number on a kart, you can use this function:

KK_fnc_setKartNumber = { private ["_kart", "_num", "_tex1", "_tex2"]; _kart = _this select 0; _num = _this select 1; if (_num < -1 || _num > 99) exitWith {false}; _tex1 = ""; _tex2 = ""; if (_num > -1) then { _num = if (_num < 10) then [{"0" + str _num},{str _num}]; _tex1 = format [ "\A3\Soft_F_Kart\Kart_01\Data\Kart_num_%1_CA.paa", _num select [0,1] ]; _tex2 = format [ "\A3\Soft_F_Kart\Kart_01\Data\Kart_num_%1_CA.paa", _num select [1,1] ]; }; _kart setObjectTextureGlobal [2, _tex1]; _kart setObjectTextureGlobal [3, _tex2]; true };

The function takes 2 arguments, kart object and desired number and returns true on success or false on failure:

setNum

hint str ([kart, 33] call KK_fnc_setKartNumber); //true

To reset the number simply use -1 for the number:

resetNum

hint str ([kart, -1] call KK_fnc_setKartNumber); //true

Enjoy,
KK