The-Programmer Forum

Maxence a écrit le dernier message :
#10
C'est un peu plus compliqué.

Dans ta mission/core/functions créé un fichier fn_deleteVehicleAction.sqf :
Code:
_vehicle = param [0,objNull,[objNull]];
if (isNull _vehicle) exitWith {};

closeDialog 0;
_dbInfo = _vehicle getVariable ["dbInfo",[]];
_upp = "Suppression du véhicule";

disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
_cP = 0.01;

life_is_processing = true;

for "_i" from 0 to 1 step 0 do {
    uiSleep  0.28;
    _cP = _cP + 0.01;
    _progress progressSetPosition _cP;
    _pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
    if (_cP >= 1) exitWith {};
    if (player distance _vehicle > 10) exitWith {};
};

if (player distance _vehicle > 10) exitWith {hint "Veuillez rester à côté du véhicule !"; "progressBar" cutText ["","PLAIN"]; life_is_processing = false; life_action_inUse = false;};

"progressBar" cutText ["","PLAIN"];
life_is_processing = false;
life_action_inUse = false;

if ((count _dbInfo) > 0) then {
    _dbInfo remoteExec ["life_fnc_copDeleteVehicle",2];
};

deleteVehicle _vehicle;

Dans ton Functions.hpp sous file = "core\functions"; ajoute :
Code:
class deleteVehicleAction {};

Dans ton fn_vInteractionMenu.sqf remplace :
Code:
_Btn2 ctrlSetText "Supprimer le véhicule";
_Btn2 buttonSetAction "_dbInfo = life_vInact_curTarget getVariable [""dbInfo"",[]]; if ((count _dbInfo) > 0) then {_dbInfo remoteExec [""Life_fnc_copDeleteVehicle"",2];}; deleteVehicle life_vInact_curTarget; closeDialog 0;";
par :
Code:
_Btn2 ctrlSetText "Supprimer le véhicule";
_Btn2 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_deleteVehicleAction";