The-Programmer Forum

Lykosia a écrit le dernier message :
#2
Re-Bonjour,
J'ai trouvé la panne, c'était une mauvaise déclaration de paramètres.

Dans fn_spawnVehicle.sqf mettre [_vehicle,"cop_cars_civil",true] remoteExecCall ["life_fnc_vehicleAnimate"]; au lieu de [_vehicle,"cop_cars_civil",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];

--------------------------------------------------------------------------------

Guide rapide des fichiers à éditer:

core/config/fn_vehicleAnimate.sqf
Code:
/*
    File: fn_vehicleAnimate.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Pass what you want to be animated.
*/
private ["_vehicle","_animate","_state"];
_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _vehicle) exitWith {}; //FUCK
_animate = [_this,1,"",["",[]]] call BIS_fnc_param;
_preset = [_this,2,false,[false]] call BIS_fnc_param;

[...]
    switch (_animate) do
    {
        case "cop_cars_civil":
        {
            _vehicle addWeapon "PoliceHorn";
        };
    };
};

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

    Description:
    Does something with vehicle purchasing.
*/

params [["_mode",true,[true]]];

if ((lbCurSel 2302) isEqualTo -1) exitWith {hint localize "STR_Shop_Veh_DidntPick";closeDialog 0;};
if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";};
life_action_delay = time;

private _className = lbData[2302,(lbCurSel 2302)];
private _vIndex = lbValue[2302,(lbCurSel 2302)];
private _vehicleList = M_CONFIG(getArray,"CarShops",(life_veh_shop select 0),"vehicles");
private _shopSide = M_CONFIG(getText,"CarShops",(life_veh_shop select 0),"side");


private _initalPrice = M_CONFIG(getNumber,"LifeCfgVehicles",_className,"price");

private "_buyMultiplier";
private "_rentMultiplier";

[...]
//Side Specific actions.
switch (playerSide) do {
    case west:
    {
        if ((life_veh_shop select 2) isEqualTo "cop" && _className in ["C_Hatchback_01_F","C_SUV_01_F","C_Hatchback_01_sport_F"]) then {
            [_vehicle,"cop_cars_civil",true] spawn life_fnc_vehicleAnimate;
        };
    };
};

[...]

life_server/functions/systems/fn_spawnVehicle.sqf
Code:
#include "\life_server\script_macros.hpp"
/*
    File: fn_spawnVehicle.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Sends the query request to the database, if an array is returned then it creates
    the vehicle if it's not in use or dead.
*/
params [
    ["_vid", -1, [0]],
    ["_pid", "", [""]],
    ["_sp", [], [[],""]],
    ["_unit", objNull, [objNull]],
    ["_price", 0, [0]],
    ["_dir", 0, [0]],
    "_spawntext"
];

private _unit_return = _unit;
private _name = name _unit;
private _side = side _unit;
_unit = owner _unit;

[...]
//Sets of animations

if ((_vInfo select 1) isEqualTo "cop" && (_vInfo select 2) in ["C_Hatchback_01_F","C_SUV_01_F","C_Hatchback_01_sport_F"]) then {
    [_vehicle,"cop_cars_civil",true] remoteExecCall ["life_fnc_vehicleAnimate"];
};

[1,_spawntext] remoteExecCall ["life_fnc_broadcast",_unit];
serv_sv_use deleteAt _servIndex;