Jump to content

[Tutorial] Vehicle Insurance


FazeCHEF
 Share

Recommended Posts

Original Post - N/A

Original Author - Shakir Darwish

 

Open your "dialog" folder and then open "impound.hpp"

Add this to classSellCar:

 class InsureCar : life_RscButtonMenu 
 { 
 idc = 97480; 
text =  "ensure" ;
 onButtonClick = "[] call life_fnc_insureCar;"; 
 x = 0.43 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH)); 
and =  0 . 9  - ( 1  /  25 );
 w = (6.25 / 40); 
 h = (1 / 25); 
 }; 

Go to dialog>functions and add a new file named "fn_insureCar.sqf"

Paste this in the new document:

#include "..\..\script_macros.hpp" 
/* 
 File: fn_insureCar.sqf 
 Author: Guit0x "Lintox" 
 Description: 
 Insure a vehicle from the garage. 
*/ 
private["_vehicle","_vehicleLife","_vid","_pid","_unit","_multiplier","_price","_purchasePrice","_insurancePrice"]; 
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; 
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_insurance_multiplier_CIVILIAN"); 
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN"); 
 }; 
 case west: { 
 _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_COP"); 
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP"); 
 }; 
 case independent: { 
 _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_MEDIC"); 
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC"); 
 }; 
 case east: { 
 _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_OPFOR"); 
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR"); 
 }; 
}; 
_insurancePrice = _purchasePrice * _multiplier; 
if(!(_insurancePrice isEqualType 0) || _insurancePrice < 1) then {_insurancePrice = 500}; 
if(BANK < _insurancePrice) exitWith {hint format[(localize "STR_GNOTF_NotEnoughMoney"),[_insurancePrice] call life_fnc_numberText];}; 
if (life_HC_isActive) then { 
 [_vid,_pid,_insurancePrice,player,life_garage_type] remoteExecCall ["HC_fnc_insureCar",HC_Life]; 
} else { 
 [_vid,_pid,_insurancePrice,player,life_garage_type] remoteExecCall ["TON_fnc_insureCar",RSERV]; 
}; 
hint localize "STR_InsuranceApply"; 
BANK = BANK - _insurancePrice; 
life_action_delay = time; 
closeDialog 0;

Open "function.hpp" in your "dialog" folder and add:

 class Dialog_Controls
 {
 file = "dialog\function";
 [...]
 class insureCar {};
 [...]
 };

Then open your "functions" folder in your "dialog" folder and open "fn_garageLBChange.sqf"

Replace this:

private["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_price","_storageFee","_purchasePrice"];

With this:

private["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_insurance","_insuranceMultiplier","_price","_storageFee","_purchasePrice","_insurancePrice"];

After this:

_classNameLife = _className;

Add this:

_insurance = (_dataArr select 2 );

Replace this:

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"); 
 }; 
};

With this:

switch (playerSide) do {
 case civilian: {
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
 _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
 _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_CIVILIAN");
 };
 case west: {
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
 _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
 _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_COP");
 };
 case independent: {
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
 _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
 _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_MEDIC");
 };
 case east: {
 _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
 _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
 _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_OPFOR");
 };
};

After this:

_sellPrice = _purchasePrice * _sellMultiplier;

Add this:

_insurancePrice = _purchasePrice * _insuranceMultiplier;

After this:

if (!(_retrievePrice isEqualType 0) || _retrievePrice < 1) then {_retrievePrice = 500;};

Add this:

if (!(_insurancePrice isEqualType 0) || _insurancePrice < 1) then {_insurancePrice = 500;};

Replace this:

(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 
 ",

With this:

(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/>
Prix de l'assurance: <t color='#8cff9b'>$%9</t><br/>
State Insurance: %10 <br/>
" +(localize "STR_Shop_Veh_UI_Color")+ " <t color='#8cff9b'>%8</t><br/>
" +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " <t color='#8cff9b'>%3 km/h</t><br/>
" +(localize "STR_Shop_Veh_UI_HPower")+ " <t color='#8cff9b'>%4</t><br/>
" +(localize "STR_Shop_Veh_UI_PSeats")+ " <t color='#8cff9b'>%5</t><br/>
" +(localize "STR_Shop_Veh_UI_Trunk")+ " <t color='#8cff9b'>%6</t><br/>
" +(localize "STR_Shop_Veh_UI_Fuel")+ " <t color='#8cff9b'>%7</t>
",

Replace this:

(_vehicleInfo select 12),
_vehicleColor
];

With this:

(_vehicleInfo select 12),
_vehicleColor,
[_insurancePrice] call life_fnc_numberText,
if(_insurance == 1) then {"<t color='#8cff9b'>Assuré</t>"} else {"<t color='#FF0000'>Pas d'assurance</t>"},
(_vehicleInfo select 9)
];
if(_insurance == 1) then {
ctrlShow [97480,False];
}else{
ctrlShow [97480,True];
};

Open dialog>function>fn_impoundMenu.sqf

Replace this:

_tmp = [(_x select 2),(_x select 8)];

With this:

_tmp = [(_x select 2),(_x select 8),(_x select 9)];

Open CfgRemoteExec.hpp and add this in server only functions:

F(TON_fnc_insureCar,SERVER) 

In Headless Client functions:

F(HC_fnc_insureCar,HC)

Open your stringtable.xml and add this:

<Key ID="STR_InsuranceApply"> 
 <Original>You just insure your vehicle you are now protected against explosions!</Original> 
 < Czech > Now you insure your vehicle is now protected against explosions ! < / Czech > 
 < Spanish > You just make sure your vehicle is now protected against explosions ! < / Spanish > 
 < Italian > Just ensure your vehicle you are now protected against explosions ! < / Italian > 
 < Polish > Just insure your vehicle you are now protected from explosion ! < / Polish > 
 < Russian > You just insure your car, you are now protected against explosions ! < / Russian > 
 < French > You just make your vehicle you are now protected against explosions ! < / French > 
 < Portuguese > You just hold your vehicle you are now protected against explosions ! < / Portuguese > 
 < German > They only insure your vehicle, you are now protected against explosions ! < / German > 
 </Key>

Under "<Key ID="STR_pInAct_SellGarage"

Then open your Config_Master.hpp and add:

/* Vehicle Insurance Prices */ 
vehicle_insurance_multiplier_CIVILIAN = .25; //Civilian Vehicle Insurance Price = Vehicle Buy Price * multiplier 
vehicle_insurance_multiplier_COP = .1; //Cop Vehicle Insurance Price = Vehicle Buy Price * multiplier 
vehicle_insurance_multiplier_MEDIC = .1; //Medic Vehicle Insurance Price = Vehicle Buy Price * multiplier 
vehicle_insurance_multiplier_OPFOR = -1; // -- NOT IN USE -- Simply left in for east support.

 

In life_server:

Open "config.cpp" and under class Ton_System (both life and hc) add:

class insureCar {};

In functions>systems>fn_spawnVehicle.sqf:

Replace this:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, inventory, gear, fuel, damage, blacklist FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];

With this:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, inventory, gear, fuel, damage, blacklist, insure FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];

Replace this:

_vehicle setVariable ["dbInfo",[(_vInfo select 4),(_vInfo select 7)],true];

With this:

_vehicle setVariable ["dbInfo",[(_vInfo select 4),(_vInfo select 7),(_vInfo select 14)],true];

Replace this:

[1,_spawntext] remoteExecCall ["life_fnc_broadcast",_unit];
serv_sv_use deleteAt _servIndex;

With this:

if ((_vInfo select 14) isEqualTo 1) then {
[ 1 , "Your vehicle is available and it is assured!" ] RemoteExecCall [ "life_fnc_broadcast" , _unit];
}else{
[ 1 , "Your vehicle is available but is not insured!" ] RemoteExecCall [ "life_fnc_broadcast" , _unit];
};
serv_sv_use deleteAt _servIndex;

In functions>systems create a new file named "fn_insureCar.sqf" and paste this:

/*
File: fn_insureCar.sqf
Author: Guit0x "Lintox"
Description:
Insure a vehicle from the garage.
*/
private["_vid","_pid","_query","_sql","_unit","_insurancePrice","_thread"];
_vid = [_this,0,-1,[0]] call BIS_fnc_param;
_pid = [_this,1,"",[""]] call BIS_fnc_param;
_unit = [_this,2,ObjNull,[ObjNull]] call BIS_fnc_param;
_insurancePrice = [_this,3,0,[0]] call BIS_fnc_param;
_query = format["UPDATE vehicles SET insure='1' WHERE pid='%1' AND id='%2'",_pid,_vid];
waitUntil { ! DB_Async_Active};
_thread = [_query,1] call DB_fnc_asyncCall;

For life_hc paste this instead:

/*
File: fn_insureCar.sqf
Author: Guit0x "Lintox"
Description:
Insure a vehicle from the garage.
*/
private["_vid","_pid","_query","_sql","_unit","_insurancePrice","_thread"];
_vid = [_this,0,-1,[0]] call BIS_fnc_param;
_pid = [_this,1,"",[""]] call BIS_fnc_param;
_unit = [_this,2,ObjNull,[ObjNull]] call BIS_fnc_param;
_insurancePrice = [_this,3,0,[0]] call BIS_fnc_param;
_query = format["UPDATE vehicles SET insure=‘1' WHERE pid='%1' AND id='%2'",_pid,_vid];
waitUntil { ! DB_Async_Active};
_thread = [_query,1] call HC_fnc_asyncCall;

In FSM>cleanup.fsm replace the entire document with:

/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Server-Side Cleanup">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-62.908096,-391.651611,27.091887,-341.651672,0.000000,"init"};
item1[] = {"true",8,218,-62.976639,-315.185364,27.023363,-265.185364,0.000000,"true"};
item2[] = {"Share__Work_load",2,250,-64.183350,-224.681931,25.816656,-174.681931,0.000000,"Share " \n "Work-load"};
item3[] = {"Continue__",4,218,-220.591476,74.216980,-130.591476,124.216980,0.000000,"" \n "" \n "Continue" \n "" \n ""};
item4[] = {"Time_Check",4,218,-219.425827,-133.310532,-129.425964,-83.310455,0.000000,"Time Check"};
item5[] = {"Delete_Dead_Cars",2,4346,-220.186951,-29.248400,-130.187195,20.751413,0.000000,"Delete" \n "Dead" \n "Cars"};
item6[] = {"",7,210,-312.538239,95.295059,-304.538239,103.295059,0.000000,""};
item7[] = {"",7,210,-312.798218,-204.081940,-304.798218,-196.081940,0.000000,""};
item8[] = {"End_Cleanup_",1,250,-64.828239,87.581070,25.171984,137.581238,0.000000,"" \n "End Cleanup" \n ""};
item9[] = {"Check_for_HC_",4,218,-65.059021,-30.047342,24.941008,19.952658,0.000000,"" \n "Check for HC" \n ""};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,4};
link3[] = {3,6};
link4[] = {4,5};
link5[] = {5,3};
link6[] = {5,9};
link7[] = {6,7};
link8[] = {7,2};
link9[] = {9,8};
globals[] = {0.000000,0,0,0,0,640,480,1,53,6316128,1,-481.887177,425.726196,554.522583,-436.926575,170,901,1};
window[] = {0,-1,-1,-32000,-32000,1065,104,1468,104,1,188};
*//*%FSM</HEAD>*/
class FSM
{
  fsmName = "Server-Side Cleanup";
  class States
  {
    /*%FSM<STATE "init">*/
    class init
    {
      name = "init";
      init = /*%FSM<STATEINIT""">*/"private [""_impound"",""_cars"",""_objs"",""_totCars"",""_thread""];" \n
       "_impound = time;" \n
       "_cars = time;" \n
       "_objs = time;" \n
       "cleanupFSM setFSMVariable [""stopfsm"",false];"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="Share__Work_load";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "Share__Work_load">*/
    class Share__Work_load
    {
      name = "Share__Work_load";
      init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "Time_Check">*/
        class Time_Check
        {
          priority = 0.000000;
          to="Delete_Dead_Cars";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((time - _cars) > (3 * 60))"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "Delete_Dead_Cars">*/
    class Delete_Dead_Cars
    {
      name = "Delete_Dead_Cars";
      init = /*%FSM<STATEINIT""">*/"{" \n
       "	if (!alive _x) then {" \n
       "		_dbInfo = _x getVariable [""dbInfo"",[]];" \n
       "		if (count _dbInfo > 0) then {" \n
       "			_uid = _dbInfo select 0;" \n
       "			_plate = _dbInfo select 1;" \n
       "			_insureSystem = _dbInfo select 2;" \n
       "			 diag_log "" destroy vehicle !"";" \n
       "			diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "			if(_insureSystem == 1) then " \n
       "			{ diag_log "" Insured !"";" \n
       "			 diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "" \n
       "			_query_0 = format [""UPDATE vehicles SET alive='1', insure='0', active='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate];" \n
       "			_query_0 spawn {" \n
       "				" \n
       "				_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "			};" \n
       "		} else {" \n
       "			 diag_log "" Not insured !"";" \n
       " 				diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "				 _query = format[""UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
       "			 _query spawn {" \n
       "			_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "			};" \n
       "		};" \n
       "		if (!isNil ""_x"" && {!isNull _x}) then {" \n
       "			deleteVehicle _x;" \n
       "		};" \n
       "	};" \n
       "};" \n
       "} forEach allMissionObjects ""LandVehicle"";" \n
       "" \n
       "{" \n
       "	if (!alive _x) then {" \n
       "		_dbInfo = _x getVariable [""dbInfo"",[]];" \n
       "		if (count _dbInfo > 0) then {" \n
       "			_uid = _dbInfo select 0;" \n
       "			_plate = _dbInfo select 1;" \n
       "			_insureSystem = _dbInfo select 2;" \n
       "			 diag_log "" destroy vehicle !"";" \n
       "			 diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "			 if(_insureSystem == 1) then" \n
       "			{ diag_log "" Insured !"";" \n
       "			 diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "			_query_0 = format [""UPDATE vehicles SET alive='1', insure='0', active='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate];" \n
       "			_query_0 spawn {" \n
       "				" \n
       "				_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "            };} else { " \n
       "				diag_log "" Not Insured !"";" \n
       "			      diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "				_query = format[""UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
       "				_query spawn {" \n
       "			_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "			};" \n
       "		};" \n
       "	};" \n
       "		if (!isNil ""_x"" && {!isNull _x}) then {" \n
       "			deleteVehicle _x;" \n
       "		};" \n
       "	};" \n
       "} forEach allMissionObjects ""Air"";" \n
       "_cars = time;" \n
       "" \n
       "//Group cleanup." \n
       "{" \n
       "	if (units _x isEqualTo [] && local _x) then {" \n
       "		deleteGroup _x;" \n
       "	};" \n
       "} forEach allGroups;"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "Check_for_HC_">*/
        class Check_for_HC_
        {
          priority = 0.000000;
          to="End_Cleanup_";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"cleanupFSM getFSMVariable ""stopfsm"""/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "Continue__">*/
        class Continue__
        {
          priority = 0.000000;
          to="Share__Work_load";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"!(cleanupFSM getFSMVariable ""stopfsm"")"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "End_Cleanup_">*/
    class End_Cleanup_
    {
      name = "End_Cleanup_";
      init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
      };
    };
    /*%FSM</STATE>*/
  };
  initState="init";
  finalStates[] =
  {
    "End_Cleanup_",
  };
};
/*%FSM</COMPILE>*/

For life_hc paste this instead:

/*%FSM<COMPILE "D:\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Server-Side Cleanup">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-65.004578,-391.651611,24.995417,-341.651672,0.000000,"init"};
item1[] = {"true",8,218,-62.976639,-315.185364,27.023363,-265.185364,0.000000,"true"};
item2[] = {"Share__Work_load",2,250,-64.183350,-224.681931,25.816656,-174.681931,0.000000,"Share " \n "Work-load"};
item3[] = {"true",8,218,-54.709698,75.189262,35.290302,125.189262,0.000000,"true"};
item4[] = {"Time_Check",4,218,-219.425827,-133.310532,-129.425964,-83.310455,0.000000,"Time Check"};
item5[] = {"Delete_Dead_Cars",2,4346,-220.186951,-29.248400,-130.187195,20.751413,0.000000,"Delete" \n "Dead" \n "Cars"};
item6[] = {"",7,210,-312.538239,95.295059,-304.538239,103.295059,0.000000,""};
item7[] = {"",7,210,-311.750000,-203.033707,-303.750000,-195.033707,0.000000,""};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,4};
link3[] = {3,6};
link4[] = {4,5};
link5[] = {5,3};
link6[] = {6,7};
link7[] = {7,2};
globals[] = {0.000000,0,0,0,0,640,480,1,46,6316128,1,-629.444153,611.207214,293.309357,-434.050568,1243,885,1};
window[] = {2,-1,-1,-1,-1,985,225,1868,225,3,1261};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "Server-Side Cleanup";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"private[""_impound"",""_cars"",""_objs"",""_totCars"",""_thread""];" \n
"_impound = time;" \n
"_cars = time;" \n
"_objs = time;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Share__Work_load";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Share__Work_load">*/
class Share__Work_load
{
name = "Share__Work_load";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Time_Check">*/
class Time_Check
{
priority = 0.000000;
to="Delete_Dead_Cars";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((time - _cars) > (3 * 60))"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Delete_Dead_Cars">*/
class Delete_Dead_Cars
{
name = "Delete_Dead_Cars";
init = /*%FSM<STATEINIT""">*/"{" \n
" if(!alive _x) then {" \n
"_dbInfo = _x getVariable[""dbInfo"",[]];" \n
"if(count _dbInfo > 0) then {" \n
"_uid = _dbInfo select 0;" \n
"_plate = _dbInfo select 1;" \n
"_insureSystem = _dbInfo select 2;" \n
" diag_log "" destroy vehicule !"";" \n
"diag_log format[""insureSystem = %1 "", _insureSystem];" \n
"if(_insureSystem == 1) then " \n
"{" \ N
" diag_log "" Insured !"";" \n
" diag_log format[""insureSystem = %1 "", _insureSystem];" \n
" _query_0 = format[""UPDATE vehicles SET alive='1', insure='0', active='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
" _query_0 spawn " \n
"{" \ N
" _thread_0 = [_this,1] call HC_fnc_asyncCall;" \n
"};" \ N
"}" \ N
" else " \n
"{" \ N
" diag_log "" Not Insured !"";" \n
" diag_log format[""insureSystem = %1 "", _insureSystem];" \n
" _query = format[""UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
" _query spawn " \n
"{" \ N
" _thread = [_this,1] call HC_fnc_asyncCall;" \n
"};" \ N
"};" \ N
"};" \ N
"if(!isNil ""_x"" && {!isNull _x}) then {" \n
"deleteVehicle _x;" \n
"};" \ N
"};" \ N
"} foreach allMissionObjects ""LandVehicle"";" \n
"" \ N
"{" \ N
" if(!alive _x) then {" \n
"_dbInfo = _x getVariable[""dbInfo"",[]];" \n
"if(count _dbInfo > 0) then {" \n
"_uid = _dbInfo select 0;" \n
"_plate = _dbInfo select 1;" \n
"_insureSystem = _dbInfo select 2;" \n
" diag_log "" destroy vehicule !"";" \n
"diag_log format[""insureSystem = %1 "", _insureSystem];" \n
"if(_insureSystem == 1) then " \n
"{" \ N
" diag_log "" Insured !"";" \n
" diag_log format[""insureSystem = %1 "", _insureSystem];" \n
" _query_0 = format[""UPDATE vehicles SET alive='1', insure='0', active='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
" _query_0 spawn " \n
"{" \ N
" _thread_0 = [_this,1] call HC_fnc_asyncCall;" \n
"};" \ N
"}" \ N
" else " \n
"{" \ N
" diag_log "" Not Insured !"";" \n
" diag_log format[""insureSystem = %1 "", _insureSystem];" \n
" _query = format[""UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
" _query spawn " \n
"{" \ N
" _thread = [_this,1] call HC_fnc_asyncCall;" \n
"};" \ N
"};" \ N
"};" \ N
"if(!isNil ""_x"" && {!isNull _x}) then {" \n
"deleteVehicle _x;" \n
"};" \ N
"};" \ N
"} foreach allMissionObjects ""Air"";" \n
"" \ N
"_cars = time;" \n
"" \ N
"//Group cleanup." \n
"{" \ N
" if(count units _x == 0 && local _x) then {" \n
"deleteGroup _x;" \n
"};" \ N
"} foreach allGroups;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="Share__Work_load";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =
{
};
};
/*%FSM</COMPILE>*/

In functions>systems>fn_getVehicles.sqf:

Replace this:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, inventory, gear, fuel, damage, blacklist FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];

With this:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, insure FROM vehicles WHERE pid='%1' AND alive='1' AND active='0' AND side='%2' AND type='%3'",_pid,_side,_type];

Run this query in your SQL Database:

ALTER TABLE vehicles ADD insure INT(1) NOT NULL DEFAULT '0';

 

Done!

