Allow fnc_lockCode to be used server/client side

This allows fnc_lockCode to be used by client and server side scripts.

This also does localization client side but server side the colors are
hard coded english.
This commit is contained in:
oiad
2020-04-07 10:29:17 +12:00
parent 95de5bb914
commit 24bd87cc5f
4 changed files with 29 additions and 21 deletions

View File

@@ -867,3 +867,30 @@ DZE_SafeZonePosCheck = {
};
_skipPos;
};
fnc_lockCode = {
private ["_color","_code","_cText"];
if (_this == "") exitWith {0};
_code = [_this,parseNumber _this] select (typeName _this == "STRING");
if (_code < 10000 || {_code > 10299}) exitWith {0};
_color = "";
_code = _code - 10000;
if (isDedicated) then { // Always show the code server side non localized.
_cText = ["Red","Green","Blue"];
} else {
_cText = [localize "STR_TEAM_RED",localize "STR_TEAM_GREEN",localize "STR_TEAM_BLUE"];
};
if (_code <= 99) then {_color = _cText select 0;};
if (_code >= 100 && {_code <= 199}) then {_color = _cText select 1; _code = _code - 100;};
if (_code >= 200) then {_color = _cText select 2; _code = _code - 200;};
if (_code <= 9) then {_code = format["0%1", _code];};
_code = format ["%1%2",_color,_code];
_code
};

View File

@@ -1,18 +0,0 @@
private ["_color","_code"];
if (_this == "") exitWith {0};
_code = [_this,parseNumber _this] select (typeName _this == "STRING");
if (_code < 10000 || {_code > 10299}) exitWith {0};
_color = "";
_code = _code - 10000;
if (_code <= 99) then {_color = "Red";};
if (_code >= 100 && {_code <= 199}) then {_color = "Green"; _code = _code - 100;};
if (_code >= 200) then {_color = "Blue"; _code = _code - 200;};
if (_code <= 9) then {_code = format["0%1", _code];};
_code = format ["%1%2",_color,_code];
_code

View File

@@ -122,8 +122,8 @@ if (_status < 4) then {
"LockBox"
};
if (_type == "LockboxStorageLocked") exitwith {
_lockCode = _charID call server_fnc_lockCode;
if (_status == 3) then {_suppliedCode = _suppliedCode call server_fnc_lockCode;};
_lockCode = _charID call fnc_lockCode;
if (_status == 3) then {_suppliedCode = _suppliedCode call fnc_lockCode;};
"LockBox"
};
};

View File

@@ -44,7 +44,6 @@ server_tradeObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compi
server_deaths = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDeaths.sqf";
server_maintainArea = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_maintainArea.sqf";
server_checkIfTowed = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_checkIfTowed.sqf";
server_fnc_lockCode = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_fnc_lockCode.sqf";
server_handleSafeGear = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_handleSafeGear.sqf";
spawn_ammosupply = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\spawn_ammosupply.sqf";
spawn_mineveins = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\spawn_mineveins.sqf";