Français Not solved Assurance véhicule

  • Auteur de la discussion Auteur de la discussion Kawax Delta
  • Date de début Date de début
  • Bonjour Visiteur ! Les sujets de cette catégorie sont clos. Si vous souhaitez réouvrir, merci de nous contacter en précisant le lien du post à réouvrir !

    Hello Visiteur ! The topics in this category are closed. If you wish to reopen, please contact us with the link of the post you wish to reopen !
8/10/20
53
3
300
Bonjour,

J'ai suivi le tuto sur TP pour installer les assurances mais j'ai un soucis, quand j’assure mon véhicule dans le garageLBChange sa ne change pas le texte en assurer et côté DB sa ne le note pas en 1 quelqu'un aurai une petite idée du pourquoi ? Merci Tuto Assurance

[CODE title="fn_garageLBChange.sqf"]#include "..\..\script_macros.hpp"
/*
File: fn_garageLBChange.sqf
Author: Bryan "Tonic" Boardwine

Description:
Can't be bothered to answer it.. Already deleted it by accident..
*/
disableSerialization;
private ["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_price","_storageFee","_purchasePrice"];
_control = _this select 0;
_index = _this select 1;

//Fetch some information.
_dataArr = CONTROL_DATAI(_control,_index);
_dataArr = call compile format ["%1",_dataArr];
_className = (_dataArr select 0);
_classNameLife = _className;

if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
_classNameLife = "Default"; //Use Default class if it doesn't exist
diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
};

_vehicleColor = ((M_CONFIG(getArray,"LifeCfgVehicles",_classNameLife,"textures") select (_dataArr select 1)) select 0);
if (isNil "_vehicleColor") then {_vehicleColor = "Default";};

_vehicleInfo = [_className] call life_fnc_fetchVehInfo;
_trunkSpace = [_className] call life_fnc_vehicleWeightCfg;

_price = M_CONFIG(getNumber,"LifeCfgVehicles",_classNameLife,"price");
_storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");

_insuranceMultiplier = 0.2;
_insurance = (_dataArr select 2);
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");
};
};
_retrievePrice = 0;
_sellPrice = _purchasePrice * _sellMultiplier;
_insurancePrice = _purchasePrice * _insuranceMultiplier;

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

_immatriculation = (_dataArr select 4);
if (_immatriculation == "0") then {_immatriculation = "Aucune"};

_damage = (_dataArr select 3);
_repairPrice = "";

if (((count _damage) > 0) && (LIFE_SETTINGS(getNumber,"save_vehicle_damage") isEqualTo 1)) then {
{
if (_x > 0) exitWith {
_repairPrice = format ["Coût de la réparation : %1€<br/>",[(_purchasePrice * 0.02)] call life_fnc_numberText];
};
} forEach _damage;
};


(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/>
Etat de l'assurance: %10 <br/>
Plaque d'immatriculation : %11<br/>
%12
" +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/>
" +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " %3 km/h<br/>
" +(localize "STR_Shop_Veh_UI_HPower")+ " %4<br/>
" +(localize "STR_Shop_Veh_UI_PSeats")+ " %5<br/>
" +(localize "STR_Shop_Veh_UI_Trunk")+ " %6<br/>
" +(localize "STR_Shop_Veh_UI_Fuel")+ " %7
",
[_retrievePrice] call life_fnc_numberText,
[_sellPrice] call life_fnc_numberText,
(_vehicleInfo select 8),
(_vehicleInfo select 11),
(_vehicleInfo select 10),
if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
(_vehicleInfo select 12),
_vehicleColor,
[_insurancePrice] call life_fnc_numberText,
if (_insurance isEqualTo 1) then {"<t color='#8cff9b'>Assurer</t>"} else {"<t color='#FF0000'>Pas d'assurance</t>"},
_immatriculation,
_repairPrice
];

ctrlShow [2803,true];
ctrlShow [2830,true];

if (_insurance isEqualTo 1) then {
ctrlShow [2804,false];
} else {
ctrlShow [2804,true];
};

if (_repairPrice isEqualTo "") then {
ctrlShow [4672,false];
} else {
ctrlShow [4672,true];

if (([] call life_fnc_countOnlineDep) isEqualTo 0) then {
ctrlEnable [4672,true];
} else {
ctrlEnable [4672,false]
};
};[/CODE]

[CODE title="fn_impoundMenu.sqf"]#include "..\..\script_macros.hpp"
/*
File: fn_impoundMenu.sqf
Author: Bryan "Tonic" Boardwine

Description:
Not actually a Impound Menu, may act as confusion to some but that is what I wanted.
The purpose of this menu is it is now called a 'Garage' where vehicles are stored (persistent ones).
*/
private ["_vehicles","_control"];
disableSerialization;
_vehicles = param [0,[],[[]]];

ctrlShow[2803,false];
ctrlShow[2830,false];
waitUntil {!isNull (findDisplay 2800)};

if (count _vehicles isEqualTo 0) exitWith {
ctrlSetText[2811,localize "STR_Garage_NoVehicles"];
};

