diff --git a/Altis_Life.Altis/Functions.hpp b/Altis_Life.Altis/Functions.hpp
index a9c15ac63..0535b3929 100644
--- a/Altis_Life.Altis/Functions.hpp
+++ b/Altis_Life.Altis/Functions.hpp
@@ -1,393 +1,394 @@
-class Socket_Reciever {
- tag = "SOCK";
- class SQL_Socket {
- file = "core\session";
- class dataQuery {};
- class insertPlayerInfo {};
- class requestReceived {};
- class syncData {};
- class updatePartial {};
- class updateRequest {};
- };
-};
-
-class SpyGlass {
- tag = "SPY";
- class Functions {
- file = "SpyGlass";
- class cookieJar{};
- class notifyAdmins{};
- class observe{};
- };
-};
-
-class Life_Client_Utilities {
- tag = "life_util";
-
- class Main {
- file = "core\utils";
- class isNumber {};
- class index {};
- class playerQuery {};
- class terrainSort {};
- };
-};
-
-class Life_Client_Core {
- tag = "life";
-
- class Master_Directory {
- file = "core";
- class initCiv {};
- class initCop {};
- class initMedic {};
- class setupActions {};
- class setupEVH {};
- class survival {};
- class welcomeNotification {};
- };
-
- class Actions {
- file = "core\actions";
- class arrestAction {};
- class buyLicense {};
- class captureHideout {};
- class catchFish {};
- class dpFinish {};
- class dropFishingNet {};
- class escortAction {};
- class gather {};
- class getDPMission {};
- class gutAnimal {};
- class healHospital {};
- class impoundAction {};
- class mine {};
- class newsBroadcast {};
- class packupSpikes {};
- class pickupItem {};
- class pickupMoney {};
- class postBail {};
- class processAction {};
- class pulloutAction {};
- class putInCar {};
- class removeContainer {};
- class repairTruck {};
- class restrainAction {};
- class robAction {};
- class searchAction {};
- class searchVehAction {};
- class seizePlayerAction {};
- class serviceChopper {};
- class stopEscorting {};
- class storeVehicle {};
- class surrender {};
- class ticketAction {};
- class unrestrain {};
- };
-
- class Admin {
- file = "core\admin";
- class adminCompensate {};
- class adminDebugCon {};
- class adminFreeze {};
- class admingetID {};
- class adminGodMode {};
- class adminid {};
- class admininfo {};
- class adminMarkers {};
- class adminMenu {};
- class adminQuery {};
- class adminSpectate {};
- class adminTeleport {};
- class adminTpHere {};
- };
-
- class Civilian {
- file = "core\civilian";
- class civMarkers {};
- class demoChargeTimer {};
- class freezePlayer {};
- class jail {};
- class jailMe {};
- class knockedOut {};
- class knockoutAction {};
- class removeLicenses {};
- class robPerson {};
- class robReceive {};
- class tazed {};
- };
-
- class Config {
- file = "core\config";
- class houseConfig {};
- class itemWeight {};
- class vehicleAnimate {};
- class vehicleWeightCfg {};
- };
-
- class Cop {
- file = "core\cop";
- class bountyReceive {};
- class containerInvSearch {};
- class copInteractionMenu {};
- class copLights {};
- class copMarkers {};
- class copSearch {};
- class copSiren {};
- class doorAnimate {};
- class fedCamDisplay {};
- class licenseCheck {};
- class licensesRead {};
- class questionDealer {};
- class radar {};
- class repairDoor {};
- class restrain {};
- class searchClient {};
- class seizeClient {};
- class sirenLights {};
- class spikeStripEffect {};
- class ticketGive {};
- class ticketPaid {};
- class ticketPay {};
- class ticketPrompt {};
- class vehInvSearch {};
- class wantedGrab {};
- };
-
- class Dialog_Controls {
- file = "dialog\function";
- class bankDeposit {};
- class bankTransfer {};
- class bankWithdraw {};
- class displayHandler {};
- class gangBankResponse {};
- class garageLBChange {};
- class impoundMenu {};
- class progressBar {};
- class safeFix {};
- class safeInventory {};
- class safeOpen {};
- class safeTake {};
- class sellGarage {};
- class setMapPosition {};
- class spawnConfirm {};
- class spawnMenu {};
- class spawnPointCfg {};
- class spawnPointSelected {};
- class unimpound {};
- class useGangBank {};
- class vehicleGarage {};
- class wireTransfer {};
- };
-
- class Functions {
- file = "core\functions";
- class AAN {};
- class accType {};
- class actionKeyHandler {};
- class animSync {};
- class calWeightDiff {};
- class checkMap {};
- class clearVehicleAmmo {};
- class dropItems {};
- class onGameInterrupt {};
- class fetchCfgDetails {};
- class fetchDeadGear {};
- class fetchVehInfo {};
- class isDamaged {};
- class getInMan {};
- class getOutMan {};
- class giveDiff {};
- class handleDamage {};
- class handleInv {};
- class handleItem {};
- class hideObj {};
- class hudUpdate {};
- class inventoryClosed {};
- class inventoryOpened {};
- class isUIDActive {};
- class keyHandler {};
- class loadDeadGear {};
- class loadGear {};
- class nearATM {};
- class nearestDoor {};
- class nearUnits {};
- class numberText {};
- class onFired {};
- class onTakeItem {};
- class playerSkins {};
- class playerTags {};
- class postNewsBroadcast {};
- class pullOutVeh {};
- class pushObject {};
- class receiveItem {};
- class receiveMoney {};
- class revealObjects {};
- class saveGear {};
- class simDisable {};
- class startLoadout {};
- class stripDownPlayer {};
- class teleport {};
- class whereAmI {};
- class moveIn {};
- };
-
- class Gangs {
- file = "core\gangs";
- class clientGangKick {};
- class clientGangLeader {};
- class clientGangLeft {};
- class createGang {};
- class gangCreated {};
- class gangDisband {};
- class gangDisbanded {};
- class gangInvite {};
- class gangInvitePlayer {};
- class gangKick {};
- class gangLeave {};
- class gangMenu {};
- class gangNewLeader {};
- class gangUpgrade {};
- class initGang {};
- };
-
- class Housing {
- file = "core\housing";
- class buyHouse {};
- class buyHouseGarage {};
- class containerMenu {};
- class copBreakDoor {};
- class copHouseOwner {};
- class garageRefund {};
- class getBuildingPositions {};
- class houseMenu {};
- class initHouses {};
- class lightHouse {};
- class lightHouseAction {};
- class lockHouse {};
- class lockupHouse {};
- class placeContainer {};
- class PlayerInBuilding {};
- class raidHouse {};
- class sellHouse {};
- class sellHouseGarage {};
- };
-
- class Items {
- file = "core\items";
- class blastingCharge {};
- class boltcutter {};
- class defuseKit {};
- class flashbang {};
- class jerrycanRefuel {};
- class jerryRefuel {};
- class lockpick {};
- class placestorage {};
- class spikeStrip {};
- class storageBox {};
- };
-
- class Medical_System {
- file = "core\medical";
- class deathScreen {};
- class medicLights {};
- class medicMarkers {};
- class medicRequest {};
- class medicSiren {};
- class medicSirenLights {};
- class onPlayerKilled {};
- class onPlayerRespawn {};
- class requestMedic {};
- class respawned {};
- class revived {};
- class revivePlayer {};
- };
-
- class Network {
- file = "core\functions\network";
- class broadcast {};
- class corpse {};
- class jumpFnc {};
- class say3D {};
- class setFuel {};
- class soundDevice {};
- };
-
- class Player_Menu {
- file = "core\pmenu";
- class cellphone {};
- class clientMessage {};
- class giveItem {};
- class giveMoney {};
- class keyDrop {};
- class keyGive {};
- class keyMenu {};
- class p_openMenu {};
- class p_updateMenu {};
- class pardon {};
- class removeItem {};
- class sendMessage {};
- class s_onChar {};
- class s_onCheckedChange {};
- class s_onSliderChange {};
- class settingsMenu {};
- class updateViewDistance {};
- class useItem {};
- class wantedAddP {};
- class wantedInfo {};
- class wantedList {};
- class wantedMenu {};
- };
-
- class Shops {
- file = "core\shops";
- class 3dPreviewDisplay {};
- class 3dPreviewExit {};
- class 3dPreviewInit {};
- class atmMenu {};
- class buyClothes {};
- class changeClothes {};
- class chopShopMenu {};
- class chopShopSelection {};
- class chopShopSell {};
- class chopShopSold {};
- class clothingFilter {};
- class clothingMenu {};
- class fuelLBchange {};
- class fuelStatOpen {};
- class levelCheck {};
- class vehicleShopBuy {};
- class vehicleShopLBChange {};
- class vehicleShopMenu {};
- class virt_buy {};
- class virt_menu {};
- class virt_sell {};
- class virt_update {};
- class weaponShopAccs {};
- class weaponShopBuySell {};
- class weaponShopFilter {};
- class weaponShopMags {};
- class weaponShopMenu {};
- class weaponShopSelection {};
- };
-
- class Vehicle {
- file = "core\vehicle";
- class addVehicle2Chain {};
- class clientGetKey {};
- class colorVehicle {};
- class deviceMine {};
- class FuelRefuelcar {};
- class fuelStore {};
- class fuelSupply {};
- class lockVehicle {};
- class openInventory {};
- class vehiclecolor3DRefresh {};
- class vehicleOwners {};
- class vehicleWeight {};
- class vehInventory {};
- class vehStoreItem {};
- class vehTakeItem {};
- class vInteractionMenu {};
- };
-};
+class Socket_Reciever {
+ tag = "SOCK";
+ class SQL_Socket {
+ file = "core\session";
+ class dataQuery {};
+ class insertPlayerInfo {};
+ class requestReceived {};
+ class syncData {};
+ class updatePartial {};
+ class updateRequest {};
+ };
+};
+
+class SpyGlass {
+ tag = "SPY";
+ class Functions {
+ file = "SpyGlass";
+ class cookieJar{};
+ class notifyAdmins{};
+ class observe{};
+ };
+};
+
+class Life_Client_Utilities {
+ tag = "life_util";
+
+ class Main {
+ file = "core\utils";
+ class isNumber {};
+ class index {};
+ class playerQuery {};
+ class terrainSort {};
+ };
+};
+
+class Life_Client_Core {
+ tag = "life";
+
+ class Master_Directory {
+ file = "core";
+ class initCiv {};
+ class initCop {};
+ class initMedic {};
+ class setupActions {};
+ class setupEVH {};
+ class survival {};
+ class welcomeNotification {};
+ };
+
+ class Actions {
+ file = "core\actions";
+ class arrestAction {};
+ class buyLicense {};
+ class captureHideout {};
+ class catchFish {};
+ class deploySpikes {};
+ class dpFinish {};
+ class dropFishingNet {};
+ class escortAction {};
+ class gather {};
+ class getDPMission {};
+ class gutAnimal {};
+ class healHospital {};
+ class impoundAction {};
+ class mine {};
+ class newsBroadcast {};
+ class packupSpikes {};
+ class pickupItem {};
+ class pickupMoney {};
+ class postBail {};
+ class processAction {};
+ class pulloutAction {};
+ class putInCar {};
+ class removeContainer {};
+ class repairTruck {};
+ class restrainAction {};
+ class robAction {};
+ class searchAction {};
+ class searchVehAction {};
+ class seizePlayerAction {};
+ class serviceChopper {};
+ class stopEscorting {};
+ class storeVehicle {};
+ class surrender {};
+ class ticketAction {};
+ class unrestrain {};
+ };
+
+ class Admin {
+ file = "core\admin";
+ class adminCompensate {};
+ class adminDebugCon {};
+ class adminFreeze {};
+ class admingetID {};
+ class adminGodMode {};
+ class adminid {};
+ class admininfo {};
+ class adminMarkers {};
+ class adminMenu {};
+ class adminQuery {};
+ class adminSpectate {};
+ class adminTeleport {};
+ class adminTpHere {};
+ };
+
+ class Civilian {
+ file = "core\civilian";
+ class civMarkers {};
+ class demoChargeTimer {};
+ class freezePlayer {};
+ class jail {};
+ class jailMe {};
+ class knockedOut {};
+ class knockoutAction {};
+ class removeLicenses {};
+ class robPerson {};
+ class robReceive {};
+ class tazed {};
+ };
+
+ class Config {
+ file = "core\config";
+ class houseConfig {};
+ class itemWeight {};
+ class vehicleAnimate {};
+ class vehicleWeightCfg {};
+ };
+
+ class Cop {
+ file = "core\cop";
+ class bountyReceive {};
+ class containerInvSearch {};
+ class copInteractionMenu {};
+ class copLights {};
+ class copMarkers {};
+ class copSearch {};
+ class copSiren {};
+ class doorAnimate {};
+ class fedCamDisplay {};
+ class licenseCheck {};
+ class licensesRead {};
+ class questionDealer {};
+ class radar {};
+ class repairDoor {};
+ class restrain {};
+ class searchClient {};
+ class seizeClient {};
+ class sirenLights {};
+ class spikeStripEffect {};
+ class ticketGive {};
+ class ticketPaid {};
+ class ticketPay {};
+ class ticketPrompt {};
+ class vehInvSearch {};
+ class wantedGrab {};
+ };
+
+ class Dialog_Controls {
+ file = "dialog\function";
+ class bankDeposit {};
+ class bankTransfer {};
+ class bankWithdraw {};
+ class displayHandler {};
+ class gangBankResponse {};
+ class garageLBChange {};
+ class impoundMenu {};
+ class progressBar {};
+ class safeFix {};
+ class safeInventory {};
+ class safeOpen {};
+ class safeTake {};
+ class sellGarage {};
+ class setMapPosition {};
+ class spawnConfirm {};
+ class spawnMenu {};
+ class spawnPointCfg {};
+ class spawnPointSelected {};
+ class unimpound {};
+ class useGangBank {};
+ class vehicleGarage {};
+ class wireTransfer {};
+ };
+
+ class Functions {
+ file = "core\functions";
+ class AAN {};
+ class accType {};
+ class actionKeyHandler {};
+ class animSync {};
+ class calWeightDiff {};
+ class checkMap {};
+ class clearVehicleAmmo {};
+ class dropItems {};
+ class onGameInterrupt {};
+ class fetchCfgDetails {};
+ class fetchDeadGear {};
+ class fetchVehInfo {};
+ class isDamaged {};
+ class getInMan {};
+ class getOutMan {};
+ class giveDiff {};
+ class handleDamage {};
+ class handleInv {};
+ class handleItem {};
+ class hideObj {};
+ class hudUpdate {};
+ class inventoryClosed {};
+ class inventoryOpened {};
+ class isUIDActive {};
+ class keyHandler {};
+ class loadDeadGear {};
+ class loadGear {};
+ class nearATM {};
+ class nearestDoor {};
+ class nearUnits {};
+ class numberText {};
+ class onFired {};
+ class onTakeItem {};
+ class playerSkins {};
+ class playerTags {};
+ class postNewsBroadcast {};
+ class pullOutVeh {};
+ class pushObject {};
+ class receiveItem {};
+ class receiveMoney {};
+ class revealObjects {};
+ class saveGear {};
+ class simDisable {};
+ class startLoadout {};
+ class stripDownPlayer {};
+ class teleport {};
+ class whereAmI {};
+ class moveIn {};
+ };
+
+ class Gangs {
+ file = "core\gangs";
+ class clientGangKick {};
+ class clientGangLeader {};
+ class clientGangLeft {};
+ class createGang {};
+ class gangCreated {};
+ class gangDisband {};
+ class gangDisbanded {};
+ class gangInvite {};
+ class gangInvitePlayer {};
+ class gangKick {};
+ class gangLeave {};
+ class gangMenu {};
+ class gangNewLeader {};
+ class gangUpgrade {};
+ class initGang {};
+ };
+
+ class Housing {
+ file = "core\housing";
+ class buyHouse {};
+ class buyHouseGarage {};
+ class containerMenu {};
+ class copBreakDoor {};
+ class copHouseOwner {};
+ class garageRefund {};
+ class getBuildingPositions {};
+ class houseMenu {};
+ class initHouses {};
+ class lightHouse {};
+ class lightHouseAction {};
+ class lockHouse {};
+ class lockupHouse {};
+ class placeContainer {};
+ class PlayerInBuilding {};
+ class raidHouse {};
+ class sellHouse {};
+ class sellHouseGarage {};
+ };
+
+ class Items {
+ file = "core\items";
+ class blastingCharge {};
+ class boltcutter {};
+ class defuseKit {};
+ class flashbang {};
+ class jerrycanRefuel {};
+ class jerryRefuel {};
+ class lockpick {};
+ class placestorage {};
+ class spikeStrip {};
+ class storageBox {};
+ };
+
+ class Medical_System {
+ file = "core\medical";
+ class deathScreen {};
+ class medicLights {};
+ class medicMarkers {};
+ class medicRequest {};
+ class medicSiren {};
+ class medicSirenLights {};
+ class onPlayerKilled {};
+ class onPlayerRespawn {};
+ class requestMedic {};
+ class respawned {};
+ class revived {};
+ class revivePlayer {};
+ };
+
+ class Network {
+ file = "core\functions\network";
+ class broadcast {};
+ class corpse {};
+ class jumpFnc {};
+ class say3D {};
+ class setFuel {};
+ class soundDevice {};
+ };
+
+ class Player_Menu {
+ file = "core\pmenu";
+ class cellphone {};
+ class clientMessage {};
+ class giveItem {};
+ class giveMoney {};
+ class keyDrop {};
+ class keyGive {};
+ class keyMenu {};
+ class p_openMenu {};
+ class p_updateMenu {};
+ class pardon {};
+ class removeItem {};
+ class sendMessage {};
+ class s_onChar {};
+ class s_onCheckedChange {};
+ class s_onSliderChange {};
+ class settingsMenu {};
+ class updateViewDistance {};
+ class useItem {};
+ class wantedAddP {};
+ class wantedInfo {};
+ class wantedList {};
+ class wantedMenu {};
+ };
+
+ class Shops {
+ file = "core\shops";
+ class 3dPreviewDisplay {};
+ class 3dPreviewExit {};
+ class 3dPreviewInit {};
+ class atmMenu {};
+ class buyClothes {};
+ class changeClothes {};
+ class chopShopMenu {};
+ class chopShopSelection {};
+ class chopShopSell {};
+ class chopShopSold {};
+ class clothingFilter {};
+ class clothingMenu {};
+ class fuelLBchange {};
+ class fuelStatOpen {};
+ class levelCheck {};
+ class vehicleShopBuy {};
+ class vehicleShopLBChange {};
+ class vehicleShopMenu {};
+ class virt_buy {};
+ class virt_menu {};
+ class virt_sell {};
+ class virt_update {};
+ class weaponShopAccs {};
+ class weaponShopBuySell {};
+ class weaponShopFilter {};
+ class weaponShopMags {};
+ class weaponShopMenu {};
+ class weaponShopSelection {};
+ };
+
+ class Vehicle {
+ file = "core\vehicle";
+ class addVehicle2Chain {};
+ class clientGetKey {};
+ class colorVehicle {};
+ class deviceMine {};
+ class FuelRefuelcar {};
+ class fuelStore {};
+ class fuelSupply {};
+ class lockVehicle {};
+ class openInventory {};
+ class vehiclecolor3DRefresh {};
+ class vehicleOwners {};
+ class vehicleWeight {};
+ class vehInventory {};
+ class vehStoreItem {};
+ class vehTakeItem {};
+ class vInteractionMenu {};
+ };
+};
diff --git a/Altis_Life.Altis/config/Config_Master.hpp b/Altis_Life.Altis/config/Config_Master.hpp
index 16d827364..d8603c258 100644
--- a/Altis_Life.Altis/config/Config_Master.hpp
+++ b/Altis_Life.Altis/config/Config_Master.hpp
@@ -179,6 +179,9 @@ class Life_Settings {
disableCommanderView = true; //false - Group leaders can access the commander view. true [default] - Group leaders cannot access the commander view.
//Commander/tactical view is accessed via pressing . [NUM] by default. It raises the camera significantly higher and steeper above the player in order to give a boarder tactical view of the surrounding area.
+ maximumSpikestrips = -1; //Maximum number of spikes deployed per cop, -1 allows unlimited placement of spikestrips
+ minimumSpikeSpeed = 0; //Minimum speed for a spikestrip to take effect, a negative speed will allow stationary vehicles to be spiked
+
/* Wanted System Settings *
/* crimes[] = {String, Bounty, Code} */
crimes[] = {
diff --git a/Altis_Life.Altis/core/actions/fn_deploySpikes.sqf b/Altis_Life.Altis/core/actions/fn_deploySpikes.sqf
new file mode 100644
index 000000000..567a62052
--- /dev/null
+++ b/Altis_Life.Altis/core/actions/fn_deploySpikes.sqf
@@ -0,0 +1,30 @@
+#include "..\..\script_macros.hpp"
+/*
+ File: fn_deploySpikes.sqf
+ Author: DomT602
+
+ Description:
+ Deploys a spike strip
+*/
+
+if (isNull life_spikeStrip) exitWith {};
+private _spikeStrip = life_spikeStrip;
+life_spikeStrip = objNull;
+
+detach _spikeStrip;
+private _pos = getPosASL _spikeStrip;
+private _intersects = lineIntersectsSurfaces [_pos,_pos vectorAdd [0,0,-50],_spikeStrip,objNull,true,1,"GEOM","NONE"];
+_intersects params ["_firstObjectData"];
+_firstObjectData params ["_posASL","_surfaceNormal"];
+_spikeStrip setPosASL _posASL;
+_spikeStrip setVectorUp _surfaceNormal;
+_spikeStrip setVariable ["item","spikeDeployed",true]; //only set this once deployed to prevent others picking up
+
+player removeAction life_action_spikeStripDeploy;
+life_action_spikeStripDeploy = nil;
+
+if (life_HC_isActive) then {
+ [_spikeStrip] remoteExec ["HC_fnc_spikeStrip",HC_Life];
+} else {
+ [_spikeStrip] remoteExec ["TON_fnc_spikeStrip",RSERV];
+};
diff --git a/Altis_Life.Altis/core/actions/fn_packupSpikes.sqf b/Altis_Life.Altis/core/actions/fn_packupSpikes.sqf
index a31a51493..1fce50001 100644
--- a/Altis_Life.Altis/core/actions/fn_packupSpikes.sqf
+++ b/Altis_Life.Altis/core/actions/fn_packupSpikes.sqf
@@ -1,17 +1,16 @@
-/*
- File: fn_packupSpikes.sqf
- Author: Bryan "Tonic" Boardwine
-
- Description:
- Packs up a deployed spike strip.
-*/
-
-private _spikes = nearestObjects[getPos player, ["Land_Razorwire_F"], 8] select 0;
-if (isNil "_spikes") exitWith {};
-
-if ([true,"spikeStrip",1] call life_fnc_handleInv) then {
- titleText[localize "STR_NOTF_SpikeStrip","PLAIN"];
- player removeAction life_action_spikeStripPickup;
- life_action_spikeStripPickup = nil;
- deleteVehicle _spikes;
-};
\ No newline at end of file
+/*
+ File: fn_packupSpikes.sqf
+ Author: Bryan "Tonic" Boardwine
+
+ Description:
+ Packs up a deployed spike strip.
+*/
+(nearestObjects [player,["Land_Razorwire_F"],8]) params [["_spikes", objNull]];
+if (isNull _spikes) exitWith {};
+
+if ([true,"spikeStrip",1] call life_fnc_handleInv) then {
+ private _index = life_spikesDeployed findIf {_x isEqualTo _spikes};
+ life_spikesDeployed deleteAt _index; //remove spikes from spike array
+ titleText [localize "STR_NOTF_SpikeStrip","PLAIN"];
+ deleteVehicle _spikes;
+};
diff --git a/Altis_Life.Altis/core/actions/fn_storeVehicle.sqf b/Altis_Life.Altis/core/actions/fn_storeVehicle.sqf
index 88e162ca6..45450cbc3 100644
--- a/Altis_Life.Altis/core/actions/fn_storeVehicle.sqf
+++ b/Altis_Life.Altis/core/actions/fn_storeVehicle.sqf
@@ -1,50 +1,50 @@
-#include "..\..\script_macros.hpp"
-/*
- File: fn_storeVehicle.sqf
- Author: Bryan "Tonic" Boardwine
-
- Description:
- Stores the vehicle in the garage.
-*/
-params [
- ["_garage", objNull, [objNull]],
- ["_unit", objNull, [objNull]]
-];
-
-private _vehicle = objNull;
-if !(isNull objectParent player) then {
- _vehicle = vehicle player;
-} else {
- private _nearVehicles = nearestObjects[getPos _garage,["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
- if !(_nearVehicles isEqualTo []) then {
- {
- if (!isNull _vehicle) exitWith {}; //Kill the loop.
- private _vehData = _x getVariable ["vehicle_info_owners",[]];
- if (count _vehData > 0) then {
- private _vehOwner = ((_vehData select 0) select 0);
- if (getPlayerUID player isEqualTo _vehOwner) exitWith {
- _vehicle = _x;
- };
- };
- true
- } count _nearVehicles;
- };
-};
-
-if (isNull _vehicle) exitWith {
- hint localize "STR_Garage_NoNPC"
-};
-if (!alive _vehicle) exitWith {
- hint localize "STR_Garage_SQLError_Destroyed"
-};
-
-private _storetext = localize "STR_Garage_Store_Success";
-
-if (life_HC_isActive) then {
- [_vehicle,false,_unit,_storetext] remoteExec ["HC_fnc_vehicleStore",HC_Life];
-} else {
- [_vehicle,false,_unit,_storetext] remoteExec ["TON_fnc_vehicleStore",RSERV];
-};
-
-hint localize "STR_Garage_Store_Server";
-life_garage_store = true;
+#include "..\..\script_macros.hpp"
+/*
+ File: fn_storeVehicle.sqf
+ Author: Bryan "Tonic" Boardwine
+
+ Description:
+ Stores the vehicle in the garage.
+*/
+params [
+ ["_garage", objNull, [objNull]],
+ ["_unit", objNull, [objNull]]
+];
+
+private _vehicle = objNull;
+if !(isNull objectParent player) then {
+ _vehicle = vehicle player;
+} else {
+ private _nearVehicles = nearestObjects[getPos _garage,["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
+ if !(_nearVehicles isEqualTo []) then {
+ {
+ if !(isNull _vehicle) exitWith {}; //Kill the loop.
+ private _vehData = _x getVariable ["vehicle_info_owners",[]];
+ if (count _vehData > 0) then {
+ private _vehOwner = ((_vehData select 0) select 0);
+ if (getPlayerUID player isEqualTo _vehOwner) exitWith {
+ _vehicle = _x;
+ };
+ };
+ true
+ } count _nearVehicles;
+ };
+};
+
+if (isNull _vehicle) exitWith {
+ hint localize "STR_Garage_NoNPC"
+};
+if (!alive _vehicle) exitWith {
+ hint localize "STR_Garage_SQLError_Destroyed"
+};
+
+private _storetext = localize "STR_Garage_Store_Success";
+
+if (life_HC_isActive) then {
+ [_vehicle,false,_unit,_storetext] remoteExec ["HC_fnc_vehicleStore",HC_Life];
+} else {
+ [_vehicle,false,_unit,_storetext] remoteExec ["TON_fnc_vehicleStore",RSERV];
+};
+
+hint localize "STR_Garage_Store_Server";
+life_garage_store = true;
diff --git a/Altis_Life.Altis/core/configuration.sqf b/Altis_Life.Altis/core/configuration.sqf
index 3b3135219..ae89f7ef3 100644
--- a/Altis_Life.Altis/core/configuration.sqf
+++ b/Altis_Life.Altis/core/configuration.sqf
@@ -1,101 +1,102 @@
-#include "..\script_macros.hpp"
-/*
- File: configuration.sqf
- Author:
-
- Description:
- Master Life Configuration File
- This file is to setup variables for the client, there are still other configuration files in the system
-
-*****************************
-****** Backend Variables *****
-*****************************
-*/
-life_action_delay = time;
-life_trunk_vehicle = objNull;
-life_session_completed = false;
-life_garage_store = false;
-life_session_tries = 0;
-life_siren_active = false;
-life_clothing_filter = 0;
-life_redgull_effect = time;
-life_is_processing = false;
-life_bail_paid = false;
-life_impound_inuse = false;
-life_action_inUse = false;
-life_spikestrip = objNull;
-life_knockout = false;
-life_interrupted = false;
-life_respawned = false;
-life_removeWanted = false;
-life_god = false;
-life_frozen = false;
-life_save_gear = [];
-life_container_activeObj = objNull;
-life_disable_getIn = false;
-life_disable_getOut = false;
-life_admin_debug = false;
-life_civ_position = [];
-life_markers = false;
-life_markers_active = false;
-life_canpay_bail = true;
-life_storagePlacing = scriptNull;
-life_hideoutBuildings = [];
-life_firstSpawn = true;
-
-//Settings
-life_settings_enableNewsBroadcast = profileNamespace getVariable ["life_enableNewsBroadcast", true];
-life_settings_enableSidechannel = profileNamespace getVariable ["life_enableSidechannel", true];
-life_settings_viewDistanceFoot = profileNamespace getVariable ["life_viewDistanceFoot", 1250];
-life_settings_viewDistanceCar = profileNamespace getVariable ["life_viewDistanceCar", 1250];
-life_settings_viewDistanceAir = profileNamespace getVariable ["life_viewDistanceAir", 1250];
-
-//Uniform price (0),Hat Price (1),Glasses Price (2),Vest Price (3),Backpack Price (4)
-life_clothing_purchase = [-1, -1, -1, -1, -1];
-/*
-*****************************
-****** Weight Variables *****
-*****************************
-*/
-life_maxWeight = LIFE_SETTINGS(getNumber, "total_maxWeight");
-life_carryWeight = 0; //Represents the players current inventory weight (MUST START AT 0).
-
-/*
-*****************************
-****** Life Variables *******
-*****************************
-*/
-life_net_dropped = false;
-life_use_atm = true;
-life_is_arrested = false;
-life_is_alive = false;
-life_delivery_in_progress = false;
-life_thirst = 100;
-life_hunger = 100;
-CASH = 0;
-
-life_istazed = false;
-life_isknocked = false;
-life_vehicles = [];
-
-/*
- Master Array of items?
-*/
-//Setup variable inv vars.
-{
- missionNamespace setVariable [ITEM_VARNAME(configName _x), 0];
-} forEach ("true" configClasses (missionConfigFile >> "VirtualItems"));
-
-/* Setup the BLAH! */
-{
- _varName = getText(_x >> "variable");
- _sideFlag = getText(_x >> "side");
-
- missionNamespace setVariable [LICENSE_VARNAME(_varName,_sideFlag), false];
-} forEach ("true" configClasses (missionConfigFile >> "Licenses"));
-
-/* Setup life_hideoutBuildings */
-{
- _building = nearestBuilding getMarkerPos _x;
- life_hideoutBuildings pushBack _building
-} forEach (LIFE_SETTINGS(getArray,"gang_area"));
+#include "..\script_macros.hpp"
+/*
+ File: configuration.sqf
+ Author:
+
+ Description:
+ Master Life Configuration File
+ This file is to setup variables for the client, there are still other configuration files in the system
+
+*****************************
+****** Backend Variables *****
+*****************************
+*/
+life_action_delay = time;
+life_trunk_vehicle = objNull;
+life_session_completed = false;
+life_garage_store = false;
+life_session_tries = 0;
+life_siren_active = false;
+life_clothing_filter = 0;
+life_redgull_effect = time;
+life_is_processing = false;
+life_bail_paid = false;
+life_impound_inuse = false;
+life_action_inUse = false;
+life_spikestrip = objNull;
+life_spikesDeployed = [];
+life_knockout = false;
+life_interrupted = false;
+life_respawned = false;
+life_removeWanted = false;
+life_god = false;
+life_frozen = false;
+life_save_gear = [];
+life_container_activeObj = objNull;
+life_disable_getIn = false;
+life_disable_getOut = false;
+life_admin_debug = false;
+life_civ_position = [];
+life_markers = false;
+life_markers_active = false;
+life_canpay_bail = true;
+life_storagePlacing = scriptNull;
+life_hideoutBuildings = [];
+life_firstSpawn = true;
+
+//Settings
+life_settings_enableNewsBroadcast = profileNamespace getVariable ["life_enableNewsBroadcast", true];
+life_settings_enableSidechannel = profileNamespace getVariable ["life_enableSidechannel", true];
+life_settings_viewDistanceFoot = profileNamespace getVariable ["life_viewDistanceFoot", 1250];
+life_settings_viewDistanceCar = profileNamespace getVariable ["life_viewDistanceCar", 1250];
+life_settings_viewDistanceAir = profileNamespace getVariable ["life_viewDistanceAir", 1250];
+
+//Uniform price (0),Hat Price (1),Glasses Price (2),Vest Price (3),Backpack Price (4)
+life_clothing_purchase = [-1, -1, -1, -1, -1];
+/*
+*****************************
+****** Weight Variables *****
+*****************************
+*/
+life_maxWeight = LIFE_SETTINGS(getNumber, "total_maxWeight");
+life_carryWeight = 0; //Represents the players current inventory weight (MUST START AT 0).
+
+/*
+*****************************
+****** Life Variables *******
+*****************************
+*/
+life_net_dropped = false;
+life_use_atm = true;
+life_is_arrested = false;
+life_is_alive = false;
+life_delivery_in_progress = false;
+life_thirst = 100;
+life_hunger = 100;
+CASH = 0;
+
+life_istazed = false;
+life_isknocked = false;
+life_vehicles = [];
+
+/*
+ Master Array of items?
+*/
+//Setup variable inv vars.
+{
+ missionNamespace setVariable [ITEM_VARNAME(configName _x), 0];
+} forEach ("true" configClasses (missionConfigFile >> "VirtualItems"));
+
+/* Setup the BLAH! */
+{
+ _varName = getText(_x >> "variable");
+ _sideFlag = getText(_x >> "side");
+
+ missionNamespace setVariable [LICENSE_VARNAME(_varName,_sideFlag), false];
+} forEach ("true" configClasses (missionConfigFile >> "Licenses"));
+
+/* Setup life_hideoutBuildings */
+{
+ _building = nearestBuilding getMarkerPos _x;
+ life_hideoutBuildings pushBack _building
+} forEach (LIFE_SETTINGS(getArray,"gang_area"));
diff --git a/Altis_Life.Altis/core/fn_setupActions.sqf b/Altis_Life.Altis/core/fn_setupActions.sqf
index 476d30f27..94de829cd 100644
--- a/Altis_Life.Altis/core/fn_setupActions.sqf
+++ b/Altis_Life.Altis/core/fn_setupActions.sqf
@@ -1,30 +1,35 @@
-/*
- File: fn_setupActions.sqf
- Author:
-
- Description:
- Master addAction file handler for all client-based actions.
-*/
-
-life_actions = [];
-
-switch (playerSide) do {
-
- //Civilian
- case civilian: {
- //Drop fishing net
- life_actions pushBack (player addAction[localize "STR_pAct_DropFishingNet",life_fnc_dropFishingNet,"",0,false,false,"",'
- (surfaceisWater (getPos vehicle player)) && (vehicle player isKindOf "Ship") && life_carryWeight < life_maxWeight && speed (vehicle player) < 2 && speed (vehicle player) > -1 && !life_net_dropped ']);
-
- //Rob person
- life_actions pushBack (player addAction[localize "STR_pAct_RobPerson",life_fnc_robAction,"",0,false,false,"",'
- !isNull cursorObject && player distance cursorObject < 3.5 && isPlayer cursorObject && animationState cursorObject == "Incapacitated" && !(cursorObject getVariable ["robbed",false]) ']);
- };
-
- //Cops
- case west: { };
-
- //EMS
- case independent: { };
-
-};
+/*
+ File: fn_setupActions.sqf
+ Author:
+
+ Description:
+ Master addAction file handler for all client-based actions.
+*/
+
+life_actions = [];
+
+switch (playerSide) do {
+
+ //Civilian
+ case civilian: {
+ //Drop fishing net
+ life_actions pushBack (player addAction[localize "STR_pAct_DropFishingNet",life_fnc_dropFishingNet,"",0,false,false,"",'
+ (surfaceisWater (getPos vehicle player)) && (vehicle player isKindOf "Ship") && life_carryWeight < life_maxWeight && speed (vehicle player) < 2 && speed (vehicle player) > -1 && !life_net_dropped ']);
+
+ //Rob person
+ life_actions pushBack (player addAction[localize "STR_pAct_RobPerson",life_fnc_robAction,"",0,false,false,"",'
+ !isNull cursorObject && player distance cursorObject < 3.5 && isPlayer cursorObject && animationState cursorObject == "Incapacitated" && !(cursorObject getVariable ["robbed",false]) ']);
+ };
+
+ //Cops
+ case west: {
+ //Pickup spikes
+ life_actions pushBack (player addAction[localize "STR_ISTR_Spike_Pack",life_fnc_packupSpikes,"",0,false,false,"",
+ '(nearestObjects[player,["Land_Razorwire_F"],8]) params [["_spikes",objNull]]; !isNull _spikes && {!isNil {(_spikes getVariable "item")}} ']);
+
+ };
+
+ //EMS
+ case independent: { };
+
+};
diff --git a/Altis_Life.Altis/core/items/fn_spikeStrip.sqf b/Altis_Life.Altis/core/items/fn_spikeStrip.sqf
index 7b97d31a9..70d63a07d 100644
--- a/Altis_Life.Altis/core/items/fn_spikeStrip.sqf
+++ b/Altis_Life.Altis/core/items/fn_spikeStrip.sqf
@@ -1,33 +1,19 @@
-#include "..\..\script_macros.hpp"
-/*
- File: fn_spikeStrip.sqf
- Author: Bryan "Tonic" Boardwine
-
- Description:
- Creates a spike strip and preps it.
-*/
-private ["_spikeStrip"];
-if (!isNil "life_action_spikeStripPickup") exitWith {hint localize "STR_ISTR_SpikesDeployment"}; // avoid conflicts with addactions allowing duplication.
-_spikeStrip = "Land_Razorwire_F" createVehicle [0,0,0];
-_spikeStrip attachTo[player,[0,5.5,0]];
-_spikeStrip setDir 90;
-_spikeStrip setVariable ["item","spikeDeployed",true];
-
-life_action_spikeStripDeploy = player addAction[localize "STR_ISTR_Spike_Place",{if (!isNull life_spikestrip) then {detach life_spikeStrip; life_spikeStrip = objNull;}; player removeAction life_action_spikeStripDeploy; life_action_spikeStripDeploy = nil;},"",999,false,false,"",'!isNull life_spikestrip'];
-life_spikestrip = _spikeStrip;
-waitUntil {isNull life_spikeStrip};
-
-if (!isNil "life_action_spikeStripDeploy") then {player removeAction life_action_spikeStripDeploy;};
-if (isNull _spikeStrip) exitWith {life_spikestrip = objNull;};
-
-_spikeStrip setPos [(getPos _spikeStrip select 0),(getPos _spikeStrip select 1),0];
-_spikeStrip setDamage 1;
-
-life_action_spikeStripPickup = player addAction[localize "STR_ISTR_Spike_Pack",life_fnc_packupSpikes,"",0,false,false,"",
-' _spikes = nearestObjects[getPos player,["Land_Razorwire_F"],8] select 0; !isNil "_spikes" && !isNil {(_spikes getVariable "item")}'];
-
-if (life_HC_isActive) then {
- [_spikeStrip] remoteExec ["HC_fnc_spikeStrip",HC_Life]; //Send it to the HeadlessClient for monitoring.
-} else {
- [_spikeStrip] remoteExec ["TON_fnc_spikeStrip",RSERV]; //Send it to the server for monitoring.
-};
+#include "..\..\script_macros.hpp"
+/*
+ File: fn_spikeStrip.sqf
+ Author: Bryan "Tonic" Boardwine
+
+ Description:
+ Creates a spike strip and preps it.
+*/
+private _maxSpikeCount = LIFE_SETTINGS(getNumber,"maximumSpikestrips");
+life_spikesDeployed = life_spikesDeployed - [objNull];
+if (_maxSpikeCount isNotEqualTo -1 && {(count life_spikesDeployed) isEqualTo _maxSpikeCount}) exitWith {hint format [localize "STR_ISTR_MaxSpikesDeployed", _maxSpikeCount]};
+
+private _spikeStrip = "Land_Razorwire_F" createVehicle [0,0,0];
+_spikeStrip attachTo [player,[0,5.5,0]];
+_spikeStrip setDir 90;
+life_spikeStrip = _spikeStrip;
+life_spikesDeployed pushBack _spikeStrip;
+
+life_action_spikeStripDeploy = player addAction [localize "STR_ISTR_Spike_Place",life_fnc_deploySpikes,"",0,false,false,"",'!isNull life_spikestrip'];
diff --git a/Altis_Life.Altis/core/pmenu/fn_useItem.sqf b/Altis_Life.Altis/core/pmenu/fn_useItem.sqf
index 914466602..f7d4ebcd7 100644
--- a/Altis_Life.Altis/core/pmenu/fn_useItem.sqf
+++ b/Altis_Life.Altis/core/pmenu/fn_useItem.sqf
@@ -1,108 +1,108 @@
-#include "..\..\script_macros.hpp"
-
-/*
- File: fn_useItem.sqf
- Author: Bryan "Tonic" Boardwine
-
- Description:
- Main function for item effects and functionality through the player menu.
-*/
-
-disableSerialization;
-
-if ((lbCurSel 2005) isEqualTo -1) exitWith {
- hint localize "STR_ISTR_SelectItemFirst";
-};
-
-private _item = CONTROL_DATA(2005);
-private _edible = M_CONFIG(getNumber, "VirtualItems", _item, "edible");
-private _drinkable = M_CONFIG(getNumber, "VirtualItems", _item, "drinkable");
-
-if (_edible > -1 || _drinkable > -1) exitWith {
- if ([false, _item, 1] call life_fnc_handleInv) then {
- if (_edible > -1) then {
- private _sum = life_hunger + _edible;
- life_hunger = (_sum max 5) min 100; // never below 5 or above 100
- };
-
- if (_drinkable > -1) then {
- private _sum = life_thirst + _drinkable;
-
- life_thirst = (_sum max 5) min 100; // never below 5 or above 100
-
- if (LIFE_SETTINGS(getNumber, "enable_fatigue") isEqualTo 1) then {
- player setFatigue 0;
- };
- if (_item isEqualTo "redgull" && {LIFE_SETTINGS(getNumber, "enable_fatigue") isEqualTo 1}) then {
- [] spawn {
- life_redgull_effect = time;
- titleText [localize "STR_ISTR_RedGullEffect", "PLAIN"];
- player enableFatigue false;
- waitUntil {!alive player || ((time - life_redgull_effect) > (3 * 60))};
- player enableFatigue true;
- };
- };
- };
- };
-
- [] call life_fnc_p_updateMenu;
- [] call life_fnc_hudUpdate;
-};
-
-switch (_item) do {
- case "boltcutter": {
- [cursorObject] spawn life_fnc_boltcutter;
- closeDialog 0;
- };
-
- case "blastingcharge": {
- player reveal fed_bank;
- (group player) reveal fed_bank;
- [cursorObject] spawn life_fnc_blastingCharge;
- closeDialog 0;
- };
-
- case "defusekit": {
- [cursorObject] spawn life_fnc_defuseKit;
- closeDialog 0;
- };
-
- case "storagesmall": {
- [false] call life_fnc_storageBox;
- };
-
- case "storagebig": {
- [true] call life_fnc_storageBox;
- };
-
- case "spikeStrip": {
- if (!isNull life_spikestrip) exitWith {hint localize "STR_ISTR_SpikesDeployment"; closeDialog 0};
- if ([false, _item, 1] call life_fnc_handleInv) then {
- [] spawn life_fnc_spikeStrip;
- closeDialog 0;
- };
- };
-
- case "fuelFull": {
- if !(isNull objectParent player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
- [] spawn life_fnc_jerryRefuel;
- closeDialog 0;
- };
-
- case "fuelEmpty": {
- [] spawn life_fnc_jerryCanRefuel;
- closeDialog 0;
- };
-
- case "lockpick": {
- [] spawn life_fnc_lockpick;
- closeDialog 0;
- };
-
- default {
- hint localize "STR_ISTR_NotUsable";
- };
-};
-
-[] call life_fnc_p_updateMenu;
-[] call life_fnc_hudUpdate;
+#include "..\..\script_macros.hpp"
+
+/*
+ File: fn_useItem.sqf
+ Author: Bryan "Tonic" Boardwine
+
+ Description:
+ Main function for item effects and functionality through the player menu.
+*/
+
+disableSerialization;
+
+if ((lbCurSel 2005) isEqualTo -1) exitWith {
+ hint localize "STR_ISTR_SelectItemFirst";
+};
+
+private _item = CONTROL_DATA(2005);
+private _edible = M_CONFIG(getNumber, "VirtualItems", _item, "edible");
+private _drinkable = M_CONFIG(getNumber, "VirtualItems", _item, "drinkable");
+
+if (_edible > -1 || _drinkable > -1) exitWith {
+ if ([false, _item, 1] call life_fnc_handleInv) then {
+ if (_edible > -1) then {
+ private _sum = life_hunger + _edible;
+ life_hunger = (_sum max 5) min 100; // never below 5 or above 100
+ };
+
+ if (_drinkable > -1) then {
+ private _sum = life_thirst + _drinkable;
+
+ life_thirst = (_sum max 5) min 100; // never below 5 or above 100
+
+ if (LIFE_SETTINGS(getNumber, "enable_fatigue") isEqualTo 1) then {
+ player setFatigue 0;
+ };
+ if (_item isEqualTo "redgull" && {LIFE_SETTINGS(getNumber, "enable_fatigue") isEqualTo 1}) then {
+ [] spawn {
+ life_redgull_effect = time;
+ titleText [localize "STR_ISTR_RedGullEffect", "PLAIN"];
+ player enableFatigue false;
+ waitUntil {!alive player || ((time - life_redgull_effect) > (3 * 60))};
+ player enableFatigue true;
+ };
+ };
+ };
+ };
+
+ [] call life_fnc_p_updateMenu;
+ [] call life_fnc_hudUpdate;
+};
+
+switch (_item) do {
+ case "boltcutter": {
+ [cursorObject] spawn life_fnc_boltcutter;
+ closeDialog 0;
+ };
+
+ case "blastingcharge": {
+ player reveal fed_bank;
+ (group player) reveal fed_bank;
+ [cursorObject] spawn life_fnc_blastingCharge;
+ closeDialog 0;
+ };
+
+ case "defusekit": {
+ [cursorObject] spawn life_fnc_defuseKit;
+ closeDialog 0;
+ };
+
+ case "storagesmall": {
+ [false] call life_fnc_storageBox;
+ };
+
+ case "storagebig": {
+ [true] call life_fnc_storageBox;
+ };
+
+ case "spikeStrip": {
+ if !(isNull life_spikestrip) exitWith {hint localize "STR_ISTR_SpikesDeployment"; closeDialog 0};
+ if ([false, _item, 1] call life_fnc_handleInv) then {
+ [] call life_fnc_spikeStrip;
+ closeDialog 0;
+ };
+ };
+
+ case "fuelFull": {
+ if !(isNull objectParent player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
+ [] spawn life_fnc_jerryRefuel;
+ closeDialog 0;
+ };
+
+ case "fuelEmpty": {
+ [] spawn life_fnc_jerryCanRefuel;
+ closeDialog 0;
+ };
+
+ case "lockpick": {
+ [] spawn life_fnc_lockpick;
+ closeDialog 0;
+ };
+
+ default {
+ hint localize "STR_ISTR_NotUsable";
+ };
+};
+
+[] call life_fnc_p_updateMenu;
+[] call life_fnc_hudUpdate;
diff --git a/Altis_Life.Altis/stringtable.xml b/Altis_Life.Altis/stringtable.xml
index a8f8fdc53..e95ac3034 100644
--- a/Altis_Life.Altis/stringtable.xml
+++ b/Altis_Life.Altis/stringtable.xml
@@ -339,7 +339,6 @@
Caffe OLLEN
加油站咖啡店
-
Billy Joe's Firearms
Billy Joe střelné zbraně
@@ -8597,6 +8596,18 @@
Aktualnie masz rozłożoną kolczatkę
你已经部署了一个钉刺带。
+
+ You have the max number of spike strips already active (%1).
+ Máte již aktivní maximální počet špiček (%1).
+ Tiene el número máximo de tiras de espiga ya activas (%1).
+
+ Du hast die maximale Anzahl platzierbarer Nagelbänder (%1) erreicht.
+ Vous avez déjà déployé le nombre maximum de herses (%1).
+ Hai il numero massimo di striscia chiodata già attive (%1).
+ Você tem o número máximo de faixas de pico já ativas (%1).
+ Masz już maksymalną liczbę pasków kolców (%1).
+ 您已激活的最大钉条数量(%1)。
+
You can't refuel the vehicle while in it!
Nemůžete natankovat z vozidla, když v něm!
diff --git a/life_hc/MySQL/Items/fn_spikeStrip.sqf b/life_hc/MySQL/Items/fn_spikeStrip.sqf
index 8c4b9b541..2e2fd846a 100644
--- a/life_hc/MySQL/Items/fn_spikeStrip.sqf
+++ b/life_hc/MySQL/Items/fn_spikeStrip.sqf
@@ -1,24 +1,36 @@
-#include "\life_hc\hc_macros.hpp"
-/*
- File: fn_spikeStrip.sqf
- Author: Bryan "Tonic" Boardwine
-
- This file is for Nanou's HeadlessClient.
-
- Description:
- This is the server-side part of it which constantly monitors the spike strip and vehicles near it.
- First originally tried triggers but I was never any good at those nor do I like them as they
- have a global effect.
-*/
-private ["_nearVehicles","_spikeStrip"];
-_spikeStrip = [_this,0,objNull,[objNull]] call BIS_fnc_param;
-if (isNull _spikeStrip) exitWith {}; //Bad vehicle type passed.
-
-waitUntil {_nearVehicles = nearestObjects[getPos _spikeStrip,["Car"],5]; count _nearVehicles > 0 || isNull _spikeStrip};
-
-if (isNull _spikeStrip) exitWith {}; //It was picked up?
-_vehicle = _nearVehicles select 0;
-
-if (isNil "_vehicle") exitWith {deleteVehicle _spikeStrip;};
-[_vehicle] remoteExec ["life_fnc_spikeStripEffect",_vehicle];
-deleteVehicle _spikeStrip;
\ No newline at end of file
+#include "\life_hc\hc_macros.hpp"
+/*
+ File: fn_spikeStrip.sqf
+ Author: DomT602
+
+ This file is for Nanou's HeadlessClient.
+
+ Description:
+ Adds spikestrip to hc-side array and if required - starts the monitoring of spikestrips.
+*/
+params [
+ ["_spikeStrip", objNull, [objNull]]
+];
+if (isNull _spikeStrip) exitWith {};
+
+hc_spikes pushBack _spikeStrip;
+
+if (count hc_spikes isEqualTo 1) then { //start monitoring spikestrips
+ private _minSpikeSpeed = LIFE_SETTINGS(getNumber,"minimumSpikeSpeed");
+
+ for "_i" from 0 to 1 step 0 do {
+ if (hc_spikes isEqualTo []) exitWith {};
+
+ {
+ (nearestObjects [_x,["Car"],5]) params [["_nearVeh", objNull]];
+ if (alive _nearVeh && {abs (speed _nearVeh) > _minSpikeSpeed}) then {
+ [_nearVeh] remoteExecCall ["life_fnc_spikeStripEffect",_nearVeh];
+ deleteVehicle _x;
+ };
+ } forEach hc_spikes;
+
+ hc_spikes = hc_spikes - [objNull];
+
+ uiSleep 1e-6;
+ };
+};
diff --git a/life_hc/initHC.sqf b/life_hc/initHC.sqf
index 7d333a6a2..ee3014daf 100644
--- a/life_hc/initHC.sqf
+++ b/life_hc/initHC.sqf
@@ -1,123 +1,125 @@
-#include "hc_macros.hpp"
-/*
- File: fn_initHC.sqf
- Author: Nanou
-
- Description:
- Initialize the headless client.
-*/
-private ["_timeStamp","_extDBNotLoaded"];
-if (EXTDB_SETTING(getNumber,"HeadlessSupport") isEqualTo 0) exitWith {};
-
-_extDBNotLoaded = "";
-
-life_save_civilian_position = if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 0) then {false} else {true};
-
-if (isNil {uiNamespace getVariable "life_sql_id"}) then {
- life_sql_id = round(random(9999));
- CONSTVAR(life_sql_id);
- uiNamespace setVariable ["life_sql_id",life_sql_id];
-
- try {
- _result = EXTDB format ["9:ADD_DATABASE:%1",EXTDB_SETTING(getText,"DatabaseName")];
- if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
- _result = EXTDB format ["9:ADD_DATABASE_PROTOCOL:%2:SQL_CUSTOM:%1:AL.ini",FETCH_CONST(life_sql_id),EXTDB_SETTING(getText,"DatabaseName")];
- if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
- } catch {
- diag_log _exception;
- _extDBNotLoaded = [true, _exception];
- };
-
- if (_extDBNotLoaded isEqualType []) exitWith {};
- EXTDB "9:LOCK";
- diag_log "extDB3: Connected to Database";
-} else {
- life_sql_id = uiNamespace getVariable "life_sql_id";
- CONSTVAR(life_sql_id);
- diag_log "extDB3: Still Connected to Database";
-};
-
-if (_extDBNotLoaded isEqualType []) then {
- [] spawn {
- for "_i" from 0 to 1 step 0 do {
- [0,"There is a problem with the Headless Client, please contact an administrator."] remoteExecCall ["life_fnc_broadcast",RCLIENT];
- sleep 120;
- };
- };
-};
-
-if (_extDBNotLoaded isEqualType []) exitWith {}; //extDB3-HC did not fully initialize so terminate the rest of the initialization process.
-
-["resetLifeVehicles", 1] call HC_fnc_asyncCall;
-["deleteDeadVehicles", 1] call HC_fnc_asyncCall;
-["deleteOldHouses", 1] call HC_fnc_asyncCall;
-["deleteOldGangs", 1] call HC_fnc_asyncCall;
-
-_timeStamp = diag_tickTime;
-diag_log "----------------------------------------------------------------------------------------------------";
-diag_log "------------------------------------ Starting Altis Life HC Init -----------------------------------";
-diag_log format["-------------------------------------------- Version %1 -----------------------------------------",(LIFE_SETTINGS(getText,"framework_version"))];
-diag_log "----------------------------------------------------------------------------------------------------";
-
-[] spawn HC_fnc_cleanup;
-
-/* Initialize hunting zone(s) */
-["hunting_zone",30] spawn HC_fnc_huntingZone;
-
-// A list of allowed funcs to be passed on the hc (by external sources)
-// Have to be written in only lower capitals
-HC_MPAllowedFuncs = [
- "hc_fnc_insertrequest",
- "hc_fnc_insertvehicle",
- "hc_fnc_queryrequest",
- "hc_fnc_updatepartial",
- "hc_fnc_updaterequest",
- "hc_fnc_cleanup",
- "hc_fnc_huntingzone",
- "hc_fnc_setplaytime",
- "hc_fnc_getplaytime",
- "hc_fnc_insertgang",
- "hc_fnc_queryplayergang",
- "hc_fnc_removegang",
- "hc_fnc_updategang",
- "hc_fnc_addcontainer",
- "hc_fnc_addhouse",
- "hc_fnc_deletedbcontainer",
- "hc_fnc_fetchplayerhouses",
- "hc_fnc_sellhouse",
- "hc_fnc_sellhousecontainer",
- "hc_fnc_updatehousecontainers",
- "hc_fnc_updatehousetrunk",
- "hc_fnc_keymanagement",
- "hc_fnc_vehiclecreate",
- "hc_fnc_spawnvehicle",
- "hc_fnc_vehiclestore",
- "hc_fnc_chopshopsell",
- "hc_fnc_getvehicles",
- "hc_fnc_vehicledelete",
- "hc_fnc_vehicleupdate",
- "hc_fnc_jailsys",
- "hc_fnc_spikestrip",
- "hc_fnc_wantedadd",
- "hc_fnc_wantedbounty",
- "hc_fnc_wantedcrimes",
- "hc_fnc_wantedfetch",
- "hc_fnc_wantedperson",
- "hc_fnc_wantedprofupdate",
- "hc_fnc_wantedremove"
-];
-
-CONSTVAR(HC_MPAllowedFuncs);
-
-[] spawn {
- for "_i" from 0 to 1 step 0 do {
- uiSleep 60;
- publicVariableServer "serv_sv_use";
- };
-};
-
-life_HC_isActive = true;
-publicVariable "life_HC_isActive";
-diag_log "----------------------------------------------------------------------------------------------------";
-diag_log format [" End of Altis Life HC Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp];
-diag_log "----------------------------------------------------------------------------------------------------";
+#include "hc_macros.hpp"
+/*
+ File: fn_initHC.sqf
+ Author: Nanou
+
+ Description:
+ Initialize the headless client.
+*/
+private ["_timeStamp","_extDBNotLoaded"];
+if (EXTDB_SETTING(getNumber,"HeadlessSupport") isEqualTo 0) exitWith {};
+
+_extDBNotLoaded = "";
+
+life_save_civilian_position = if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 0) then {false} else {true};
+
+if (isNil {uiNamespace getVariable "life_sql_id"}) then {
+ life_sql_id = round(random(9999));
+ CONSTVAR(life_sql_id);
+ uiNamespace setVariable ["life_sql_id",life_sql_id];
+
+ try {
+ _result = EXTDB format ["9:ADD_DATABASE:%1",EXTDB_SETTING(getText,"DatabaseName")];
+ if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
+ _result = EXTDB format ["9:ADD_DATABASE_PROTOCOL:%2:SQL_CUSTOM:%1:AL.ini",FETCH_CONST(life_sql_id),EXTDB_SETTING(getText,"DatabaseName")];
+ if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
+ } catch {
+ diag_log _exception;
+ _extDBNotLoaded = [true, _exception];
+ };
+
+ if (_extDBNotLoaded isEqualType []) exitWith {};
+ EXTDB "9:LOCK";
+ diag_log "extDB3: Connected to Database";
+} else {
+ life_sql_id = uiNamespace getVariable "life_sql_id";
+ CONSTVAR(life_sql_id);
+ diag_log "extDB3: Still Connected to Database";
+};
+
+if (_extDBNotLoaded isEqualType []) then {
+ [] spawn {
+ for "_i" from 0 to 1 step 0 do {
+ [0,"There is a problem with the Headless Client, please contact an administrator."] remoteExecCall ["life_fnc_broadcast",RCLIENT];
+ sleep 120;
+ };
+ };
+};
+
+if (_extDBNotLoaded isEqualType []) exitWith {}; //extDB3-HC did not fully initialize so terminate the rest of the initialization process.
+
+["resetLifeVehicles", 1] call HC_fnc_asyncCall;
+["deleteDeadVehicles", 1] call HC_fnc_asyncCall;
+["deleteOldHouses", 1] call HC_fnc_asyncCall;
+["deleteOldGangs", 1] call HC_fnc_asyncCall;
+
+_timeStamp = diag_tickTime;
+diag_log "----------------------------------------------------------------------------------------------------";
+diag_log "------------------------------------ Starting Altis Life HC Init -----------------------------------";
+diag_log format["-------------------------------------------- Version %1 -----------------------------------------",(LIFE_SETTINGS(getText,"framework_version"))];
+diag_log "----------------------------------------------------------------------------------------------------";
+
+[] spawn HC_fnc_cleanup;
+
+/* Initialize hunting zone(s) */
+["hunting_zone",30] spawn HC_fnc_huntingZone;
+
+// A list of allowed funcs to be passed on the hc (by external sources)
+// Have to be written in only lower capitals
+HC_MPAllowedFuncs = [
+ "hc_fnc_insertrequest",
+ "hc_fnc_insertvehicle",
+ "hc_fnc_queryrequest",
+ "hc_fnc_updatepartial",
+ "hc_fnc_updaterequest",
+ "hc_fnc_cleanup",
+ "hc_fnc_huntingzone",
+ "hc_fnc_setplaytime",
+ "hc_fnc_getplaytime",
+ "hc_fnc_insertgang",
+ "hc_fnc_queryplayergang",
+ "hc_fnc_removegang",
+ "hc_fnc_updategang",
+ "hc_fnc_addcontainer",
+ "hc_fnc_addhouse",
+ "hc_fnc_deletedbcontainer",
+ "hc_fnc_fetchplayerhouses",
+ "hc_fnc_sellhouse",
+ "hc_fnc_sellhousecontainer",
+ "hc_fnc_updatehousecontainers",
+ "hc_fnc_updatehousetrunk",
+ "hc_fnc_keymanagement",
+ "hc_fnc_vehiclecreate",
+ "hc_fnc_spawnvehicle",
+ "hc_fnc_vehiclestore",
+ "hc_fnc_chopshopsell",
+ "hc_fnc_getvehicles",
+ "hc_fnc_vehicledelete",
+ "hc_fnc_vehicleupdate",
+ "hc_fnc_jailsys",
+ "hc_fnc_spikestrip",
+ "hc_fnc_wantedadd",
+ "hc_fnc_wantedbounty",
+ "hc_fnc_wantedcrimes",
+ "hc_fnc_wantedfetch",
+ "hc_fnc_wantedperson",
+ "hc_fnc_wantedprofupdate",
+ "hc_fnc_wantedremove"
+];
+
+CONSTVAR(HC_MPAllowedFuncs);
+
+[] spawn {
+ for "_i" from 0 to 1 step 0 do {
+ uiSleep 60;
+ publicVariableServer "serv_sv_use";
+ };
+};
+
+hc_spikes = [];
+
+life_HC_isActive = true;
+publicVariable "life_HC_isActive";
+diag_log "----------------------------------------------------------------------------------------------------";
+diag_log format [" End of Altis Life HC Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp];
+diag_log "----------------------------------------------------------------------------------------------------";
diff --git a/life_server/Functions/Systems/fn_spikeStrip.sqf b/life_server/Functions/Systems/fn_spikeStrip.sqf
index fa7438112..477edcf47 100644
--- a/life_server/Functions/Systems/fn_spikeStrip.sqf
+++ b/life_server/Functions/Systems/fn_spikeStrip.sqf
@@ -1,22 +1,34 @@
-#include "\life_server\script_macros.hpp"
-/*
- File: fn_spikeStrip.sqf
- Author: Bryan "Tonic" Boardwine
-
- Description:
- This is the server-side part of it which constantly monitors the spike strip and vehicles near it.
- First originally tried triggers but I was never any good at those nor do I like them as they
- have a global effect.
-*/
-private ["_nearVehicles","_spikeStrip"];
-_spikeStrip = [_this,0,objNull,[objNull]] call BIS_fnc_param;
-if (isNull _spikeStrip) exitWith {}; //Bad vehicle type passed.
-
-waitUntil {_nearVehicles = nearestObjects[getPos _spikeStrip,["Car"],5]; count _nearVehicles > 0 || isNull _spikeStrip};
-
-if (isNull _spikeStrip) exitWith {}; //It was picked up?
-_vehicle = _nearVehicles select 0;
-
-if (isNil "_vehicle") exitWith {deleteVehicle _spikeStrip;};
-[_vehicle] remoteExec ["life_fnc_spikeStripEffect",_vehicle];
-deleteVehicle _spikeStrip;
\ No newline at end of file
+#include "\life_server\script_macros.hpp"
+/*
+ File: fn_spikeStrip.sqf
+ Author: DomT602
+
+ Description:
+ Adds spikestrip to server-side array and if required - starts the monitoring of spikestrips.
+*/
+params [
+ ["_spikeStrip", objNull, [objNull]]
+];
+if (isNull _spikeStrip) exitWith {};
+
+server_spikes pushBack _spikeStrip;
+
+if (count server_spikes isEqualTo 1) then { //start monitoring spikestrips
+ private _minSpikeSpeed = LIFE_SETTINGS(getNumber,"minimumSpikeSpeed");
+
+ for "_i" from 0 to 1 step 0 do {
+ if (server_spikes isEqualTo []) exitWith {};
+
+ {
+ (nearestObjects [_x,["Car"],5]) params [["_nearVeh", objNull]];
+ if (alive _nearVeh && {abs (speed _nearVeh) > _minSpikeSpeed}) then {
+ [_nearVeh] remoteExecCall ["life_fnc_spikeStripEffect",_nearVeh];
+ deleteVehicle _x;
+ };
+ } forEach server_spikes;
+
+ server_spikes = server_spikes - [objNull];
+
+ uiSleep 1e-6;
+ };
+};
diff --git a/life_server/init.sqf b/life_server/init.sqf
index 7a2a63262..07fefcc97 100644
--- a/life_server/init.sqf
+++ b/life_server/init.sqf
@@ -1,199 +1,201 @@
-#include "script_macros.hpp"
-/*
- File: init.sqf
- Author: Bryan "Tonic" Boardwine
-
- Edit: Nanou for HeadlessClient optimization.
- Please read support for more informations.
-
- Description:
- Initialize the server and required systems.
-*/
-private ["_dome","_rsb","_timeStamp","_extDBNotLoaded"];
-DB_Async_Active = false;
-DB_Async_ExtraLock = false;
-life_server_isReady = false;
-_extDBNotLoaded = "";
-serv_sv_use = [];
-publicVariable "life_server_isReady";
-life_save_civilian_position = if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 0) then {false} else {true};
-
-/*
- Prepare the headless client.
-*/
-life_HC_isActive = false;
-publicVariable "life_HC_isActive";
-HC_Life = false;
-publicVariable "HC_Life";
-
-if (EXTDB_SETTING(getNumber,"HeadlessSupport") isEqualTo 1) then {
- [] execVM "\life_server\initHC.sqf";
-};
-
-/*
- Prepare extDB before starting the initialization process
- for the server.
-*/
-
-if (isNil {uiNamespace getVariable "life_sql_id"}) then {
- life_sql_id = round(random(9999));
- CONSTVAR(life_sql_id);
- uiNamespace setVariable ["life_sql_id",life_sql_id];
- try {
- _result = EXTDB format ["9:ADD_DATABASE:%1",EXTDB_SETTING(getText,"DatabaseName")];
- if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
- _result = EXTDB format ["9:ADD_DATABASE_PROTOCOL:%2:SQL_CUSTOM:%1:AL.ini",FETCH_CONST(life_sql_id),EXTDB_SETTING(getText,"DatabaseName")];
- if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
- } catch {
- diag_log _exception;
- _extDBNotLoaded = [true, _exception];
- };
- if (_extDBNotLoaded isEqualType []) exitWith {};
- EXTDB "9:LOCK";
- diag_log "extDB3: Connected to Database";
-} else {
- life_sql_id = uiNamespace getVariable "life_sql_id";
- CONSTVAR(life_sql_id);
- diag_log "extDB3: Still Connected to Database";
-};
-
-
-if (_extDBNotLoaded isEqualType []) exitWith {
- life_server_extDB_notLoaded = true;
- publicVariable "life_server_extDB_notLoaded";
-};
-life_server_extDB_notLoaded = false;
-publicVariable "life_server_extDB_notLoaded";
-
-/* Run stored procedures for SQL side cleanup */
-["resetLifeVehicles", 1] call DB_fnc_asyncCall;
-["deleteDeadVehicles", 1] call DB_fnc_asyncCall;
-["deleteOldHouses", 1] call DB_fnc_asyncCall;
-["deleteOldGangs", 1] call DB_fnc_asyncCall;
-
-_timeStamp = diag_tickTime;
-diag_log "----------------------------------------------------------------------------------------------------";
-diag_log "---------------------------------- Starting Altis Life Server Init ---------------------------------";
-diag_log format["------------------------------------------ Version %1 -------------------------------------------",(LIFE_SETTINGS(getText,"framework_version"))];
-diag_log "----------------------------------------------------------------------------------------------------";
-
-if (LIFE_SETTINGS(getNumber,"save_civilian_position_restart") isEqualTo 1) then {
- [] spawn {
- ["updateCivAlive", 1] call DB_fnc_asyncCall;
- };
-};
-
-/* Map-based server side initialization. */
-master_group attachTo[bank_obj,[0,0,0]];
-
-{
- _hs = createVehicle ["Land_Hospital_main_F", [0,0,0], [], 0, "NONE"];
- _hs setDir (markerDir _x);
- _hs setPosATL (getMarkerPos _x);
- _var = createVehicle ["Land_Hospital_side1_F", [0,0,0], [], 0, "NONE"];
- _var attachTo [_hs, [4.69775,32.6045,-0.1125]];
- detach _var;
- _var = createVehicle ["Land_Hospital_side2_F", [0,0,0], [], 0, "NONE"];
- _var attachTo [_hs, [-28.0336,-10.0317,0.0889387]];
- detach _var;
- if (worldName isEqualTo "Tanoa") then {
- if (_forEachIndex isEqualTo 0) then {
- atm_hospital_2 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
- vendor_hospital_2 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
- "medic_spawn_3" setMarkerPos (_var modelToWorld [8.01172,-5.47852,-8.20022]);
- "med_car_2" setMarkerPos (_var modelToWorld [8.01172,-5.47852,-8.20022]);
- hospital_assis_2 setPos (_hs modelToWorld [0.0175781,0.0234375,-0.231956]);
- } else {
- atm_hospital_3 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
- vendor_hospital_3 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
- "medic_spawn_1" setMarkerPos (_var modelToWorld [-1.85181,-6.07715,-8.24944]);
- "med_car_1" setMarkerPos (_var modelToWorld [5.9624,11.8799,-8.28493]);
- hospital_assis_2 setPos (_hs modelToWorld [0.0175781,0.0234375,-0.231956]);
- };
- };
-} forEach ["hospital_2","hospital_3"];
-
-{
- if (!isPlayer _x) then {
- _npc = _x;
- {
- if (_x != "") then {
- _npc removeWeapon _x;
- };
- } forEach [primaryWeapon _npc,secondaryWeapon _npc,handgunWeapon _npc];
- };
-} forEach allUnits;
-
-[8,true,12] execFSM "\life_server\FSM\timeModule.fsm";
-
-life_adminLevel = 0;
-life_medicLevel = 0;
-life_copLevel = 0;
-CONST(JxMxE_PublishVehicle,"false");
-
-/* Setup radio channels for west/independent/civilian */
-life_radio_west = radioChannelCreate [[0, 0.95, 1, 0.8], "Side Channel", "%UNIT_NAME", []];
-life_radio_civ = radioChannelCreate [[0, 0.95, 1, 0.8], "Side Channel", "%UNIT_NAME", []];
-life_radio_indep = radioChannelCreate [[0, 0.95, 1, 0.8], "Side Channel", "%UNIT_NAME", []];
-
-/* Set the amount of gold in the federal reserve at mission start */
-fed_bank setVariable ["safe",count playableUnits,true];
-
-/* Event handler for disconnecting players */
-addMissionEventHandler ["HandleDisconnect",{_this call TON_fnc_clientDisconnect; false;}];
-
-/* Set OwnerID players for Headless Client */
-TON_fnc_requestClientID =
-{
- (_this select 1) setVariable ["life_clientID", owner (_this select 1), true];
-};
-"life_fnc_RequestClientId" addPublicVariableEventHandler TON_fnc_requestClientID;
-
-/* Event handler for logs */
-"money_log" addPublicVariableEventHandler {diag_log (_this select 1)};
-"advanced_log" addPublicVariableEventHandler {diag_log (_this select 1)};
-
-/* Miscellaneous mission-required stuff */
-life_wanted_list = [];
-
-[] spawn TON_fnc_initHouses;
-cleanup = [] spawn TON_fnc_cleanup;
-
-TON_fnc_playtime_values = [];
-TON_fnc_playtime_values_request = [];
-
-//Just incase the Headless Client connects before anyone else
-publicVariable "TON_fnc_playtime_values";
-publicVariable "TON_fnc_playtime_values_request";
-
-
-/* Setup the federal reserve building(s) */
-private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_util_fnc_terrainSort;
-private _altisArray = [16019.5,16952.9,0];
-private _tanoaArray = [11074.2,11501.5,0.00137329];
-private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_util_fnc_terrainSort;
-
-_dome = nearestObject [_pos,"Land_Dome_Big_F"];
-_rsb = nearestObject [_pos,_vaultHouse];
-
-for "_i" from 1 to 3 do {_dome setVariable [format ["bis_disabled_Door_%1",_i],1,true]; _dome animateSource [format ["Door_%1_source", _i], 0];};
-_dome setVariable ["locked",true,true];
-_rsb setVariable ["locked",true,true];
-_rsb setVariable ["bis_disabled_Door_1",1,true];
-_dome allowDamage false;
-_rsb allowDamage false;
-
-/* Tell clients that the server is ready and is accepting queries */
-life_server_isReady = true;
-publicVariable "life_server_isReady";
-
-/* Initialize hunting zone(s) */
-aiSpawn = ["hunting_zone",30] spawn TON_fnc_huntingZone;
-
-server_corpses = [];
-addMissionEventHandler ["EntityRespawned", {_this call TON_fnc_entityRespawned}];
-addMissionEventHandler ["EntityKilled", {_this call TON_fnc_entityKilled}];
-
-diag_log "----------------------------------------------------------------------------------------------------";
-diag_log format [" End of Altis Life Server Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp];
-diag_log "----------------------------------------------------------------------------------------------------";
+#include "script_macros.hpp"
+/*
+ File: init.sqf
+ Author: Bryan "Tonic" Boardwine
+
+ Edit: Nanou for HeadlessClient optimization.
+ Please read support for more informations.
+
+ Description:
+ Initialize the server and required systems.
+*/
+private ["_dome","_rsb","_timeStamp","_extDBNotLoaded"];
+DB_Async_Active = false;
+DB_Async_ExtraLock = false;
+life_server_isReady = false;
+_extDBNotLoaded = "";
+serv_sv_use = [];
+publicVariable "life_server_isReady";
+life_save_civilian_position = if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 0) then {false} else {true};
+
+/*
+ Prepare the headless client.
+*/
+life_HC_isActive = false;
+publicVariable "life_HC_isActive";
+HC_Life = false;
+publicVariable "HC_Life";
+
+if (EXTDB_SETTING(getNumber,"HeadlessSupport") isEqualTo 1) then {
+ [] execVM "\life_server\initHC.sqf";
+};
+
+/*
+ Prepare extDB before starting the initialization process
+ for the server.
+*/
+
+if (isNil {uiNamespace getVariable "life_sql_id"}) then {
+ life_sql_id = round(random(9999));
+ CONSTVAR(life_sql_id);
+ uiNamespace setVariable ["life_sql_id",life_sql_id];
+ try {
+ _result = EXTDB format ["9:ADD_DATABASE:%1",EXTDB_SETTING(getText,"DatabaseName")];
+ if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
+ _result = EXTDB format ["9:ADD_DATABASE_PROTOCOL:%2:SQL_CUSTOM:%1:AL.ini",FETCH_CONST(life_sql_id),EXTDB_SETTING(getText,"DatabaseName")];
+ if (!(_result isEqualTo "[1]")) then {throw "extDB3: Error with Database Connection"};
+ } catch {
+ diag_log _exception;
+ _extDBNotLoaded = [true, _exception];
+ };
+ if (_extDBNotLoaded isEqualType []) exitWith {};
+ EXTDB "9:LOCK";
+ diag_log "extDB3: Connected to Database";
+} else {
+ life_sql_id = uiNamespace getVariable "life_sql_id";
+ CONSTVAR(life_sql_id);
+ diag_log "extDB3: Still Connected to Database";
+};
+
+
+if (_extDBNotLoaded isEqualType []) exitWith {
+ life_server_extDB_notLoaded = true;
+ publicVariable "life_server_extDB_notLoaded";
+};
+life_server_extDB_notLoaded = false;
+publicVariable "life_server_extDB_notLoaded";
+
+/* Run stored procedures for SQL side cleanup */
+["resetLifeVehicles", 1] call DB_fnc_asyncCall;
+["deleteDeadVehicles", 1] call DB_fnc_asyncCall;
+["deleteOldHouses", 1] call DB_fnc_asyncCall;
+["deleteOldGangs", 1] call DB_fnc_asyncCall;
+
+_timeStamp = diag_tickTime;
+diag_log "----------------------------------------------------------------------------------------------------";
+diag_log "---------------------------------- Starting Altis Life Server Init ---------------------------------";
+diag_log format["------------------------------------------ Version %1 -------------------------------------------",(LIFE_SETTINGS(getText,"framework_version"))];
+diag_log "----------------------------------------------------------------------------------------------------";
+
+if (LIFE_SETTINGS(getNumber,"save_civilian_position_restart") isEqualTo 1) then {
+ [] spawn {
+ ["updateCivAlive", 1] call DB_fnc_asyncCall;
+ };
+};
+
+/* Map-based server side initialization. */
+master_group attachTo[bank_obj,[0,0,0]];
+
+{
+ _hs = createVehicle ["Land_Hospital_main_F", [0,0,0], [], 0, "NONE"];
+ _hs setDir (markerDir _x);
+ _hs setPosATL (getMarkerPos _x);
+ _var = createVehicle ["Land_Hospital_side1_F", [0,0,0], [], 0, "NONE"];
+ _var attachTo [_hs, [4.69775,32.6045,-0.1125]];
+ detach _var;
+ _var = createVehicle ["Land_Hospital_side2_F", [0,0,0], [], 0, "NONE"];
+ _var attachTo [_hs, [-28.0336,-10.0317,0.0889387]];
+ detach _var;
+ if (worldName isEqualTo "Tanoa") then {
+ if (_forEachIndex isEqualTo 0) then {
+ atm_hospital_2 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
+ vendor_hospital_2 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
+ "medic_spawn_3" setMarkerPos (_var modelToWorld [8.01172,-5.47852,-8.20022]);
+ "med_car_2" setMarkerPos (_var modelToWorld [8.01172,-5.47852,-8.20022]);
+ hospital_assis_2 setPos (_hs modelToWorld [0.0175781,0.0234375,-0.231956]);
+ } else {
+ atm_hospital_3 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
+ vendor_hospital_3 setPos (_var modelToWorld [4.48633,0.438477,-8.25683]);
+ "medic_spawn_1" setMarkerPos (_var modelToWorld [-1.85181,-6.07715,-8.24944]);
+ "med_car_1" setMarkerPos (_var modelToWorld [5.9624,11.8799,-8.28493]);
+ hospital_assis_2 setPos (_hs modelToWorld [0.0175781,0.0234375,-0.231956]);
+ };
+ };
+} forEach ["hospital_2","hospital_3"];
+
+{
+ if (!isPlayer _x) then {
+ _npc = _x;
+ {
+ if (_x != "") then {
+ _npc removeWeapon _x;
+ };
+ } forEach [primaryWeapon _npc,secondaryWeapon _npc,handgunWeapon _npc];
+ };
+} forEach allUnits;
+
+[8,true,12] execFSM "\life_server\FSM\timeModule.fsm";
+
+life_adminLevel = 0;
+life_medicLevel = 0;
+life_copLevel = 0;
+CONST(JxMxE_PublishVehicle,"false");
+
+/* Setup radio channels for west/independent/civilian */
+life_radio_west = radioChannelCreate [[0, 0.95, 1, 0.8], "Side Channel", "%UNIT_NAME", []];
+life_radio_civ = radioChannelCreate [[0, 0.95, 1, 0.8], "Side Channel", "%UNIT_NAME", []];
+life_radio_indep = radioChannelCreate [[0, 0.95, 1, 0.8], "Side Channel", "%UNIT_NAME", []];
+
+/* Set the amount of gold in the federal reserve at mission start */
+fed_bank setVariable ["safe",count playableUnits,true];
+
+/* Event handler for disconnecting players */
+addMissionEventHandler ["HandleDisconnect",{_this call TON_fnc_clientDisconnect; false;}];
+
+/* Set OwnerID players for Headless Client */
+TON_fnc_requestClientID =
+{
+ (_this select 1) setVariable ["life_clientID", owner (_this select 1), true];
+};
+"life_fnc_RequestClientId" addPublicVariableEventHandler TON_fnc_requestClientID;
+
+/* Event handler for logs */
+"money_log" addPublicVariableEventHandler {diag_log (_this select 1)};
+"advanced_log" addPublicVariableEventHandler {diag_log (_this select 1)};
+
+/* Miscellaneous mission-required stuff */
+life_wanted_list = [];
+
+[] spawn TON_fnc_initHouses;
+cleanup = [] spawn TON_fnc_cleanup;
+
+TON_fnc_playtime_values = [];
+TON_fnc_playtime_values_request = [];
+
+//Just incase the Headless Client connects before anyone else
+publicVariable "TON_fnc_playtime_values";
+publicVariable "TON_fnc_playtime_values_request";
+
+
+/* Setup the federal reserve building(s) */
+private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_util_fnc_terrainSort;
+private _altisArray = [16019.5,16952.9,0];
+private _tanoaArray = [11074.2,11501.5,0.00137329];
+private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_util_fnc_terrainSort;
+
+_dome = nearestObject [_pos,"Land_Dome_Big_F"];
+_rsb = nearestObject [_pos,_vaultHouse];
+
+for "_i" from 1 to 3 do {_dome setVariable [format ["bis_disabled_Door_%1",_i],1,true]; _dome animateSource [format ["Door_%1_source", _i], 0];};
+_dome setVariable ["locked",true,true];
+_rsb setVariable ["locked",true,true];
+_rsb setVariable ["bis_disabled_Door_1",1,true];
+_dome allowDamage false;
+_rsb allowDamage false;
+
+/* Tell clients that the server is ready and is accepting queries */
+life_server_isReady = true;
+publicVariable "life_server_isReady";
+
+/* Initialize hunting zone(s) */
+aiSpawn = ["hunting_zone",30] spawn TON_fnc_huntingZone;
+
+server_corpses = [];
+addMissionEventHandler ["EntityRespawned", {_this call TON_fnc_entityRespawned}];
+addMissionEventHandler ["EntityKilled", {_this call TON_fnc_entityKilled}];
+
+server_spikes = [];
+
+diag_log "----------------------------------------------------------------------------------------------------";
+diag_log format [" End of Altis Life Server Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp];
+diag_log "----------------------------------------------------------------------------------------------------";