initial commit

This commit is contained in:
Benjamin Kyd
2019-06-05 00:45:50 +01:00
commit c8014ec81e
610 changed files with 177002 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#include "..\..\script_macros.hpp"
/*
File: fn_bankDeposit.sqf
Author: Bryan "Tonic" Boardwine
Description:
Figure it out.
*/
private ["_value"];
_value = parseNumber(ctrlText 2702);
//Series of stupid checks
if (_value > 999999) exitWith {hint localize "STR_ATM_GreaterThan";};
if (_value < 0) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_value > CASH) exitWith {hint localize "STR_ATM_NotEnoughCash"};
CASH = CASH - _value;
BANK = BANK + _value;
hint format [localize "STR_ATM_DepositSuccess",[_value] call life_fnc_numberText];
[] call life_fnc_atmMenu;
[6] call SOCK_fnc_updatePartial;
if (LIFE_SETTINGS(getNumber,"player_moneyLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
money_log = format [localize "STR_DL_ML_depositedBank_BEF",_value,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
} else {
money_log = format [localize "STR_DL_ML_depositedBank",profileName,(getPlayerUID player),_value,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
};
publicVariableServer "money_log";
};

View File

@@ -0,0 +1,37 @@
#include "..\..\script_macros.hpp"
/*
File: fn_bankTransfer.sqf
Author: Bryan "Tonic" Boardwine
Description:
Figure it out again.
*/
private ["_value","_unit","_tax"];
_value = parseNumber(ctrlText 2702);
_unit = call compile format ["%1",(lbData[2703,(lbCurSel 2703)])];
if (isNull _unit) exitWith {};
if ((lbCurSel 2703) isEqualTo -1) exitWith {hint localize "STR_ATM_NoneSelected"};
if (isNil "_unit") exitWith {hint localize "STR_ATM_DoesntExist"};
if (_value > 999999) exitWith {hint localize "STR_ATM_TransferMax";};
if (_value < 0) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_value > BANK) exitWith {hint localize "STR_ATM_NotEnoughFunds"};
_tax = _value * LIFE_SETTINGS(getNumber,"bank_transferTax");
if ((_value + _tax) > BANK) exitWith {hint format [localize "STR_ATM_SentMoneyFail",_value,_tax]};
BANK = BANK - (_value + _tax);
[_value,profileName] remoteExecCall ["life_fnc_wireTransfer",_unit];
[] call life_fnc_atmMenu;
[1] call SOCK_fnc_updatePartial;
hint format [localize "STR_ATM_SentMoneySuccess",[_value] call life_fnc_numberText,_unit getVariable ["realname",name _unit],[_tax] call life_fnc_numberText];
if (LIFE_SETTINGS(getNumber,"player_moneyLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
money_log = format [localize "STR_DL_ML_transferredBank_BEF",_value,_unit getVariable ["realname",name _unit],[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
} else {
money_log = format [localize "STR_DL_ML_transferredBank",profileName,(getPlayerUID player),_value,_unit getVariable ["realname",name _unit],[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
};
publicVariableServer "money_log";
};

View File

@@ -0,0 +1,30 @@
#include "..\..\script_macros.hpp"
/*
File: fn_bankWithdraw.sqf
Author: Bryan "Tonic" Boardwine
Description:
Withdraws money from the players account
*/
private ["_value"];
_value = parseNumber(ctrlText 2702);
if (_value > 999999) exitWith {hint localize "STR_ATM_WithdrawMax";};
if (_value < 0) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_value > BANK) exitWith {hint localize "STR_ATM_NotEnoughFunds"};
if (_value < 100 && BANK > 20000000) exitWith {hint localize "STR_ATM_WithdrawMin"}; //Temp fix for something.
CASH = CASH + _value;
BANK = BANK - _value;
hint format [localize "STR_ATM_WithdrawSuccess",[_value] call life_fnc_numberText];
[] call life_fnc_atmMenu;
[6] call SOCK_fnc_updatePartial;
if (LIFE_SETTINGS(getNumber,"player_moneyLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
money_log = format [localize "STR_DL_ML_withdrewBank_BEF",_value,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
} else {
money_log = format [localize "STR_DL_ML_withdrewBank",profileName,(getPlayerUID player),_value,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
};
publicVariableServer "money_log";
};

View File

@@ -0,0 +1,14 @@
/*
File: fn_displayHandler.sqf
Author: Bryan "Tonic" Boardwine
Description:
Master display handler
*/
private ["_control","_code","_shift","_ctrlKey","_alt","_handled"];
_handled = false;
//Esc Key Handler
if ((_this select 1) isEqualTo 1) then {_handled = true;};
_handled;

View File

@@ -0,0 +1,16 @@
#include "..\..\script_macros.hpp"
/*
File: fn_gankBankResponse.sqf
Author: DomT602
Description:
Receives response from the server.
*/
params [
["_value",-1,[0]]
];
if (remoteExecutedOwner != ([2,HC_Life] select life_HC_isActive)) exitWith {};
if (_value isEqualTo -1) exitWith {};
hint format [localize "STR_ATM_WithdrawSuccessG",[_value] call life_fnc_numberText];
CASH = CASH + _value;
[] call life_fnc_atmMenu;

View File

@@ -0,0 +1,42 @@
#include "..\..\script_macros.hpp"
/*
File: fn_gangDeposit.sqf
Author: Bryan "Tonic" Boardwine
Description:
Deposits money into the players gang bank.
*/
private ["_value"];
_value = parseNumber(ctrlText 2702);
group player setVariable ["gbank_in_use_by",player,true];
//Series of stupid checks
if (_value > 999999) exitWith {hint localize "STR_ATM_GreaterThan";};
if (_value < 0) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_value > CASH) exitWith {hint localize "STR_ATM_NotEnoughCash"};
if ((group player getVariable ["gbank_in_use_by",player]) != player) exitWith {hint localize "STR_ATM_WithdrawMin"}; //Check if it's in use.
CASH = CASH - _value;
_gFund = GANG_FUNDS;
_gFund = _gFund + _value;
group player setVariable ["gang_bank",_gFund,true];
if (life_HC_isActive) then {
[1,group player] remoteExecCall ["HC_fnc_updateGang",HC_Life];
} else {
[1,group player] remoteExecCall ["TON_fnc_updateGang",RSERV];
};
hint format [localize "STR_ATM_DepositSuccessG",[_value] call life_fnc_numberText];
[] call life_fnc_atmMenu;
[6] call SOCK_fnc_updatePartial; //Silent Sync
if (LIFE_SETTINGS(getNumber,"player_moneyLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
money_log = format [localize "STR_DL_ML_depositeGang_BEF",_value,[_gFund] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
} else {
money_log = format [localize "STR_DL_ML_depositeGang",profileName,(getPlayerUID player),_value,[_gFund] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
};
publicVariableServer "money_log";
};

View File

@@ -0,0 +1,43 @@
#include "..\..\script_macros.hpp"
/*
File: fn_gangWithdraw.sqf
Author: Bryan "Tonic" Boardwine
Description:
Withdraws money from the gang bank.
*/
private ["_value"];
_value = parseNumber(ctrlText 2702);
_gFund = GANG_FUNDS;
group player setVariable ["gbank_in_use_by",player,true];
//Series of stupid checks
if (_value > 999999) exitWith {hint localize "STR_ATM_WithdrawMax";};
if (_value < 0) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_value > _gFund) exitWith {hint localize "STR_ATM_NotEnoughFundsG"};
if (_val < 100 && _gFund > 20000000) exitWith {hint localize "STR_ATM_WithdrawMin"}; //Temp fix for something.
if ((group player getVariable ["gbank_in_use_by",player]) != player) exitWith {hint localize "STR_ATM_WithdrawInUseG"}; //Check if it's in use.
_gFund = _gFund - _value;
CASH = CASH + _value;
group player setVariable ["gang_bank",_gFund,true];
if (life_HC_isActive) then {
[1,group player] remoteExec ["HC_fnc_updateGang",HC_Life]; //Update the database.
} else {
[1,group player] remoteExec ["TON_fnc_updateGang",RSERV]; //Update the database.
};
hint format [localize "STR_ATM_WithdrawSuccessG",[_value] call life_fnc_numberText];
[] call life_fnc_atmMenu;
[6] call SOCK_fnc_updatePartial;
if (LIFE_SETTINGS(getNumber,"player_moneyLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
money_log = format [localize "STR_DL_ML_withdrewGang_BEF",_value,[_gFund] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
} else {
money_log = format [localize "STR_DL_ML_withdrewGang",profileName,(getPlayerUID player),_value,[_gFund] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
};
publicVariableServer "money_log";
};

View File

@@ -0,0 +1,79 @@
#include "..\..\script_macros.hpp"
/*
File: fn_garageLBChange.sqf
Author: Bryan "Tonic" Boardwine
Description:
Can't be bothered to answer it.. Already deleted it by accident..
*/
disableSerialization;
private ["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_price","_storageFee","_purchasePrice"];
_control = _this select 0;
_index = _this select 1;
//Fetch some information.
_dataArr = CONTROL_DATAI(_control,_index);
_dataArr = call compile format ["%1",_dataArr];
_className = (_dataArr select 0);
_classNameLife = _className;
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
_classNameLife = "Default"; //Use Default class if it doesn't exist
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
};
_vehicleColor = ((M_CONFIG(getArray,"LifeCfgVehicles",_classNameLife,"textures") select (_dataArr select 1)) select 0);
if (isNil "_vehicleColor") then {_vehicleColor = "Default";};
_vehicleInfo = [_className] call life_fnc_fetchVehInfo;
_trunkSpace = [_className] call life_fnc_vehicleWeightCfg;
_price = M_CONFIG(getNumber,"LifeCfgVehicles",_classNameLife,"price");
_storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");
switch (playerSide) do {
case civilian: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
};
case west: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
};
case independent: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
};
case east: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
};
};
_retrievePrice = _purchasePrice * _storageFee;
_sellPrice = _purchasePrice * _sellMultiplier;
if (!(_sellPrice isEqualType 0) || _sellPrice < 1) then {_sellPrice = 500;};
if (!(_retrievePrice isEqualType 0) || _retrievePrice < 1) then {_retrievePrice = 500;};
(CONTROL(2800,2803)) ctrlSetStructuredText parseText format [
(localize "STR_Shop_Veh_UI_RetrievalP")+ " <t color='#8cff9b'>$%1</t><br/>
" +(localize "STR_Shop_Veh_UI_SellP")+ " <t color='#8cff9b'>$%2</t><br/>
" +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/>
" +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " %3 km/h<br/>
" +(localize "STR_Shop_Veh_UI_HPower")+ " %4<br/>
" +(localize "STR_Shop_Veh_UI_PSeats")+ " %5<br/>
" +(localize "STR_Shop_Veh_UI_Trunk")+ " %6<br/>
" +(localize "STR_Shop_Veh_UI_Fuel")+ " %7
",
[_retrievePrice] call life_fnc_numberText,
[_sellPrice] call life_fnc_numberText,
(_vehicleInfo select 8),
(_vehicleInfo select 11),
(_vehicleInfo select 10),
if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
(_vehicleInfo select 12),
_vehicleColor
];
ctrlShow [2803,true];
ctrlShow [2830,true];

View File

@@ -0,0 +1,36 @@
#include "..\..\script_macros.hpp"
/*
File: fn_impoundMenu.sqf
Author: Bryan "Tonic" Boardwine
Description:
Not actually a impound menu, may act as confusion to some but that is what I wanted.
The purpose of this menu is it is now called a 'Garage' where vehicles are stored (persistent ones).
*/
private ["_vehicles","_control"];
disableSerialization;
_vehicles = param [0,[],[[]]];
ctrlShow[2803,false];
ctrlShow[2830,false];
waitUntil {!isNull (findDisplay 2800)};
if (count _vehicles isEqualTo 0) exitWith {
ctrlSetText[2811,localize "STR_Garage_NoVehicles"];
};
_control = CONTROL(2800,2802);
lbClear _control;
{
_vehicleInfo = [(_x select 2)] call life_fnc_fetchVehInfo;
_control lbAdd (_vehicleInfo select 3);
_tmp = [(_x select 2),(_x select 8)];
_tmp = str(_tmp);
_control lbSetData [(lbSize _control)-1,_tmp];
_control lbSetPicture [(lbSize _control)-1,(_vehicleInfo select 2)];
_control lbSetValue [(lbSize _control)-1,(_x select 0)];
} forEach _vehicles;
ctrlShow[2810,false];
ctrlShow[2811,false];

View File

@@ -0,0 +1,14 @@
/*
File: fn_progressBar.sqf
Author: Bryan "Tonic" Boardwine
Description:
Initializes the progress bar.
*/
disableSerialization;
private ["_ui","_progress"];
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_progress progressSetPosition 0.5;

View File

@@ -0,0 +1,57 @@
#include "..\..\script_macros.hpp"
/*
File: fn_safeFix.sqf
Author: Bryan "Tonic" Boardwine
Description:
Piece of functionality for the cops to close the safe (lock it)
*/
private "_vault";
_vault = _this select 0;
if (!(_vault getVariable ["safe_open",false])) exitWith {hint localize "STR_Cop_VaultLocked"};
life_action_inUse = true;
//Setup the progress bar
disableSerialization;
_title = localize "STR_Cop_RepairVault";
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progressBar = _ui displayCtrl 38201;
_titleText = _ui displayCtrl 38202;
_titleText ctrlSetText format ["%2 (1%1)...","%",_title];
_progressBar progressSetPosition 0.01;
_cP = 0.01;
for "_i" from 0 to 1 step 0 do {
if (animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then {
[player,"AinvPknlMstpSnonWnonDnon_medic_1",true] remoteExecCall ["life_fnc_animSync",RCLIENT];
player switchMove "AinvPknlMstpSnonWnonDnon_medic_1";
player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
};
sleep 0.26;
if (isNull _ui) then {
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progressBar = _ui displayCtrl 38201;
_titleText = _ui displayCtrl 38202;
};
_cP = _cP + .012;
_progressBar progressSetPosition _cP;
_titleText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_title];
if (_cP >= 1 || !alive player) exitWith {};
if (life_interrupted) exitWith {};
};
//Kill the UI display and check for various states
"progressBar" cutText ["","PLAIN"];
player playActionNow "stop";
if (!alive player) exitWith {life_action_inUse = false;};
if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};
life_action_inUse = false;
_vault setVariable ["safe_open",false,true];
hint localize "STR_Cop_VaultRepaired";

View File

@@ -0,0 +1,27 @@
#include "..\..\script_macros.hpp"
/*
File: fn_safeInventory.sqf
Author: Bryan "Tonic" Boardwine
Description:
Fills up the safes inventory.
*/
private ["_safe","_tInv","_pInv","_safeInfo","_str","_shrt","_icon"];
_safe = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _safe) exitWith {closeDialog 0;};
disableSerialization;
_tInv = (findDisplay 3500) displayCtrl 3502;
lbClear _tInv;
_safeInfo = _safe getVariable ["safe",-1];
if (_safeInfo < 1) exitWith {closeDialog 0; hint localize "STR_Civ_VaultEmpty";};
_str = M_CONFIG(getText,"VirtualItems","goldbar","displayName");
_shrt = M_CONFIG(getText,"VirtualItems","goldbar","variable");
_tInv lbAdd format ["[%1] - %2",_safeInfo,(localize _str)];
_tInv lbSetData [(lbSize _tInv)-1,_shrt];
_icon = M_CONFIG(getText,"VirtualItems","goldbar","icon");
if (!(_icon isEqualTo "")) then {
_tInv lbSetPicture [(lbSize _tInv)-1,_icon];
};

View File

@@ -0,0 +1,28 @@
#include "..\..\script_macros.hpp"
/*
File: fn_safeOpen.sqf
Author: Bryan "Tonic" Boardwine
Description:
Opens the safe inventory menu.
*/
if (dialog) exitWith {}; //A dialog is already open.
life_safeObj = param [0,objNull,[objNull]];
if (isNull life_safeObj) exitWith {};
if !(playerSide isEqualTo civilian) exitWith {};
if ((life_safeObj getVariable ["safe",-1]) < 1) exitWith {hint localize "STR_Civ_VaultEmpty";};
if (life_safeObj getVariable ["inUse",false]) exitWith {hint localize "STR_Civ_VaultInUse"};
if (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops"))) exitWith {
hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))];
};
if (!createDialog "Federal_Safe") exitWith {localize "STR_MISC_DialogError"};
disableSerialization;
ctrlSetText[3501,(localize "STR_Civ_SafeInv")];
[life_safeObj] call life_fnc_safeInventory;
life_safeObj setVariable ["inUse",true,true];
[life_safeObj] spawn {
waitUntil {isNull (findDisplay 3500)};
(_this select 0) setVariable ["inUse",false,true];
};

