#include "..\..\script_macros.hpp"
/*
File: fn_keyMenu.sqf
Author: Bryan "Tonic" Boardwine
Description:
Initializes the key menu
Will be revised.
*/
private["_display","_vehicles","_plist","_near_units","_pic","_name","_text","_color","_index","_type","_p_units"];
disableSerialization;
waitUntil {!isNull (findDisplay 2700)};
_display = findDisplay 2700;
_vehicles = _display displayCtrl 2701;
lbClear _vehicles;
_plist = _display displayCtrl 2702;
lbClear _plist;
_near_units = [];
_p_units = playableUnits;
//{ if(player distance _x < 20) then {_near_units pushBack _x};} foreach playableUnits;
{ _near_units pushBack (name _x); } foreach _p_units;
for "_i" from 0 to (count life_vehicles)-1 do {
_veh = life_vehicles select _i;
if(!isNull _veh && alive _veh) then {
_color = SEL(SEL(M_CONFIG(getArray,CONFIG_LIFE_VEHICLES,(typeOf _veh),"textures"),(_veh GVAR "Life_VEH_color")),0);
if(isNil "_color") then {_color = ""};
_text = format["(%1)",_color];
if(_text == "()") then {
_text = "";
};
_name = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "displayName");
_pic = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "picture");
_vehicles lbAdd format["%1 %3 - [Distance: %2m]",_name,round(player distance _veh),_text];
if(_pic != "pictureStaticObject") then {
_vehicles lbSetPicture [(lbSize _vehicles)-1,_pic];
};
_vehicles lbSetData [(lbSize _vehicles)-1,str(_i)];
};
};
/*
{
if(!isNull _x && alive _x && player distance _x < 20 && _x != player) then {
_plist lbAdd format["%1 - %2",_x getVariable["realname",name _x], side _x];
_plist lbSetData [(lbSize _plist)-1,str(_x)];
};
} foreach _near_units;
*/
_plist lbAdd format["%1","Cible"];
_plist lbSetData [(lbSize _plist)-1,"targetkeygive"];
_near_units = _near_units call BIS_fnc_sortAlphabetically;
{
_name = _x;
{
if ((!isNull _x) && {name _x == _name} && {alive _x} && {_x != player}) then
{
switch (side _x) do
{
case west: {_type = "Cop";};
case civilian: {_type = "Civ";};
case independent: {_type = "Med";};
case east {_type = "adac";};
};
_plist lbAdd format["%1 (%2)",_x getVariable["realname",name _x], _type];
_plist lbSetData [(lbSize _plist)-1,str(_x)];
};
} foreach _p_units;
} foreach _near_units;
if(((lbSize _vehicles)-1) == -1) then {
_vehicles lbAdd "You don't own any vehicles";
_vehicles lbSetData [(lbSize _vehicles)-1,str(ObjNull)];
};
Comments
0 B
|👍
/👎