le_bubbb a écrit le dernier message :
Merci beaucoup !Effectivement il faut définir la variable _vehicle comme étant le véhicule le plus proche.
Voici un exemple (à mettre avant l'autre code) :
Code:private ["_nearVehicles","_vehicle"]; if !(isNull objectParent player) then { _vehicle = vehicle player; } else { _nearVehicles = nearestObjects[(getPos player),["Car","Air","Ship"],30]; //Fetch vehicles within 30m. if (count _nearVehicles > 0) then { _vehicle = _nearVehicles select 0; }; }; if (isNil "_vehicle") exitWith {hint localize "STR_Garage_NoNPC"}; if (isNull _vehicle) exitWith {}; if (!alive _vehicle) exitWith {hint localize "STR_Garage_SQLError_Destroyed"};