Français Remise en stock véhicule après l'avoir vendu

  • Auteur de la discussion Auteur de la discussion TartiFlette
  • Date de début Date de début
18/9/21
168
5
8
800
Bonjour,

Je tente de mettre en place une modification

J'ai mis le script stock et craft sur mon serveur

J'ai mis un véhicule à 0, le craft et le vend dans le garage

Le stock reste à 0, c'est normal ?
 
Dans le même principe

Est il possible de "stocker" le véhicule dans un shop et que lorsqu'il est vendu l'argent parte sur le compte d'une entreprise ?
 
Upvote 0
Je parlais de Company System, mais je suppose que oui du coup 😅

Dans ton fn_sellGarage.sqf, tu peux ajouter à la fin :
Code:
_classname_vehicle = "B_Quadbike_01_F"; // A MODIFIER
_id_entreprise = 1; // A MODIFIER

if (_vehicleLife == _classname_vehicle) then {
    _company = objNull;

    {
        if ((_x select 0) isEqualTo _id_entreprise) exitWith {_company = _x select 1;};
    } foreach maxence_all_entreprises;

    if !(isNull _company) then {
        _oldEntACC = _company getVariable ["entreprise_bankacc",0];
        _oldEntACC = _oldEntACC + _sellPrice;
        _company setVariable ["entreprise_bankacc",_oldEntACC,true];

        [(_company getVariable ["entreprise_id",0]),5,(_company getVariable ["entreprise_bankacc",0])] remoteExecCall ["max_entreprise_fnc_updateEntreprise",2];
        [_company,format ["%1 (Vente véhicule)",(name player)],_sellPrice,2] remoteExecCall ["max_entreprise_fnc_insertEntrepriseLogs",2];
    };
};
 
Upvote 0
Merci,

Effectivement, je lis de travers =)

Pour chaque véhicules je fait cela ?

_classname_vehicle = "VehiculeA"; // A MODIFIER
_id_entreprise = 1; // A MODIFIER
if (_vehicleLife == _classname_vehicle) then {<br> _company = objNull;<br><br> {<br> if ((_x select 0) isEqualTo _id_entreprise) exitWith {_company = _x select 1;};<br> } foreach maxence_all_entreprises;<br><br> if !(isNull _company) then {<br> _oldEntACC = _company getVariable ["entreprise_bankacc",0];<br> _oldEntACC = _oldEntACC + _sellPrice;<br> _company setVariable ["entreprise_bankacc",_oldEntACC,true];<br><br> [(_company getVariable ["entreprise_id",0]),5,(_company getVariable ["entreprise_bankacc",0])] remoteExecCall ["max_entreprise_fnc_updateEntreprise",2];<br> [_company,format ["%1 (Vente véhicule)",(name player)],_sellPrice,2] remoteExecCall ["max_entreprise_fnc_insertEntrepriseLogs",2];<br> };<br>};


_classname_vehicle = "VehiculeB"; // A MODIFIER
_id_entreprise = 1; // A MODIFIER
if (_vehicleLife == _classname_vehicle) then {<br> _company = objNull;<br><br> {<br> if ((_x select 0) isEqualTo _id_entreprise) exitWith {_company = _x select 1;};<br> } foreach maxence_all_entreprises;<br><br> if !(isNull _company) then {<br> _oldEntACC = _company getVariable ["entreprise_bankacc",0];<br> _oldEntACC = _oldEntACC + _sellPrice;<br> _company setVariable ["entreprise_bankacc",_oldEntACC,true];<br><br> [(_company getVariable ["entreprise_id",0]),5,(_company getVariable ["entreprise_bankacc",0])] remoteExecCall ["max_entreprise_fnc_updateEntreprise",2];<br> [_company,format ["%1 (Vente véhicule)",(name player)],_sellPrice,2] remoteExecCall ["max_entreprise_fnc_insertEntrepriseLogs",2];<br> };<br>};

