Français Solved Problème avec l'affichage des informations des véhicules dans mon garage

  • Auteur de la discussion Auteur de la discussion Antoine’s
  • Date de début Date de début
--- Ce message a été généré automatiquement par ChatGPT, le contenu peut être incorrect. Veuillez lire le message avec précaution ! ---

Bonjour,
Il semble que le script Advanced Insure ait causé un problème avec l'affichage des informations des véhicules dans votre garage. Pourriez-vous m'envoyer les fichiers concernés pour que je puisse les examiner et vous aider à résoudre ce problème ?

--- Pour continuer la discussion avec ChatGPT, cliquez sur "Répondre" en bas à droite de ce message. Sinon, attendez que quelqu'un vous réponde. ---
 
--- Ce message a été généré automatiquement par ChatGPT, le contenu peut être incorrect. Veuillez lire le message avec précaution ! ---

Bonjour,
Il semble que le script Advanced Insure ait causé un problème avec l'affichage des informations des véhicules dans votre garage. Pourriez-vous m'envoyer les fichiers concernés pour que je puisse les examiner et vous aider à résoudre ce problème ?

--- Pour continuer la discussion avec ChatGPT, cliquez sur "Répondre" en bas à droite de ce message. Sinon, attendez que quelqu'un vous réponde. ---
 

Fichiers joints

--- Ce message a été généré automatiquement par ChatGPT, le contenu peut être incorrect. Veuillez lire le message avec précaution ! ---

Bonjour,
Il semble que le script Advanced Insure ait causé un problème avec l'affichage des informations des véhicules dans votre garage. Pourriez-vous m'envoyer les fichiers concernés pour que je puisse les examiner et vous aider à résoudre ce problème ?

--- Pour continuer la discussion avec ChatGPT, cliquez sur "Répondre" en bas à droite de ce message. Sinon, attendez que quelqu'un vous réponde. ---
[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, insurance, CONCAT('""',expiration_date,'""'), DATEDIFF (expiration_date, CURRENT_TIMESTAMP),immatriculation, controlTech FROM vehicles WHERE pid='%1' AND alive='1' AND entreprise_id='0' 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;

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_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),(call compile (_x select 10)),(_x select 11),(_x select 12),(_x select 13)];
_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];
[/CODE]


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

switch (playerSide) do {
case civilian: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
};
case west: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
};
case independent: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
};
case east: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
};
};
_retrievePrice = _purchasePrice * _storageFee;
_sellPrice = _purchasePrice * _sellMultiplier;

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

_control = findDisplay 2800 displayCtrl 28020;
_myControlPos = ctrlPosition _control;
_oldH = _myControlPos select 3;

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

_control 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/>
" + ([(_dataArr select 2),(_dataArr select 3),(_dataArr select 4)] call advanced_insurance_fnc_insuranceStatus) + "
Plaque d'immatriculation : %12<br/>
Contrôle technique: %13<br/>
Type d’essence : %9<br/>
" +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/>
" +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " %3 km/h<br/>
" +(localize "STR_Shop_Veh_UI_HPower")+ " %4<br/>
" +(localize "STR_Shop_Veh_UI_PSeats")+ " %5<br/>
" +(localize "STR_Shop_Veh_UI_Trunk")+ " %6<br/>
" +(localize "STR_Shop_Veh_UI_Fuel")+ " %7
",
[_retrievePrice] call life_fnc_numberText,
[_sellPrice] call life_fnc_numberText,
(_vehicleInfo select 8),
(_vehicleInfo select 11),
(_vehicleInfo select 10),
if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
(_vehicleInfo select 12),
_vehicleColor,
_immatriculation,
[(_dataArr select 3)] call max_controltech_fnc_inspectionStatus
[_classNameLife] call max_fuelstations_fnc_getFuelType

];

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

_newH = ctrlTextHeight _control;
_control ctrlSetPosition [(_myControlPos select 0),(_myControlPos select 1),(_myControlPos select 2),_newH];
_control ctrlCommit 0;
[/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, insurance, CONCAT('""',expiration_date,'""'), DATEDIFF (expiration_date, CURRENT_TIMESTAMP),immatriculation, controlTech FROM vehicles WHERE pid='%1' AND alive='1' AND entreprise_id='0' 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;

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_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),(call compile (_x select 10)),(_x select 11),(_x select 12),(_x select 13)];
_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];
[/CODE]


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

switch (playerSide) do {
case civilian: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
};
case west: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
};
case independent: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
};
case east: {
_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
_sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
};
};
_retrievePrice = _purchasePrice * _storageFee;
_sellPrice = _purchasePrice * _sellMultiplier;

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

_control = findDisplay 2800 displayCtrl 28020;
_myControlPos = ctrlPosition _control;
_oldH = _myControlPos select 3;

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

_control 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/>
" + ([(_dataArr select 2),(_dataArr select 3),(_dataArr select 4)] call advanced_insurance_fnc_insuranceStatus) + "
Plaque d'immatriculation : %12<br/>
Contrôle technique: %13<br/>
Type d’essence : %9<br/>
" +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/>
" +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " %3 km/h<br/>
" +(localize "STR_Shop_Veh_UI_HPower")+ " %4<br/>
" +(localize "STR_Shop_Veh_UI_PSeats")+ " %5<br/>
" +(localize "STR_Shop_Veh_UI_Trunk")+ " %6<br/>
" +(localize "STR_Shop_Veh_UI_Fuel")+ " %7
",
[_retrievePrice] call life_fnc_numberText,
[_sellPrice] call life_fnc_numberText,
(_vehicleInfo select 8),
(_vehicleInfo select 11),
(_vehicleInfo select 10),
if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
(_vehicleInfo select 12),
_vehicleColor,
_immatriculation,
[(_dataArr select 3)] call max_controltech_fnc_inspectionStatus
[_classNameLife] call max_fuelstations_fnc_getFuelType

];

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

_newH = ctrlTextHeight _control;
_control ctrlSetPosition [(_myControlPos select 0),(_myControlPos select 1),(_myControlPos select 2),_newH];
_control ctrlCommit 0;
[/CODE]
--- Ce message a été généré automatiquement par ChatGPT, le contenu peut être incorrect. Veuillez lire le message avec précaution ! ---

Sorry I couldn't contact the ChatGPT think tank :(

--- Pour continuer la discussion avec ChatGPT, cliquez sur "Répondre" en bas à droite de ce message. Sinon, attendez que quelqu'un vous réponde. ---
 
Il y a une erreur dans le fn_garageLBChange.sqf :
Code:
Error in expression <ll max_controltech_fnc_inspectionStatus
[_classNameLife] call max_fuelstations_f>
  Error position: <[_classNameLife] call max_fuelstations_f>
  Error Missing ]
File mpmissions\__cur_mp.Quiberon\dialog\function\fn_garageLBChange.sqf..., line 89
Mais c'est une erreur que j'ai corrigé dans le fichier au dessus, donc il n'a probablement pas été enregistré sur le serveur.

Vérifie que tu as bien remplacé le fichier, et remis ta mission en pbo si besoin 🤞