Code:
if(isNil "life_markers") then {
life_markers = false;
};
life_markers = !life_markers;
if (life_markers) then {
hint "Marker Acildi";
life_markers_active = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", "
private _vehicles = [];
private _crewNames = [];
private _entitiesInVehicle = [];
private _allUnits = [];
private _allDeads = [];
private ['_text','_vehicleTexture','_sideColor'];
{_entitiesInVehicle pushBackUnique _x;} forEach (allUnits select {!(isNull objectParent _x) && !(isNull _x)});
{_vehicles pushBackUnique _x;} forEach (vehicles select {((_x isKindOf ""LandVehicle"")||(_x isKindOf ""Air"")||(_x isKindOf ""Ship"")) && !(isNull _x)});
{_allUnits pushBackUnique _x;} forEach (allUnits select {!isNull _x});
{_allDeads pushBackUnique _x;} forEach (allDeadMen select {!(isNull _x) && !(_x in _allUnits)});
{
if !(isNull _x) then {
_vehicleTexture = [getText (configfile >> ""CfgVehicles"" >> typeOf _x >> ""icon"")] call BIS_fnc_textureVehicleIcon;
_sideColor = [side group _x] call BIS_fnc_sideColor;
if (_x in _vehicles) then {
if (crew _x isEqualTo []) then {
_text = getText (configfile >> 'CfgVehicles' >> typeOf _x >> 'displayName')
} else {
_crewNames = [];
{_crewNames pushBackUnique (_x getVariable['realname',name _x]);} forEach (crew _x select {alive _x});
_text = format ['%1',_crewNames joinString ' , '];
};
} else {
if (_x in _allDeads) then {
_text = _x getVariable['realname',''];
_sideColor = [East] call BIS_fnc_sideColor;
_vehicleTexture = ""pictureHeal"";
} else {
_text = _x getVariable['realname',name _x];
};
};
_this select 0 drawIcon [_vehicleTexture, _sideColor, getPosASLVisual _x, 24.0, 24.0, getDirVisual _x, _text, 0, 0.04, 'TahomaB', 'right'];
};
} forEach (_allUnits + _allDeads + _vehicles - _entitiesInVehicle);
"];
} else {
hint "Marker Kapatildi";
findDisplay 12 displayCtrl 51 ctrlRemoveEventHandler ["Draw", life_markers_active];
};