View File

@@ -0,0 +1,26 @@
#include "..\..\script_macros.hpp"
/*
File: fn_safeStore.sqf
Author: Bryan "Tonic" Boardwine
Description:
Gateway copy of fn_vehStoreItem but designed for the safe.
*/
private ["_ctrl","_num"];
disableSerialization;
_ctrl = CONTROL_DATA(3503);
_num = ctrlText 3506;
//Error checks
if (!([_num] call TON_fnc_isnumber)) exitWith {hint localize "STR_MISC_WrongNumFormat";};
_num = parseNumber(_num);
if (_num < 1) exitWith {hint localize "STR_Cop_VaultUnder1";};
if (!(_ctrl isEqualTo "goldBar")) exitWith {hint localize "STR_Cop_OnlyGold"};
if (_num > life_inv_goldbar) exitWith {hint format [localize "STR_Cop_NotEnoughGold",_num];};
//Store it.
if (!([false,_ctrl,_num] call life_fnc_handleInv)) exitWith {hint localize "STR_Cop_CantRemove";};
_safeInfo = life_safeObj getVariable ["safe",0];
life_safeObj getVariable ["safe",_safeInfo + _num,true];
[life_safeObj] call life_fnc_safeInventory;

View File

@@ -0,0 +1,32 @@
#include "..\..\script_macros.hpp"
/*
File: fn_safeTake.sqf
Author: Bryan "Tonic" Boardwine
Description:
Gateway to fn_vehTakeItem.sqf but for safe(s).
*/
private ["_ctrl","_num","_safeInfo"];
disableSerialization;
if ((lbCurSel 3502) isEqualTo -1) exitWith {hint localize "STR_Civ_SelectItem";};
_ctrl = CONTROL_DATA(3502);
_num = ctrlText 3505;
_safeInfo = life_safeObj getVariable ["safe",0];
//Error checks
if (!([_num] call TON_fnc_isnumber)) exitWith {hint localize "STR_MISC_WrongNumFormat";};
_num = parseNumber(_num);
if (_num < 1) exitWith {hint localize "STR_Cop_VaultUnder1";};
if (!(_ctrl isEqualTo "goldBar")) exitWith {hint localize "STR_Cop_OnlyGold"};
if (_num > _safeInfo) exitWith {hint format [localize "STR_Civ_IsntEnoughGold",_num];};
//Secondary checks
_num = [_ctrl,_num,life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
if (_num isEqualTo 0) exitWith {hint localize "STR_NOTF_InvFull"};
//Take it
if (!([true,_ctrl,_num] call life_fnc_handleInv)) exitWith {hint localize "STR_NOTF_CouldntAdd";};
life_safeObj setVariable ["safe",_safeInfo - _num,true];
[life_safeObj] call life_fnc_safeInventory;

View File

@@ -0,0 +1,69 @@
#include "..\..\script_macros.hpp"
/*
File: fn_sellGarage.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sells a vehicle from the garage.
*/
private ["_vehicle","_vehicleLife","_vid","_pid","_sellPrice","_multiplier","_price","_purchasePrice"];
disableSerialization;
if ((lbCurSel 2802) isEqualTo -1) exitWith {hint localize "STR_Global_NoSelection"};
_vehicle = lbData[2802,(lbCurSel 2802)];
_vehicle = (call compile format ["%1",_vehicle]) select 0;
_vehicleLife = _vehicle;
_vid = lbValue[2802,(lbCurSel 2802)];
_pid = getPlayerUID player;
if (isNil "_vehicle") exitWith {hint localize "STR_Garage_Selection_Error"};
if ((time - life_action_delay) < 1.5) exitWith {hint localize "STR_NOTF_ActionDelay";};
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _vehicleLife)) then {
_vehicleLife = "Default"; //Use Default class if it doesn't exist
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_vehicle];
};
_price = M_CONFIG(getNumber,"LifeCfgVehicles",_vehicleLife,"price");
switch (playerSide) do {
case civilian: {
_multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
};
case west: {
_multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
};
case independent: {
_multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
};
case east: {
_multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
};
};
_sellPrice = _purchasePrice * _multiplier;
if (!(_sellPrice isEqualType 0) || _sellPrice < 1) then {_sellPrice = 500;};
if (life_HC_isActive) then {
[_vid,_pid,_sellPrice,player,life_garage_type] remoteExecCall ["HC_fnc_vehicleDelete",HC_Life];
} else {
[_vid,_pid,_sellPrice,player,life_garage_type] remoteExecCall ["TON_fnc_vehicleDelete",RSERV];
};
hint format [localize "STR_Garage_SoldCar",[_sellPrice] call life_fnc_numberText];
BANK = BANK + _sellPrice;
[1] call SOCK_fnc_updatePartial;
if (LIFE_SETTINGS(getNumber,"player_advancedLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
advanced_log = format [localize "STR_DL_AL_soldVehicle_BEF",_vehicleLife,[_sellPrice] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
} else {
advanced_log = format [localize "STR_DL_AL_soldVehicle",profileName,(getPlayerUID player),_vehicleLife,[_sellPrice] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
};
publicVariableServer "advanced_log";
};
life_action_delay = time;
closeDialog 0;

View File

@@ -0,0 +1,18 @@
/*
File: fn_setMapPosition.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sets the given control / maps focus position
*/
disableSerialization;
private ["_control","_time","_zoom","_position"];
_control = [_this,0,controlNull,[controlNull]] call BIS_fnc_param;
_time = [_this,1,1,[0]] call BIS_fnc_param;
_zoom = [_this,2,0.1,[0]] call BIS_fnc_param;
_position = [_this,3,[],[[]]] call BIS_fnc_param;
if (isNull _control || _position isEqualTo []) exitWith {};
_control ctrlMapAnimAdd[_time,_zoom,_position];
ctrlMapAnimCommit _control;

View File

@@ -0,0 +1,62 @@
/*
File: fn_spawnConfirm.sqf
Author: Bryan "Tonic" Boardwine
Description:
Spawns the player where he selected.
*/
private ["_spCfg","_sp","_spawnPos"];
closeDialog 0;
cutText ["","BLACK IN"];
if (life_spawn_point isEqualTo []) then {
private ["_sp","_spCfg"];
_spCfg = [playerSide] call life_fnc_spawnPointCfg;
_sp = _spCfg select 0;
if (playerSide isEqualTo civilian) then {
if (isNil {(call compile format ["%1",_sp select 0])}) then {
player setPos (getMarkerPos (_sp select 0));
} else {
_spawnPos = (call compile format ["%1",_sp select 0]) call BIS_fnc_selectRandom;
_spawnPos = _spawnPos buildingPos 0;
player setPos _spawnPos;
};
} else {
player setPos (getMarkerPos (_sp select 0));
};
titleText[format ["%2 %1",_sp select 1,localize "STR_Spawn_Spawned"],"BLACK IN"];
} else {
if (playerSide isEqualTo civilian) then {
if (isNil {(call compile format ["%1",life_spawn_point select 0])}) then {
if (["house",life_spawn_point select 0] call BIS_fnc_inString) then {
private ["_bPos","_house","_pos"];
_house = nearestObjects [getMarkerPos (life_spawn_point select 0),["House_F"],10] select 0;
_bPos = [_house] call life_fnc_getBuildingPositions;
if (_bPos isEqualTo []) exitWith {
player setPos (getMarkerPos (life_spawn_point select 0));
};
{_bPos = _bPos - [(_house buildingPos _x)];} forEach (_house getVariable ["slots",[]]);
_pos = _bPos call BIS_fnc_selectRandom;
player setPosATL _pos;
} else {
player setPos (getMarkerPos (life_spawn_point select 0));
};
} else {
_spawnPos = (call compile format ["%1", life_spawn_point select 0]) call BIS_fnc_selectRandom;
_spawnPos = _spawnPos buildingPos 0;
player setPos _spawnPos;
};
} else {
player setPos (getMarkerPos (life_spawn_point select 0));
};
titleText[format ["%2 %1",life_spawn_point select 1,localize "STR_Spawn_Spawned"],"BLACK IN"];
};
if (life_firstSpawn) then {
life_firstSpawn = false;
[] call life_fnc_welcomeNotification;
};
[] call life_fnc_playerSkins;
[] call life_fnc_hudSetup;

View File

@@ -0,0 +1,37 @@
/*
File: fn_spawnMenu.sqf
Author: Bryan "Tonic" Boardwine
Description:
Initializes the spawn point selection menu.
*/
private ["_spCfg","_sp","_ctrl"];
disableSerialization;
if (life_is_arrested) exitWith {
[] call life_fnc_respawned;
};
if (life_respawned) then {
[] call life_fnc_respawned;
};
cutText["","BLACK FADED"];
0 cutFadeOut 9999999;
if (!(createDialog "life_spawn_selection")) exitWith {[] call life_fnc_spawnMenu;};
(findDisplay 38500) displaySetEventHandler ["keyDown","_this call life_fnc_displayHandler"];
_spCfg = [playerSide] call life_fnc_spawnPointCfg;
_ctrl = ((findDisplay 38500) displayCtrl 38510);
{
_ctrl lnbAddRow[(_spCfg select _ForEachIndex) select 1,(_spCfg select _ForEachIndex) select 0,""];
_ctrl lnbSetPicture[[_ForEachIndex,0],(_spCfg select _ForEachIndex) select 2];
_ctrl lnbSetData[[_ForEachIndex,0],(_spCfg select _ForEachIndex) select 0];
} forEach _spCfg;
_sp = _spCfg select 0; //First option is set by default
[((findDisplay 38500) displayCtrl 38502),1,0.1,getMarkerPos (_sp select 0)] call life_fnc_setMapPosition;
life_spawn_point = _sp;
ctrlSetText[38501,format ["%2: %1",_sp select 1,localize "STR_Spawn_CSP"]];

View File

@@ -0,0 +1,54 @@
#include "..\..\script_macros.hpp"
/*
File: fn_spawnPointCfg.sqf
Author: Bryan "Tonic" Boardwine
Description:
Master configuration for available spawn points depending on the units side.
Return:
[Spawn Marker,Spawn Name,Image Path]
*/
params [["_side",civilian,[civilian]]];
_side = switch (_side) do {
case west: {"Cop"};
case independent: {"Medic"};
default {"Civilian"};
};
private _return = [];
private _spawnCfg = missionConfigFile >> "CfgSpawnPoints" >> worldName >> _side;
for "_i" from 0 to count(_spawnCfg)-1 do {
private _tempConfig = [];
private _curConfig = (_spawnCfg select _i);
private _conditions = getText(_curConfig >> "conditions");
private _flag = [_conditions] call life_fnc_levelCheck;
if (_flag) then {
_tempConfig pushBack getText(_curConfig >> "spawnMarker");
_tempConfig pushBack getText(_curConfig >> "displayName");
_tempConfig pushBack getText(_curConfig >> "icon");
_return pushBack _tempConfig;
};
};
if (playerSide isEqualTo civilian) then {
if (count life_houses > 0) then {
{
_pos = call compile format ["%1",(_x select 0)];
_house = nearestObject [_pos, "House"];
_houseName = getText(configFile >> "CfgVehicles" >> (typeOf _house) >> "displayName");
_return pushBack [format ["house_%1",_house getVariable "uid"],_houseName,"\a3\ui_f\data\map\MapControl\lighthouse_ca.paa"];
true
} count life_houses;
};
};
_return;

View File

@@ -0,0 +1,18 @@
/*
File: fn_spawnPointSelected.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sorts out the spawn point selected and does a map zoom.
*/
disableSerialization;
private ["_control","_selection","_spCfg","_sp"];
_control = [_this,0,controlNull,[controlNull]] call BIS_fnc_param;
_selection = [_this,1,0,[0]] call BIS_fnc_param;
_spCfg = [playerSide] call life_fnc_spawnPointCfg;
_sp = _spCfg select _selection;
[((findDisplay 38500) displayCtrl 38502),1,0.1,getMarkerPos (_sp select 0)] call life_fnc_setMapPosition;
life_spawn_point = _sp;
ctrlSetText[38501,format ["%2: %1",_sp select 1,localize "STR_Spawn_CSP"]];

View File

@@ -0,0 +1,64 @@
#include "..\..\script_macros.hpp"
/*
File: fn_unimpound.sqf
Author: Bryan "Tonic" Boardwine
Description:
Yeah... Gets the vehicle from the garage.
*/
private ["_vehicle","_vehicleLife","_vid","_pid","_unit","_price","_price","_storageFee","_purchasePrice"];
disableSerialization;
if ((lbCurSel 2802) isEqualTo -1) exitWith {hint localize "STR_Global_NoSelection"};
_vehicle = lbData[2802,(lbCurSel 2802)];
_vehicle = (call compile format ["%1",_vehicle]) select 0;
_vehicleLife = _vehicle;
_vid = lbValue[2802,(lbCurSel 2802)];
_pid = getPlayerUID player;
_unit = player;
_spawntext = localize "STR_Garage_spawn_Success";
if (isNil "_vehicle") exitWith {hint localize "STR_Garage_Selection_Error"};
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _vehicleLife)) then {
_vehicleLife = "Default"; //Use Default class if it doesn't exist
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_vehicle];
};
_price = M_CONFIG(getNumber,"LifeCfgVehicles",_vehicleLife,"price");
_storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");
switch (playerSide) do {
case civilian: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");};
case west: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");};
case independent: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");};
case east: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");};
};
_price = _purchasePrice * _storageFee;
if (!(_price isEqualType 0) || _price < 1) then {_price = 500;};
if (BANK < _price) exitWith {hint format [(localize "STR_Garage_CashError"),[_price] call life_fnc_numberText];};
if (life_garage_sp isEqualType []) then {
if (life_HC_isActive) then {
[_vid,_pid,(life_garage_sp select 0),_unit,_price,(life_garage_sp select 1),_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
} else {
[_vid,_pid,(life_garage_sp select 0),_unit,_price,(life_garage_sp select 1),_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
};
} else {
if (life_garage_sp in ["medic_spawn_1","medic_spawn_2","medic_spawn_3"]) then {
if (life_HC_isActive) then {
[_vid,_pid,life_garage_sp,_unit,_price,0,_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
} else {
[_vid,_pid,life_garage_sp,_unit,_price,0,_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
};
} else {
if (life_HC_isActive) then {
[_vid,_pid,(getMarkerPos life_garage_sp),_unit,_price,markerDir life_garage_sp,_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
} else {
[_vid,_pid,(getMarkerPos life_garage_sp),_unit,_price,markerDir life_garage_sp,_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
};
};
};
hint localize "STR_Garage_SpawningVeh";
BANK = BANK - _price;
[1] call SOCK_fnc_updatePartial;
closeDialog 0;

View File

@@ -0,0 +1,36 @@
#include "..\..\script_macros.hpp"
/*
File: fn_gangWithdraw.sqf
Author: Bryan "Tonic" Boardwine
Description:
Withdraws money from the gang bank.
*/
params [
["_deposit",false,[false]]
];
private _value = parseNumber(ctrlText 2702);
private _gFund = GANG_FUNDS;
if ((time - life_action_delay) < 0.5) exitWith {hint localize "STR_NOTF_ActionDelay"};
//Series of stupid checks
if (isNil {(group player) getVariable "gang_name"}) exitWith {hint localize "STR_ATM_NotInGang"}; // Checks if player isn't in a gang
if (_value > 999999) exitWith {hint localize "STR_ATM_WithdrawMax";};
if (_value < 1) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_deposit && _value > CASH) exitWith {hint localize "STR_ATM_NotEnoughCash"};
if (!_deposit && _value > _gFund) exitWith {hint localize "STR_ATM_NotEnoughFundsG"};
if (_deposit) then {
CASH = CASH - _value;
[] call life_fnc_atmMenu;
};
if (life_HC_isActive) then {
[1,group player,_deposit,_value,player,CASH] remoteExecCall ["HC_fnc_updateGang",HC_Life]; //Update the database.
} else {
[1,group player,_deposit,_value,player,CASH] remoteExecCall ["TON_fnc_updateGang",RSERV]; //Update the database.
};
life_action_delay = time;

View File

@@ -0,0 +1,38 @@
#include "..\..\script_macros.hpp"
/*
File: fn_vehicleGarage.sqf
Author: Bryan "Tonic" Boardwine
Updated to Housing/Garage Configs - BoGuu
Description:
Vehicle Garage, why did I spawn this in an action its self?
*/
params [
["_garageObj",objNull,[objNull]],
["_type","",[""]]
];
_className = typeOf _garageObj;
private _houseConfig = missionConfigFile >> "Housing" >> worldName >> _className;
private _garageConfig = missionConfigFile >> "Garages" >> worldName >> _className;
private _config = [_garageConfig,_houseConfig] select {isClass _x};
if (_config isEqualTo []) exitWith {};
_config = _config select 0;
private _dir = getNumber(_config >> "garageSpawnDir");
private _mTwPos = getArray(_config >> "garageSpawnPos");
life_garage_sp = [(_garageObj modelToWorld _mTwPos),((getDir _garageObj) + _dir)];
life_garage_type = _type;
if (life_HC_isActive) then {
[getPlayerUID player,playerSide,_type,player] remoteExec ["HC_fnc_getVehicles",HC_Life];
} else {
[getPlayerUID player,playerSide,_type,player] remoteExec ["TON_fnc_getVehicles",RSERV];
};
createDialog "Life_impound_menu";
disableSerialization;
ctrlSetText[2802,(localize "STR_ANOTF_QueryGarage")];

View File

@@ -0,0 +1,17 @@
#include "..\..\script_macros.hpp"
/*
File: fn_wireTransfer.sqf
Author: Bryan "Tonic" Boardwine
Description:
Initiates the wire-transfer
*/
params [
["_value",0,[0]],
["_from","",[""]]
];
if (_value isEqualTo 0 || _from isEqualTo "" || _from isEqualTo profileName) exitWith {}; //No
BANK = BANK + _value;
[1] call SOCK_fnc_updatePartial;
hint format [localize "STR_ATM_WireTransfer",_from,[_value] call life_fnc_numberText];