diff --git a/Altis_Life.Altis/Functions.hpp b/Altis_Life.Altis/Functions.hpp index fd9017d..001c372 100644 --- a/Altis_Life.Altis/Functions.hpp +++ b/Altis_Life.Altis/Functions.hpp @@ -195,6 +195,7 @@ class Life_Client_Core { class inventoryOpened {}; class isUIDActive {}; class keyHandler {}; + class commandHandler {}; class loadDeadGear {}; class loadGear {}; class nearATM {}; diff --git a/Altis_Life.Altis/core/admin/fn_adminCompensate.sqf b/Altis_Life.Altis/core/admin/fn_adminCompensate.sqf index 2e5d74d..09ed10f 100644 --- a/Altis_Life.Altis/core/admin/fn_adminCompensate.sqf +++ b/Altis_Life.Altis/core/admin/fn_adminCompensate.sqf @@ -10,7 +10,6 @@ private ["_value","_action"]; if (FETCH_CONST(life_adminlevel) < 2) exitWith {closeDialog 0; hint localize "STR_ANOTF_ErrorLevel";}; _value = parseNumber(ctrlText 9922); if (_value < 0) exitWith {}; -if (_value > 999999) exitWith {hint localize "STR_ANOTF_Fail"}; _action = [ format [localize "STR_ANOTF_CompWarn",[_value] call life_fnc_numberText], diff --git a/Altis_Life.Altis/core/functions/fn_commandHandler.sqf b/Altis_Life.Altis/core/functions/fn_commandHandler.sqf new file mode 100644 index 0000000..7a2aaaf --- /dev/null +++ b/Altis_Life.Altis/core/functions/fn_commandHandler.sqf @@ -0,0 +1,24 @@ + +// Messy and mostly stolen code +systemChat "Chat Key pressed"; + +// If the key pressed in the chat bar was not enter, move on +if ((_this select 1) != 28) exitWith {false}; +systemChat "Enter Pressed"; + +private _chatmsg = ctrlText (finddisplay 24 displayctrl 101); + +if ("/" != (_chatmsg select [0,1])) exitWith { }; +systemChat _chatmsg; + +(finddisplay 24 displayctrl 101) ctrlSetText ""; +// closeDialog 0; +// (findDisplay 24) closeDisplay 1; + +private _command = (_chatmsg splitString "/"); +private _args = (_command splitString " "); + +systemChat _command select 0; +hint format ["%1", _args]; + +(findDisplay 24) displayRemoveEventHandler ["KeyDown", chatCommandEventH]; diff --git a/Altis_Life.Altis/core/functions/fn_keyHandler.sqf b/Altis_Life.Altis/core/functions/fn_keyHandler.sqf index 57293b1..5bc77a1 100644 --- a/Altis_Life.Altis/core/functions/fn_keyHandler.sqf +++ b/Altis_Life.Altis/core/functions/fn_keyHandler.sqf @@ -54,6 +54,21 @@ if (life_container_active) then { true; }; +// Chat commands +if (inputAction "Chat" > 0) then +{ + systemChat "Chat Opened"; + + chatCommandSpawn = [] spawn + { + systemChat "Spawned event handler"; + + waitUntil {shownChat}; + waitUntil {!isNull (finddisplay 24 displayctrl 101)}; + chatCommandEventH = (findDisplay 24) displayAddEventHandler["KeyDown","_this call life_fnc_commandHandler"]; + }; +}; + switch (_code) do { // -- Disable commander/tactical view if (LIFE_SETTINGS(getNumber,"disableCommanderView") isEqualTo 1) then {