From 9ca3abfadf100c20789b873b0edae958e113fafc Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 19 May 2018 00:03:40 +0200 Subject: [PATCH] Searchfield for AdminSpawn --- .../init/server_securityfunctions.sqf | 63 +++++++++++-------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/Sources/epoch_server/init/server_securityfunctions.sqf b/Sources/epoch_server/init/server_securityfunctions.sqf index 68275abf..b1b340cf 100644 --- a/Sources/epoch_server/init/server_securityfunctions.sqf +++ b/Sources/epoch_server/init/server_securityfunctions.sqf @@ -1734,6 +1734,7 @@ _skn_admincode = compileFinal (" "+_skn_tg_spawnTyp+" = _idc; _idc call "+_skn_fillSpawnMenu+"; }; + if (_idc == 4101) then {_idc call "+_skn_fillSpawnMenu+"}; '); "+_skn_spawnSpawnMenu+" = { _target = objNull; @@ -1796,13 +1797,13 @@ _skn_admincode = compileFinal (" _ctrl lbDelete _currentSelect; ']; - {_i = _x call "+_skn_getCtrl+";_i ctrlShow true;_i ctrlSetFade 1;_i ctrlcommit 0;_i ctrlSetFade 0;_i ctrlcommit 0.8}forEach[40,41,42,43,50,51,52,60,61,62,63,64,65,66,67,68,69,70,71]; + {_i = _x call "+_skn_getCtrl+";_i ctrlShow true;_i ctrlSetFade 1;_i ctrlcommit 0;_i ctrlSetFade 0;_i ctrlcommit 0.8}forEach[40,41,4101,42,43,50,51,52,60,61,62,63,64,65,66,67,68,69,70,71]; "+_skn_tg_spawnTyp+" call "+_skn_fillSpawnMenu+"; }; "+_skn_removespawnMenu+" = { if (ctrlShown (40 call "+_skn_getCtrl+")) then { - {_i = _x call "+_skn_getCtrl+";_i ctrlShow true;_i ctrlSetFade 1;_i ctrlcommit 0.8}forEach[40,41,42,43,50,51,52,60,61,62,63,64,65,66,67,68,69,70,71]; - [] spawn {uiSleep 0.8;{_x call "+_skn_getCtrl+" ctrlShow false}forEach[40,41,42,43,50,51,52,60,61,62,63,64,65,66,67,68,69,70,71]}; + {_i = _x call "+_skn_getCtrl+";_i ctrlShow true;_i ctrlSetFade 1;_i ctrlcommit 0.8}forEach[40,41,4101,42,43,50,51,52,60,61,62,63,64,65,66,67,68,69,70,71]; + [] spawn {uiSleep 0.8;{_x call "+_skn_getCtrl+" ctrlShow false}forEach[40,41,4101,42,43,50,51,52,60,61,62,63,64,65,66,67,68,69,70,71]}; true } else {false}; }; @@ -1811,15 +1812,17 @@ _skn_admincode = compileFinal (" lbclear _ctrl; _button = _this call "+_skn_getCtrl+"; _button ctrlSetTextColor [1, 0, 0, 1]; + _searchtxt = tolower (ctrlText((findDisplay -1337) displayCtrl 4101)); {_x call "+_skn_getCtrl+" ctrlSetTextColor [1, 1, 1, 1]}forEach([61,62,63,64,65,66,67,68,69,70,71]-[_this]); _cfgPricing = 'CfgPricing' call EPOCH_returnConfig; - if (_this == 61) then { + if ("+_skn_tg_spawnTyp+" == 61) then { _airVehicles = "" (configName _x) iskindof 'AIR' && getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'type') != 0 && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses (configFile >> 'CfgVehicles'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1827,13 +1830,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _airVehicles; }; - if (_this == 62) then { + if ("+_skn_tg_spawnTyp+" == 62) then { _landVehicles = "" (configName _x) iskindof 'LandVehicle' && getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && configName _x != 'PaperCar' && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses (configFile >> 'CfgVehicles'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1841,13 +1845,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _landVehicles; }; - if (_this == 63) then { + if ("+_skn_tg_spawnTyp+" == 63) then { _shipVehicles = "" (configName _x) iskindof 'SHIP' && getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'type') in [1,2,3,4] && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses (configFile >> 'CfgVehicles'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1855,13 +1860,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _shipVehicles; }; - if (_this == 64) then { + if ("+_skn_tg_spawnTyp+" == 64) then { _weapons = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && getNumber(_x >> 'type') in [1,2,4] && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses (configFile >> 'CfgWeapons'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1871,13 +1877,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _weapons; }; - if (_this == 65) then { + if ("+_skn_tg_spawnTyp+" == 65) then { _magazines = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && getText(_x >> 'ammo') != '' && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses (configFile >> 'CfgMagazines'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1885,13 +1892,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _magazines; }; - if (_this == 66) then { + if ("+_skn_tg_spawnTyp+" == 66) then { _magazines = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && getText(_x >> 'ammo') == '' && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses(configFile >> 'CfgMagazines'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1899,12 +1907,13 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _magazines; }; - if (_this == 67) then { + if ("+_skn_tg_spawnTyp+" == 67) then { _backpack = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'isbackpack') == 1 && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses(configFile >> 'CfgVehicles'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1912,13 +1921,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _backpack; }; - if (_this == 68) then { + if ("+_skn_tg_spawnTyp+" == 68) then { _uniforms = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && getNumber(_x >> 'ItemInfo' >> 'type') in [801] && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses(configFile >> 'CfgWeapons'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1926,13 +1936,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _uniforms; }; - if (_this == 69) then { + if ("+_skn_tg_spawnTyp+" == 69) then { _attachments = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && ((configName _x) call BIS_fnc_itemType) select 0 in ['Item'] && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses(configFile >> 'CfgWeapons'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1940,13 +1951,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _attachments; }; - if (_this == 70) then { + if ("+_skn_tg_spawnTyp+" == 70) then { _headgear = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && ((configName _x) call BIS_fnc_itemType) select 1 in ['Headgear'] && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses(configFile >> 'CfgWeapons'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')]; @@ -1954,13 +1966,14 @@ _skn_admincode = compileFinal (" _ctrl lbSetPicture[_index, getText(_x >> 'picture')]; }forEach _headgear; }; - if (_this == 71) then { + if ("+_skn_tg_spawnTyp+" == 71) then { _vests = "" getText(_x >> 'displayName') != '' && getText(_x >> 'picture') != '' && getNumber(_x >> 'scope') in [1,2] && ((configName _x) call BIS_fnc_itemType) select 1 in ['Vest'] && - isClass(_cfgPricing >> configName _x) + isClass(_cfgPricing >> configName _x) && + ((tolower (configName _x)) find (tolower _searchtxt) > -1 || tolower (getText(_x >> 'displayName')) find (tolower _searchtxt) > -1) ""configClasses(configFile >> 'CfgWeapons'); { _index = _ctrl lbAdd format['%1', getText(_x >> 'displayName')];