Français Solved Comment ajouter une barre de progression lors du rangement d'un véhicule

  • Auteur de la discussion Auteur de la discussion Phoenix53
  • Date de début Date de début

Phoenix53

User
30/9/21
137
4
3
800
Bonjour,
Je cherche comment rajouter un délai avec une barre de progression pour le temps de rangement de véhicule.
Merci d'avance
 
Solution
Salut, c'est assez simple, dans ton fn_storeVehicle.sqf dans le dossier /mission/core/actions trouves cette ligne :
[CODE title="fn_storeVehicle"]if (!alive _vehicle) exitWith {hint localize "STR_Garage_SQLError_Destroyed"};[/CODE]

Puis rajoutes en dessous :
Code:
disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
private _ui = uiNamespace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
private _upp = "Rangement de véhicule en cours";
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
private _cP = 0.01;
life_action_inUse = true;
for "_i" from 0 to 1 step 0 do {
    uiSleep 0.26;
    _cP = _cP + 0.01;
    _progress progressSetPosition _cP...
Salut, c'est assez simple, dans ton fn_storeVehicle.sqf dans le dossier /mission/core/actions trouves cette ligne :
[CODE title="fn_storeVehicle"]if (!alive _vehicle) exitWith {hint localize "STR_Garage_SQLError_Destroyed"};[/CODE]

Puis rajoutes en dessous :
Code:
disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
private _ui = uiNamespace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
private _upp = "Rangement de véhicule en cours";
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
private _cP = 0.01;
life_action_inUse = true;
for "_i" from 0 to 1 step 0 do {
    uiSleep 0.26;
    _cP = _cP + 0.01;
    _progress progressSetPosition _cP;
    _pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
    if (_cP >= 1) exitWith {};
    if (_cP >= 1 || !alive player) exitWith {};
    if (life_istazed) exitWith {}; //Tazed
    if (life_isknocked) exitWith {}; //Knocked
    if (life_interrupted) exitWith {};
    if (player getVariable ["restrained",false]) exitWith {};
    if ((player distance _vehicle) > 15) exitWith {};
};
"progressBar" cutText ["","PLAIN"];
if (!alive player || life_istazed || life_isknocked) exitWith {life_action_inUse = false;};
if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;};
if ((player distance _vehicle) > 15) exitWith {hint "Vous êtes trop loin du véhicule !";};
if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};
"progressBar" cutText ["","PLAIN"];
life_action_inUse = false;

Ton fichier devrai ressembler à sa :
[CODE title="fn_storeVehicle"]#include "..\..\script_macros.hpp"
/*
File: fn_storeVehicle.sqf
Author: Bryan "Tonic" Boardwine

Description:
Stores the vehicle in the garage.
*/
private ["_nearVehicles","_vehicle"];
if !(isNull objectParent player) then {
_vehicle = vehicle player;
} else {
_nearVehicles = nearestObjects[getPos (_this select 0),["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
if (count _nearVehicles > 0) then {
{
if (!isNil "_vehicle") exitWith {}; //Kill the loop.
_vehData = _x getVariable ["vehicle_info_owners",[]];
if (count _vehData > 0) then {
_vehOwner = ((_vehData select 0) select 0);
if ((getPlayerUID player) == _vehOwner) exitWith {
_vehicle = _x;
};
};
} forEach _nearVehicles;
};
};

if (isNil "_vehicle") exitWith {hint localize "STR_Garage_NoNPC"};
if (isNull _vehicle) exitWith {};
if (!alive _vehicle) exitWith {hint localize "STR_Garage_SQLError_Destroyed"};

disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
private _ui = uiNamespace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
private _upp = "Rangement de véhicule en cours";
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
private _cP = 0.01;

life_action_inUse = true;

for "_i" from 0 to 1 step 0 do {
uiSleep 0.26;
_cP = _cP + 0.01;

_progress progressSetPosition _cP;
_pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if (_cP >= 1) exitWith {};

if (_cP >= 1 || !alive player) exitWith {};
if (life_istazed) exitWith {}; //Tazed
if (life_isknocked) exitWith {}; //Knocked
if (life_interrupted) exitWith {};
if (player getVariable ["restrained",false]) exitWith {};
if ((player distance _vehicle) > 15) exitWith {};
};

"progressBar" cutText ["","PLAIN"];

if (!alive player || life_istazed || life_isknocked) exitWith {life_action_inUse = false;};
if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;};
if ((player distance _vehicle) > 15) exitWith {hint "Vous êtes trop loin du véhicule !";};
if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};

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