_control = CONTROL(2800,2802);
lbClear _control;

{
_vehicleInfo = [(_x select 2)] call life_fnc_fetchVehInfo;
_control lbAdd (_vehicleInfo select 3);
_tmp = [(_x select 2),(_x select 8),(_x select 9),(_x select 10),(_x select 11)];
_tmp = str(_tmp);
_control lbSetData [(lbSize _control)-1,_tmp];
_control lbSetPicture [(lbSize _control)-1,(_vehicleInfo select 2)];
_control lbSetValue [(lbSize _control)-1,(_x select 0)];
} forEach _vehicles;

ctrlShow[2810,false];
ctrlShow[2811,false];
ctrlShow[4672,false];[/CODE]

[CODE title="fn_getVehicles.sqf"]#include "\life_server\script_macros.hpp"
/*
File: fn_getVehicles.sqf
Author: Bryan "Tonic" Boardwine

Description:
Sends a request to query the database information and returns vehicles.
*/
private ["_pid","_side","_type","_unit","_ret","_tickTime","_queryResult"];
_pid = [_this,0,"",[""]] call BIS_fnc_param;
_side = [_this,1,sideUnknown,[west]] call BIS_fnc_param;
_type = [_this,2,"",[""]] call BIS_fnc_param;
_unit = [_this,3,objNull,[objNull]] call BIS_fnc_param;

//Error checks
if (_pid isEqualTo "" || _side isEqualTo sideUnknown || _type isEqualTo "" || isNull _unit) exitWith {
if (!isNull _unit) then {
[[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
};
};

_unit = owner _unit;
_side = switch (_side) do {
case west:{"cop"};
case civilian: {"civ"};
case independent: {"med"};
default {"Error"};
};

if (_side == "Error") exitWith {
[[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
};

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


_tickTime = diag_tickTime;
_queryResult = [_query,2,true] call DB_fnc_asyncCall;

{
_damage = [call compile (_x select 10)] call DB_fnc_mresToArray;
_x set [10,_damage];
} forEach _queryResult;

if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
diag_log "------------- Client Query Request -------------";
diag_log format ["QUERY: %1",_query];
diag_log format ["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
diag_log format ["Result: %1",_queryResult];
diag_log "------------------------------------------------";
};

if (_queryResult isEqualType "") exitWith {
[[]] remoteExec ["life_fnc_impoundMenu",(owner _unit)];
};

[_queryResult] remoteExec ["life_fnc_impoundMenu",_unit];[/CODE]


[CODE title="fn_spawnVehicle.sqf"]#include "\life_server\script_macros.hpp"
/*
File: fn_spawnVehicle.sqf
Author: Bryan "Tonic" Boardwine

Description:
Sends the query request to the database, if an array is returned then it creates
the vehicle if it's not in use or dead.
*/
params [
["_vid", -1, [0]],
["_pid", "", [""]],
["_sp", [], [[],""]],
["_unit", objNull, [objNull]],
["_price", 0, [0]],
["_dir", 0, [0]],
"_spawntext"
];

private _unit_return = _unit;
private _name = name _unit;
private _side = side _unit;
_unit = owner _unit;

if (_vid isEqualTo -1 || {_pid isEqualTo ""}) exitWith {};
if (_vid in serv_sv_use) exitWith {};
serv_sv_use pushBack _vid;

private _servIndex = serv_sv_use find _vid;

private _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];

private _tickTime = diag_tickTime;
private _queryResult = [_query,2] call DB_fnc_asyncCall;

if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
diag_log "------------- Client Query Request -------------";
diag_log format ["QUERY: %1",_query];
diag_log format ["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
diag_log format ["Result: %1",_queryResult];
diag_log "------------------------------------------------";
};

if (_queryResult isEqualType "") exitWith {};

private _vInfo = _queryResult;
if (isNil "_vInfo") exitWith {serv_sv_use deleteAt _servIndex;};
if (count _vInfo isEqualTo 0) exitWith {serv_sv_use deleteAt _servIndex;};

if ((_vInfo select 5) isEqualTo 0) exitWith {
serv_sv_use deleteAt _servIndex;
[1,"STR_Garage_SQLError_Destroyed",true,[_vInfo select 2]] remoteExecCall ["life_fnc_broadcast",_unit];
};

if ((_vInfo select 6) isEqualTo 1) exitWith {
serv_sv_use deleteAt _servIndex;
[1,"STR_Garage_SQLError_Active",true,[_vInfo select 2]] remoteExecCall ["life_fnc_broadcast",_unit];
};

private "_nearVehicles";
if !(_sp isEqualType "") then {
_nearVehicles = nearestObjects[_sp,["Car","Air","Ship"],10];
} else {
_nearVehicles = [];
};

if (count _nearVehicles > 0) exitWith {
serv_sv_use deleteAt _servIndex;
[_price,_unit_return] remoteExecCall ["life_fnc_garageRefund",_unit];
[1,"STR_Garage_SpawnPointError",true] remoteExecCall ["life_fnc_broadcast",_unit];
};

_query = format ["UPDATE vehicles SET active='1', damage='""[]""' WHERE pid='%1' AND id='%2'",_pid,_vid];

private _trunk = [(_vInfo select 9)] call DB_fnc_mresToArray;
private _gear = [(_vInfo select 10)] call DB_fnc_mresToArray;
private _damage = [call compile (_vInfo select 12)] call DB_fnc_mresToArray;
private _wasIllegal = _vInfo select 13;
_wasIllegal = if (_wasIllegal isEqualTo 1) then { true } else { false };

[_query,1] call DB_fnc_asyncCall;

private "_vehicle";
if (_sp isEqualType "") then {
_vehicle = createVehicle[(_vInfo select 2),[0,0,999],[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _sp,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
uiSleep 0.6;
} else {
_vehicle = createVehicle [(_vInfo select 2),_sp,[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_vehicle setPos _sp;
_vehicle setVectorUp (surfaceNormal _sp);
_vehicle setDir _dir;
};
_vehicle allowDamage true;
//Send keys over the network.
[_vehicle] remoteExecCall ["life_fnc_addVehicle2Chain",_unit];
[_pid,_side,_vehicle,1] call TON_fnc_keyManagement;
_vehicle lock 2;
//Reskin the vehicle
[_vehicle,(_vInfo select 8)] remoteExecCall ["life_fnc_colorVehicle",_unit];
_vehicle setVariable ["vehicle_info_owners",[[_pid,_name]],true];
_vehicle setVariable ["dbInfo",[(_vInfo select 4),(_vInfo select 7)],true];
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
[_vehicle] call life_fnc_clearVehicleAmmo;

if (LIFE_SETTINGS(getNumber,"save_vehicle_virtualItems") isEqualTo 1) then {

_vehicle setVariable ["Trunk",_trunk,true];

if (_wasIllegal) then {
private _refPoint = if (_sp isEqualType "") then {getMarkerPos _sp;} else {_sp;};

private _distance = 100000;
private "_location";

{
private _tempLocation = nearestLocation [_refPoint, _x];
private _tempDistance = _refPoint distance _tempLocation;

if (_tempDistance < _distance) then {
_location = _tempLocation;
_distance = _tempDistance;
};
false

} count ["NameCityCapital", "NameCity", "NameVillage"];

_location = text _location;
[1,"STR_NOTF_BlackListedVehicle",true,[_location,_name]] remoteExecCall ["life_fnc_broadcast",west];

_query = format ["UPDATE vehicles SET blacklist='0' WHERE id='%1' AND pid='%2'",_vid,_pid];
[_query,1] call DB_fnc_asyncCall;
};
} else {
_vehicle setVariable ["Trunk",[[],0],true];
};

if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {
_vehicle setFuel (_vInfo select 11);
}else{
_vehicle setFuel 1;
};

if (count _gear > 0 && (LIFE_SETTINGS(getNumber,"save_vehicle_inventory") isEqualTo 1)) then {
_items = _gear select 0;
_mags = _gear select 1;
_weapons = _gear select 2;
_backpacks = _gear select 3;

for "_i" from 0 to ((count (_items select 0)) - 1) do {
_vehicle addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)];
};
for "_i" from 0 to ((count (_mags select 0)) - 1) do {
_vehicle addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)];
};
for "_i" from 0 to ((count (_weapons select 0)) - 1) do {
_vehicle addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)];
};
for "_i" from 0 to ((count (_backpacks select 0)) - 1) do {
_vehicle addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)];
};
};