  • Like 8
  • Thanks 2
Link to comment
Share on other sites

Edit your post :

You post this part twice :

Replace this:

[1,_spawntext] remoteExecCall ["life_fnc_broadcast",_unit];
serv_sv_use deleteAt _servIndex;

With this:

if ((_vInfo select 14) isEqualTo 1) then {
[ 1 , "Your vehicle is available and it is assured!" ] RemoteExecCall [ "life_fnc_broadcast" , _unit];
}else{
[ 1 , "Your vehicle is available but is not insured!" ] RemoteExecCall [ "life_fnc_broadcast" , _unit];
};
serv_sv_use deleteAt _servIndex;

-----------------

And instead of : 

ALTER TABLE vehicles ADD insure INT(1) NOT NULL DEFAULT 0';

You should use

ALTER TABLE vehicles ADD insure INT(1) NOT NULL DEFAULT '0';

--------------------

And your 

State Insurance: 10% <br/>

should be

State Insurance: %10 <br/>

 

Edited by KR3
Link to comment
Share on other sites

Getting this error: 

13:27:51 File life_server\init.sqf, line 84
13:27:52 Strange convex component322 in a3\structures_f\research\dome_big_f.p3d:geometryFire
13:27:52 Strange convex component327 in a3\structures_f\research\dome_big_f.p3d:geometryFire
13:27:52 Warning Message: File life_server\FSM\cleanup.fsm, line 64: Config: Unsupported escape sequence \  after {
 if(!alive _x) then {
_dbInfo = _x getVariable["dbInfo",[]];
if(count _dbInfo > 0) then {
_uid = _dbInfo select 0;
_plate = _dbInfo select 1;
_insureSystem = _dbInfo select 2;
 diag_log " destroy vehicule !";
diag_log format["insureSystem = %1 ", _insureSystem];
if(_insureSystem == 1) then 
{
13:27:52 File life_server\FSM\cleanup.fsm, line 64: '/FSM/States/Delete_Dead_Cars.init': Missing ';' at the end of line
13:27:52 Error context diag_log "" Insured !"";" \n
13:27:52 Warning Message: File life_server\FSM\cleanup.fsm, line 65: '/FSM/States/Delete_Dead_Cars.N': '"' encountered instead of '='
13:27:52 Warning Message: Config : some input after EndOfFile.
13:27:52 Class  destroyed with lock count 1

 

Link to comment
Share on other sites

getting error:

http://images.akamai.steamusercontent.com/ugc/266105270677483710/6CBFC5C0774C188C12EBBD4CFF942CD24382FFE3/

18:31:21 Warning Message: File life_server\FSM\cleanup.fsm, line 64: Config: Unsupported escape sequence \  after {
 if(!alive _x) then {
_dbInfo = _x getVariable["dbInfo",[]];
if(count _dbInfo > 0) then {
_uid = _dbInfo select 0;
_plate = _dbInfo select 1;
_insureSystem = _dbInfo select 2;
 diag_log " destroy vehicule !";
diag_log format["insureSystem = %1 ", _insureSystem];
if(_insureSystem == 1) then 
{
18:31:21 File life_server\FSM\cleanup.fsm, line 64: '/FSM/States/Delete_Dead_Cars.init': Missing ';' at the end of line
18:31:21 Error context diag_log "" Insured !"";" \n
18:31:21 Warning Message: File life_server\FSM\cleanup.fsm, line 65: '/FSM/States/Delete_Dead_Cars.N': '"' encountered instead of '='
18:31:21 Warning Message: Config : some input after EndOfFile.

 

Link to comment
Share on other sites

Managed to fix the .FSM error,

 

/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Server-Side Cleanup">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-62.908096,-391.651611,27.091887,-341.651672,0.000000,"init"};
item1[] = {"true",8,218,-62.976639,-315.185364,27.023363,-265.185364,0.000000,"true"};
item2[] = {"Share__Work_load",2,250,-64.183350,-224.681931,25.816656,-174.681931,0.000000,"Share " \n "Work-load"};
item3[] = {"Continue__",4,218,-220.591476,74.216980,-130.591476,124.216980,0.000000,"" \n "" \n "Continue" \n "" \n ""};
item4[] = {"Time_Check",4,218,-219.425827,-133.310532,-129.425964,-83.310455,0.000000,"Time Check"};
item5[] = {"Delete_Dead_Cars",2,4346,-220.186951,-29.248400,-130.187195,20.751413,0.000000,"Delete" \n "Dead" \n "Cars"};
item6[] = {"",7,210,-312.538239,95.295059,-304.538239,103.295059,0.000000,""};
item7[] = {"",7,210,-312.798218,-204.081940,-304.798218,-196.081940,0.000000,""};
item8[] = {"End_Cleanup_",1,250,-64.828239,87.581070,25.171984,137.581238,0.000000,"" \n "End Cleanup" \n ""};
item9[] = {"Check_for_HC_",4,218,-65.059021,-30.047342,24.941008,19.952658,0.000000,"" \n "Check for HC" \n ""};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,4};
link3[] = {3,6};
link4[] = {4,5};
link5[] = {5,3};
link6[] = {5,9};
link7[] = {6,7};
link8[] = {7,2};
link9[] = {9,8};
globals[] = {0.000000,0,0,0,0,640,480,1,53,6316128,1,-481.887177,425.726196,554.522583,-436.926575,170,901,1};
window[] = {0,-1,-1,-32000,-32000,1065,104,1468,104,1,188};
*//*%FSM</HEAD>*/
class FSM
{
  fsmName = "Server-Side Cleanup";
  class States
  {
    /*%FSM<STATE "init">*/
    class init
    {
      name = "init";
      init = /*%FSM<STATEINIT""">*/"private [""_impound"",""_cars"",""_objs"",""_totCars"",""_thread""];" \n
       "_impound = time;" \n
       "_cars = time;" \n
       "_objs = time;" \n
       "cleanupFSM setFSMVariable [""stopfsm"",false];"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "true">*/
        class true
        {
          priority = 0.000000;
          to="Share__Work_load";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "Share__Work_load">*/
    class Share__Work_load
    {
      name = "Share__Work_load";
      init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "Time_Check">*/
        class Time_Check
        {
          priority = 0.000000;
          to="Delete_Dead_Cars";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"((time - _cars) > (3 * 60))"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "Delete_Dead_Cars">*/
    class Delete_Dead_Cars
    {
      name = "Delete_Dead_Cars";
      init = /*%FSM<STATEINIT""">*/"{" \n
       "	if (!alive _x) then {" \n
       "		_dbInfo = _x getVariable [""dbInfo"",[]];" \n
       "		if (count _dbInfo > 0) then {" \n
       "			_uid = _dbInfo select 0;" \n
       "			_plate = _dbInfo select 1;" \n
       "			_insureSystem = _dbInfo select 2;" \n
       "			 diag_log "" destroy vehicle !"";" \n
       "			diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "			if(_insureSystem == 1) then " \n
       "			{ diag_log "" Insured !"";" \n
       "			 diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "" \n
       "			_query_0 = format [""UPDATE vehicles SET alive='1', insure='0', active='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate];" \n
       "			_query_0 spawn {" \n
       "				" \n
       "				_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "			};" \n
       "		} else {" \n
       "			 diag_log "" Not insured !"";" \n
       " 				diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "				 _query = format[""UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
       "			 _query spawn {" \n
       "			_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "			};" \n
       "		};" \n
       "		if (!isNil ""_x"" && {!isNull _x}) then {" \n
       "			deleteVehicle _x;" \n
       "		};" \n
       "	};" \n
       "};" \n
       "} forEach allMissionObjects ""LandVehicle"";" \n
       "" \n
       "{" \n
       "	if (!alive _x) then {" \n
       "		_dbInfo = _x getVariable [""dbInfo"",[]];" \n
       "		if (count _dbInfo > 0) then {" \n
       "			_uid = _dbInfo select 0;" \n
       "			_plate = _dbInfo select 1;" \n
       "			_insureSystem = _dbInfo select 2;" \n
       "			 diag_log "" destroy vehicle !"";" \n
       "			 diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "			 if(_insureSystem == 1) then" \n
       "			{ diag_log "" Insured !"";" \n
       "			 diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "			_query_0 = format [""UPDATE vehicles SET alive='1', insure='0', active='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate];" \n
       "			_query_0 spawn {" \n
       "				" \n
       "				_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "            };} else { " \n
       "				diag_log "" Not Insured !"";" \n
       "			      diag_log format[""insureSystem = %1 "", _insureSystem];" \n
       "				_query = format[""UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'"",_uid,_plate]; " \n
       "				_query spawn {" \n
       "			_thread = [_this,1] call DB_fnc_asyncCall;" \n
       "			};" \n
       "		};" \n
       "	};" \n
       "		if (!isNil ""_x"" && {!isNull _x}) then {" \n
       "			deleteVehicle _x;" \n
       "		};" \n
       "	};" \n
       "} forEach allMissionObjects ""Air"";" \n
       "_cars = time;" \n
       "" \n
       "//Group cleanup." \n
       "{" \n
       "	if (units _x isEqualTo [] && local _x) then {" \n
       "		deleteGroup _x;" \n
       "	};" \n
       "} forEach allGroups;"/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
        /*%FSM<LINK "Check_for_HC_">*/
        class Check_for_HC_
        {
          priority = 0.000000;
          to="End_Cleanup_";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"cleanupFSM getFSMVariable ""stopfsm"""/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
        /*%FSM<LINK "Continue__">*/
        class Continue__
        {
          priority = 0.000000;
          to="Share__Work_load";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"!(cleanupFSM getFSMVariable ""stopfsm"")"/*%FSM</CONDITION""">*/;
          action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
        };
        /*%FSM</LINK>*/
      };
    };
    /*%FSM</STATE>*/
    /*%FSM<STATE "End_Cleanup_">*/
    class End_Cleanup_
    {
      name = "End_Cleanup_";
      init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
      precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
      class Links
      {
      };
    };
    /*%FSM</STATE>*/
  };
  initState="init";
  finalStates[] =
  {
    "End_Cleanup_",
  };
};
/*%FSM</COMPILE>*/

 

  • Like 4
Link to comment
Share on other sites

On 22/11/2016 at 1:49 AM, Repentz said:

Managed to fix the .FSM error,

 

/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Server-Side Cleanup">*/

/*%FSM</COMPILE>*/

Thanks, much appreciated !

 

Edited by KR3
Link to comment
Share on other sites

I did all but i've some questions.
On Garage, i can see at vehicle's description that it don't have Insurance.
Help me, please. I'm using AltisLife v4.4 R4. 

1)

On 20/11/2016 at 3:55 AM, FazeCHEF said:

Open "function.hpp" in your "dialog" folder and add:

 class Dialog_Controls
 {
 file = "dialog\function";
 [...]
 class insureCar {};
 [...]
 };

I don't have function.hpp in my dialog folder.
This file is in Altis_Life.Altis root folder and the name is FunctionS.hpp

So i've added it here:

class Dialog_Controls {
        file = "dialog\function";
        class bankDeposit {};
        class bankTransfer {};
        class bankWithdraw {};
        class displayHandler {};
        class gangDeposit {};
        class gangWithdraw {};
        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 vehicleGarage {};
        class wireTransfer {};
        class insureCar {}; // here!!!
    };

 

2)

On 20/11/2016 at 3:55 AM, FazeCHEF said:

Replace this:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, inventory, gear, fuel, damage, blacklist FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];

With this:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, insure FROM vehicles WHERE pid='%1' AND alive='1' AND active='0' AND side='%2' AND type='%3'",_pid,_side,_type];

My _query is different from yours.

It is:

_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color FROM vehicles WHERE pid='%1' AND alive='1' AND active='0' AND side='%2' AND type='%3'",_pid,_side,_type];

Anyway, i've replaced it with that u told on this guide.

But the problem is:

I went to a Car Shop npc, and can't find the option to buy with Insurance.
I went to the Garage, in car lists i can see that it don't have insurance, the insurance price, but again: no option to buy the insurance.

Where I can buy the insurance for my vehicles?
Is something that i need to do to place the option on the npcs, or something else?

Thank you very much!
 

Edited by joew
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
Hello
I made this tutorial now 3 times. Unfortunately without success, the server crashes immediately at the start.
Error message is:
No. more slot to add connection at 015030 (1523.6,3012.8)
Error message: Include file mpmissions\__cur_mp. Tanoa\dialog\function\...\script_macros.hpp not found.

 

Unfortunately I cannot begin anything, maybe someone can help me.

AltisLife Version 4.4r4 (5.0.0)

LG
Rosa Schlüpfer

arma3server_2016-12-24_19-10-15.rpt

Link to comment
Share on other sites

3 hours ago, Rosa Schlüpfer said:
Hello
I made this tutorial now 3 times. Unfortunately without success, the server crashes immediately at the start.
Error message is:
No. more slot to add connection at 015030 (1523.6,3012.8)
Error message: Include file mpmissions\__cur_mp. Tanoa\dialog\function\...\script_macros.hpp not found.

 

Unfortunately I cannot begin anything, maybe someone can help me.

AltisLife Version 4.4r4 (5.0.0)

LG
Rosa Schlüpfer

arma3server_2016-12-24_19-10-15.rpt

The

anoa\dialog\function\...\script_macros.hpp not found

means that one of your files is calling for something along the lines of

#include "..\..\script_macros.hpp"

the number of ..\ should be the same as how many files from the root directory the script is in, so for instance: ..\ is in the region of one file in, ..\..\ is two files in, etc.

Link to comment
Share on other sites

Hi,
I am new and iam trying implent the vehicle inssurance on my server but i get the following error :

2016/12/25, 14:58:08 Warning Message: File life_server\FSM\cleanup.fsm, line 64: Config: Unsupported escape sequence \  after {
 if(!alive _x) then {
_dbInfo = _x getVariable["dbInfo",[]];
if(count _dbInfo > 0) then {
_uid = _dbInfo select 0;
_plate = _dbInfo select 1;
_insureSystem = _dbInfo select 2;
 diag_log " destroy vehicule !";
diag_log format["insureSystem = %1 ", _insureSystem];
if(_insureSystem == 1) then 
{
2016/12/25, 14:58:08 File life_server\FSM\cleanup.fsm, line 64: '/FSM/States/Delete_Dead_Cars.init': Missing ';' at the end of line
2016/12/25, 14:58:08 Error context diag_log "" Insured !"";" \n
2016/12/25, 14:58:08 Warning Message: File life_server\FSM\cleanup.fsm, line 65: '/FSM/States/Delete_Dead_Cars.N': '"' encountered instead of '='
2016/12/25, 14:58:08 Warning Message: Config : some input after EndOfFile.
2016/12/25, 14:58:08 Class  destroyed with lock count 1

 
I applied the tutorial scrupulously and try again 5 times. Will there be anyone can help me correct that.

Solved with FSM of other tutorial
 
Now i want vehicles insured when a player buy vehicles and now want store vehicle for insure
Thanx for help

 

 

Edited by Dim2ké
Solved
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Is anyone helping with this script anymore? I added the script to my server and followed the tutorial to the T. In my garage, clicking on a vehicle shows not insured, but the button to insure is not shown anywhere. The only way to insure a vehicle is from the garage or by buying it with insurance, which that option does not show up either. Please help. Thanks.

Here are my files:

impound.hpp: http://pastebin.com/TJXT8c0B 

fn_insureCar.sqf: http://pastebin.com/z7C8BDfz

getVehicles: http://pastebin.com/QfSPRuz7

insureCar from systems folder in life_server: http://pastebin.com/HXVKiJmc

spawnVehicle: http://pastebin.com/q7103Dqy

cleanup.fsm: http://pastebin.com/8sdw4JDG

config.cpp from life_server: http://pastebin.com/pX9FwdQK

Config_Master:http://pastebin.com/TR0UwG8c

garageLBChange.sqf: https://paste.ofcode.org/B3N4hX9HgCt77cnfBPL5Pe

CfgRemoteExec: https://paste.ofcode.org/Fj57r5RmL3wpgQQ7hY3Aa8

impoundMenu: https://paste.ofcode.org/BBEHahfU5TxL23hXLRRAcD

stringtable:https://paste.ofcode.org/ZpeBTSNDzD6gDcEbiWpcwS

Link to comment
Share on other sites

5 hours ago, Ryan Killinger said:

but the button to insure is not shown anywhere. The only way to insure a vehicle is from the garage

So does the insure button show in the garage or not?:o 

i got this script working just fine on 4.4r4. Maybe you should retry?:)

also remember to include .rpt logs next time! :3

Edited by Rasmus
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.