_storetext = localize "STR_Garage_Store_Success";

if (life_HC_isActive) then {
[_vehicle,false,(_this select 1),_storetext] remoteExec ["HC_fnc_vehicleStore",HC_Life];
} else {
[_vehicle,false,(_this select 1),_storetext] remoteExec ["TON_fnc_vehicleStore",RSERV];
};

hint localize "STR_Garage_Store_Server";
life_garage_store = true;[/CODE]

Voila, fais moi un retour dès que tu auras essayé !
 
Solution
Salut, c'est assez simple, dans ton fn_storeVehicle.sqf dans le dossier /mission/core/actions trouves cette ligne :
[CODE title="fn_storeVehicle"]if (!alive _vehicle) exitWith {hint localize "STR_Garage_SQLError_Destroyed"};[/CODE]

Puis rajoutes en dessous :
Code:
disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
private _ui = uiNamespace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
private _upp = "Rangement de véhicule en cours";
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
private _cP = 0.01;
life_action_inUse = true;
for "_i" from 0 to 1 step 0 do {
    uiSleep 0.26;
    _cP = _cP + 0.01;
    _progress progressSetPosition _cP;
    _pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
    if (_cP >= 1) exitWith {};
    if (_cP >= 1 || !alive player) exitWith {};
    if (life_istazed) exitWith {}; //Tazed
    if (life_isknocked) exitWith {}; //Knocked
    if (life_interrupted) exitWith {};
    if (player getVariable ["restrained",false]) exitWith {};
    if ((player distance _vehicle) > 15) exitWith {};
};
"progressBar" cutText ["","PLAIN"];
if (!alive player || life_istazed || life_isknocked) exitWith {life_action_inUse = false;};
if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;};
if ((player distance _vehicle) > 15) exitWith {hint "Vous êtes trop loin du véhicule !";};
if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};
"progressBar" cutText ["","PLAIN"];
life_action_inUse = false;

Ton fichier devrai ressembler à sa :
[CODE title="fn_storeVehicle"]#include "..\..\script_macros.hpp"
/*
File: fn_storeVehicle.sqf
Author: Bryan "Tonic" Boardwine

Description:
Stores the vehicle in the garage.
*/
private ["_nearVehicles","_vehicle"];
if !(isNull objectParent player) then {
_vehicle = vehicle player;
} else {
_nearVehicles = nearestObjects[getPos (_this select 0),["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
if (count _nearVehicles > 0) then {
{
if (!isNil "_vehicle") exitWith {}; //Kill the loop.
_vehData = _x getVariable ["vehicle_info_owners",[]];
if (count _vehData > 0) then {
_vehOwner = ((_vehData select 0) select 0);
if ((getPlayerUID player) == _vehOwner) exitWith {
_vehicle = _x;
};
};
} forEach _nearVehicles;
};
};

if (isNil "_vehicle") exitWith {hint localize "STR_Garage_NoNPC"};
if (isNull _vehicle) exitWith {};
if (!alive _vehicle) exitWith {hint localize "STR_Garage_SQLError_Destroyed"};

disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
private _ui = uiNamespace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
private _upp = "Rangement de véhicule en cours";
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
private _cP = 0.01;

life_action_inUse = true;

for "_i" from 0 to 1 step 0 do {
uiSleep 0.26;
_cP = _cP + 0.01;

_progress progressSetPosition _cP;
_pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if (_cP >= 1) exitWith {};

if (_cP >= 1 || !alive player) exitWith {};
if (life_istazed) exitWith {}; //Tazed
if (life_isknocked) exitWith {}; //Knocked
if (life_interrupted) exitWith {};
if (player getVariable ["restrained",false]) exitWith {};
if ((player distance _vehicle) > 15) exitWith {};
};

"progressBar" cutText ["","PLAIN"];

if (!alive player || life_istazed || life_isknocked) exitWith {life_action_inUse = false;};
if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;};
if ((player distance _vehicle) > 15) exitWith {hint "Vous êtes trop loin du véhicule !";};
if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};

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

_storetext = localize "STR_Garage_Store_Success";

if (life_HC_isActive) then {
[_vehicle,false,(_this select 1),_storetext] remoteExec ["HC_fnc_vehicleStore",HC_Life];
} else {
[_vehicle,false,(_this select 1),_storetext] remoteExec ["TON_fnc_vehicleStore",RSERV];
};

hint localize "STR_Garage_Store_Server";
life_garage_store = true;[/CODE]

Voila, fais moi un retour dès que tu auras essayé !
Nikel cela fonctionne un grand merci ;)