ou simplement
_classname_vehicle = "VehiculeA";"VehiculeB;";"VehiculeC;" // A MODIFIER
_id_entreprise = 1; // A MODIFIER
if (_vehicleLife == _classname_vehicle) then {<br> _company = objNull;<br><br> {<br> if ((_x select 0) isEqualTo _id_entreprise) exitWith {_company = _x select 1;};<br> } foreach maxence_all_entreprises;<br><br> if !(isNull _company) then {<br> _oldEntACC = _company getVariable ["entreprise_bankacc",0];<br> _oldEntACC = _oldEntACC + _sellPrice;<br> _company setVariable ["entreprise_bankacc",_oldEntACC,true];<br><br> [(_company getVariable ["entreprise_id",0]),5,(_company getVariable ["entreprise_bankacc",0])] remoteExecCall ["max_entreprise_fnc_updateEntreprise",2];<br> [_company,format ["%1 (Vente véhicule)",(name player)],_sellPrice,2] remoteExecCall ["max_entreprise_fnc_insertEntrepriseLogs",2];<br> };<br>};
 
Upvote 0
J'ai testé cela ne fonctionne pas


Code:
#include "..\..\script_macros.hpp"
/*
    File: fn_sellGarage.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Sells a vehicle from the garage.
*/
private ["_vehicle","_vehicleLife","_vid","_pid","_sellPrice","_multiplier","_price","_purchasePrice"];
disableSerialization;
if ((lbCurSel 2802) isEqualTo -1) exitWith {hint localize "STR_Global_NoSelection"};
_vehicle = lbData[2802,(lbCurSel 2802)];
_vehicle = (call compile format ["%1",_vehicle]) select 0;
_vehicleLife = _vehicle;
_vid = lbValue[2802,(lbCurSel 2802)];
_pid = getPlayerUID player;

if (isNil "_vehicle") exitWith {hint localize "STR_Garage_Selection_Error"};
if ((time - life_action_delay) < 1.5) exitWith {hint localize "STR_NOTF_ActionDelay";};
if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _vehicleLife)) then {
    _vehicleLife = "Default"; //Use Default class if it doesn't exist
    diag_log format ["%1: LifeCfgVehicles class doesn't exist",_vehicle];
};

_price = M_CONFIG(getNumber,"LifeCfgVehicles",_vehicleLife,"price");
switch (playerSide) do {
    case civilian: {
        _multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
        _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
    };
    case west: {
        _multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
        _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
    };
    case independent: {
        _multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
        _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
    };
    case east: {
        _multiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
        _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
    };
};

_sellPrice = _purchasePrice * _multiplier;

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

if (life_HC_isActive) then {
    [_vid,_pid,_sellPrice,player,life_garage_type] remoteExecCall ["HC_fnc_vehicleDelete",HC_Life];
} else {
    [_vid,_pid,_sellPrice,player,life_garage_type] remoteExecCall ["TON_fnc_vehicleDelete",RSERV];
};

hint format [localize "STR_Garage_SoldCar",[_sellPrice] call life_fnc_numberText];
BANK = BANK + _sellPrice;
[1] call SOCK_fnc_updatePartial;

if (LIFE_SETTINGS(getNumber,"player_advancedLog") isEqualTo 1) then {
    if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
        advanced_log = format [localize "STR_DL_AL_soldVehicle_BEF",_vehicleLife,[_sellPrice] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
    } else {
        advanced_log = format [localize "STR_DL_AL_soldVehicle",profileName,(getPlayerUID player),_vehicleLife,[_sellPrice] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
    };
    publicVariableServer "advanced_log";
};

life_action_delay = time;
closeDialog 0;

_rarityItem = ["vehicles",_vehicleLife] call stock_system_fnc_getRarityItem;
 if !(_rarityItem isEqualTo []) then {["vehicles",_vehicleLife,"+"] remoteExec ["stock_system_fnc_updateCopiesLeft"];};

_classname_vehicle = "AlessioRS5"; // A MODIFIER
_id_entreprise = 2; // A MODIFIER

if (_vehicleLife == _classname_vehicle) then {
    _company = objNull;

    {
        if ((_x select 0) isEqualTo _id_entreprise) exitWith {_company = _x select 1;};
    } foreach maxence_all_entreprises;

    if !(isNull _company) then {
        _oldEntACC = _company getVariable ["entreprise_bankacc",0];
        _oldEntACC = _oldEntACC + _sellPrice;
        _company setVariable ["entreprise_bankacc",_oldEntACC,true];

        [(_company getVariable ["entreprise_id",0]),5,(_company getVariable ["entreprise_bankacc",0])] remoteExecCall ["max_entreprise_fnc_updateEntreprise",2];
        [_company,format ["%1 (Vente véhicule)",(name player)],_sellPrice,2] remoteExecCall ["max_entreprise_fnc_insertEntrepriseLogs",2];
    };
};
 

Fichiers joints

Upvote 0