if (count _damage > 0 && (LIFE_SETTINGS(getNumber,"save_vehicle_damage") isEqualTo 1)) then {
_parts = getAllHitPointsDamage _vehicle;

for "_i" from 0 to ((count _damage) - 1) do {
_vehicle setHitPointDamage [format ["%1",((_parts select 0) select _i)],_damage select _i];
};
};

//Sets of animations
if ((_vInfo select 1) isEqualTo "civ" && (_vInfo select 2) isEqualTo "B_Heli_Light_01_F" && !((_vInfo select 8) isEqualTo 13)) then {
[_vehicle,"civ_littlebird",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};

if ((_vInfo select 1) isEqualTo "cop" && ((_vInfo select 2)) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"]) then {
[_vehicle,"cop_offroad",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};

if ((_vInfo select 1) isEqualTo "med" && (_vInfo select 2) isEqualTo "C_Offroad_01_F") then {
[_vehicle,"med_offroad",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};

[_vid,_pid,_vehicle] remoteExec ["max_immat_fnc_initVehicleImmatriculation",2];

[_vid,_pid,_vehicle,_unit] spawn TON_fnc_getInsureCar;
serv_sv_use deleteAt _servIndex;

_vehicle setvehicleammo 0;

_vehicle addEventHandler ["HandleDamage",{(_this#7 in ["hitlfwheel","hitlbwheel","hitlmwheel","hitlf2wheel","hitrfwheel","hitrbwheel","hitrmwheel","hitrf2wheel"])}];

[_vehicle] remoteExec ["max_keytransfer_fnc_fetchGivenKeys",2];[/CODE]
 

Fichiers joints

Dernière édition: