Voici se que tu ma demander
Maxence
[CODE title="Init du traitement"]this enableSimulation false; this allowDamage false; this addAction[localize"STR_MAR_Process_Rock",life_fnc_processAction,"cement",0,false,false,"",' life_inv_rock > 0 && !life_is_processing && !life_action_inUse',5]; this addAction[format ["%1 ($%2)",localize (getText(missionConfigFile >> "Licenses" >> "cement" >> "displayName")), [(getNumber(missionConfigFile >> "Licenses" >> "cement" >> "price"))] call life_fnc_numberText],life_fnc_buyLicense,"cement",0,false,false,"",' !license_civ_cement && playerSide isEqualTo civilian ',5];[/CODE]
[CODE title="fn_processAction.sqf"]#include "..\..\script_macros.hpp"
/*
File: fn_processAction.sqf
Author: Bryan "Tonic" Boardwine
Modified : NiiRoZz
Description:
Master handling for processing an item.
NiiRoZz : Added multiprocess
*/
private ["_vendor","_type","_itemInfo","_oldItem","_newItemWeight","_newItem","_oldItemWeight","_cost","_upp","_hasLicense","_itemName","_oldVal","_ui","_progress","_pgText","_cP","_materialsRequired","_materialsGiven","_noLicenseCost","_text","_filter","_totalConversions","_minimumConversions"];
_vendor = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_type = [_this,3,"",[""]] call BIS_fnc_param;
//Error check
if (isNull _vendor || _type isEqualTo "" || (player distance _vendor > 10)) exitWith {};
life_action_inUse = true;//Lock out other actions during processing.
if (isClass (missionConfigFile >> "ProcessAction" >> _type)) then {
_filter = false;
_materialsRequired = M_CONFIG(getArray,"ProcessAction",_type,"MaterialsReq");
_materialsGiven = M_CONFIG(getArray,"ProcessAction",_type,"MaterialsGive");
_noLicenseCost = M_CONFIG(getNumber,"ProcessAction",_type,"NoLicenseCost");
_text = M_CONFIG(getText,"ProcessAction",_type,"Text");
} else {_filter = true;};
if (_filter) exitWith {life_action_inUse = false;};
_itemInfo = [_materialsRequired,_materialsGiven,_noLicenseCost,(localize format ["%1",_text])];
if (count _itemInfo isEqualTo 0) exitWith {life_action_inUse = false;};
//Setup vars.
_oldItem = _itemInfo select 0;
_newItem = _itemInfo select 1;
_cost = _itemInfo select 2;
_upp = _itemInfo select 3;
_exit = false;
if (count _oldItem isEqualTo 0) exitWith {life_action_inUse = false;};
_totalConversions = [];
{
_var = ITEM_VALUE(_x select 0);
if (_var isEqualTo 0) exitWith {_exit = true;};
if (_var < (_x select 1)) exitWith {_exit = true;};
_totalConversions pushBack (floor (_var/(_x select 1)));
} forEach _oldItem;
if (_exit) exitWith {life_is_processing = false; hint localize "STR_NOTF_NotEnoughItemProcess"; life_action_inUse = false;};
if (_vendor in [mari_processor,coke_processor,heroin_processor]) then {
_hasLicense = false;
} else {
_hasLicense = LICENSE_VALUE(_type,"civ");
};
_cost = _cost * (count _oldItem);
_minimumConversions = _totalConversions call BIS_fnc_lowestNum;
_oldItemWeight = 0;
{
_weight = ([_x select 0] call life_fnc_itemWeight) * (_x select 1);
_oldItemWeight = _oldItemWeight + _weight;
} count _oldItem;
_newItemWeight = 0;
_percent = (floor random 100) + 1;
{
_prob = _x select 2;
_probdiff = _x select 3;
if ((_percent >= _prob) && (_percent <= _probdiff)) exitWith {
_weight = ([_x select 0] call life_fnc_itemWeight) * (_x select 1);
_newItemWeight = _newItemWeight + _weight;
};
} count _newItem;
_exit = false;
if (_newItemWeight > _oldItemWeight) then {
_netChange = _newItemWeight - _oldItemWeight;
_freeSpace = life_maxWeight - life_carryWeight;
if (_freeSpace < _netChange) exitWith {_exit = true;};
private _estConversions = floor(_freeSpace / _netChange);
if (_estConversions < _minimumConversions) then {
_minimumConversions = _estConversions;
};
};
if (_exit) exitWith {hint localize "STR_Process_Weight"; life_is_processing = false; life_action_inUse = false;};
//Setup our progress bar.
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;
if (_hasLicense) then {
for "_i" from 0 to 1 step 0 do {
uiSleep (getNumber (missionConfigFile >> "ProcessAction" >> _type >> "ProcessDuration"));
_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if (_cP >= 1) exitWith {};
if (player distance _vendor > 10) exitWith {};
};
if (player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; "progressBar" cutText ["","PLAIN"]; life_is_processing = false; life_action_inUse = false;};
{
[false,(_x select 0),((_x select 1)*(_minimumConversions))] call life_fnc_handleInv;
} count _oldItem;
{
_prob = _x select 2;
_probdiff = _x select 3;
if ((_percent >= _prob) && (_percent <= _probdiff)) exitWith {
[true,(_x select 0),((_x select 1)*(_minimumConversions))] call life_fnc_handleInv;
};
} count _newItem;
"progressBar" cutText ["","PLAIN"];
if (_minimumConversions isEqualTo (_totalConversions call BIS_fnc_lowestNum)) then {hint localize "STR_NOTF_ItemProcess";} else {hint localize "STR_Process_Partial";};
life_is_processing = false; life_action_inUse = false;
} else {
if (CASH < _cost) exitWith {hint format [localize "STR_Process_License",[_cost] call life_fnc_numberText]; "progressBar" cutText ["","PLAIN"]; life_is_processing = false; life_action_inUse = false;};
for "_i" from 0 to 1 step 0 do {
uiSleep (getNumber (missionConfigFile >> "ProcessAction" >> _type >> "ProcessDuration"));
_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
if (_cP >= 1) exitWith {};
if (player distance _vendor > 10) exitWith {};
};
if (player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; "progressBar" cutText ["","PLAIN"]; life_is_processing = false; life_action_inUse = false;};
if (CASH < _cost) exitWith {hint format [localize "STR_Process_License",[_cost] call life_fnc_numberText]; "progressBar" cutText ["","PLAIN"]; life_is_processing = false; life_action_inUse = false;};
{
[false,(_x select 0),((_x select 1)*(_minimumConversions))] call life_fnc_handleInv;
} count _oldItem;
{
_prob = _x select 2;
_probdiff = _x select 3;
if ((_percent >= _prob) && (_percent <= _probdiff)) exitWith {
[true,(_x select 0),((_x select 1)*(_minimumConversions))] call life_fnc_handleInv;
};
} count _newItem;
"progressBar" cutText ["","PLAIN"];
if (_minimumConversions isEqualTo (_totalConversions call BIS_fnc_lowestNum)) then {hint localize "STR_NOTF_ItemProcess";} else {hint localize "STR_Process_Partial";};
CASH = CASH - _cost;
[0] call SOCK_fnc_updatePartial;
life_is_processing = false;
life_action_inUse = false;
};
[/CODE]
[CODE title="fn_keyHandler.sqf"]#include "..\..\script_macros.hpp"
/*
- File: fn_keyHandler.sqf
- Author: Bryan "Tonic" Boardwine
*
- Description:
- Main key handler for event 'keyDown'.
*/
params [
"_ctrl",
"_code",
"_shift",
"_ctrlKey",
"_alt"
];
private _speed = speed cursorObject;
private _handled = false;
private _interactionKey = if (actionKeys "User10" isEqualTo []) then {157} else {(actionKeys "User10") select 0};
private _interruptionKeys = [17, 30, 31, 32]; //A,S,W,D
//Vault handling...
if ((_code in (actionKeys "GetOver") || _code in (actionKeys "salute") || _code in (actionKeys "SitDown") || _code in (actionKeys "Throw") || _code in (actionKeys "GetIn") || _code in (actionKeys "GetOut") || _code in (actionKeys "Fire") || _code in (actionKeys "ReloadMagazine") || _code in [16,18]) && (((animationState player) isEqualto "ace_amovpercmstpscapwnondnon") || (player getVariable ["playerSurrender",false]) || life_isknocked || life_istazed)) exitWith {
true;
};
if (life_action_inUse) exitWith {
if (!life_interrupted && _code in _interruptionKeys) then {life_interrupted = true};
_handled;
};
//Hotfix for Interaction key not being able to be bound on some operation systems.
if (!(actionKeys "User10" isEqualTo []) && {(inputAction "User10" > 0)}) exitWith {
//Interaction key (default is Left Windows, can be mapped via Controls -> Custom -> User Action 10)
if (!life_action_inUse) then {
[] spawn {
private _handle = [] spawn life_fnc_actionKeyHandler;
waitUntil {scriptDone _handle};
life_action_inUse = false;
};
};
true;
};
if (life_container_active) exitwith {
//ignore movement actions
private _allowedMoves = [
"MoveForward",
"MoveBack",
"TurnLeft",
"TurnRight",
"MoveFastForward",
"MoveSlowForward",
"turbo",
"TurboToggle",
"MoveLeft",
"MoveRight",
"WalkRunTemp",
"WalkRunToggle",
"AdjustUp",
"AdjustDown",
"AdjustLeft",
"AdjustRight",
"Stand",
"Crouch",
"Prone",
"MoveUp",
"MoveDown",
"LeanLeft",
"LeanLeftToggle",
"LeanRight",
"LeanRightToggle"
];
if (({_code in (actionKeys _x)} count _allowedMoves) > 0) exitwith {
false;
};
//handle other keys
if (_code isEqualTo 57) then {//space key -> place
life_storagePlacing = 0 spawn life_fnc_placestorage;
} else { //other keys -> abort
if (!isNull life_storagePlacing) exitWith {}; //already placing down a box
if (!isNull life_container_activeObj) then {
deleteVehicle life_container_activeObj;
titleText [localize "STR_NOTF_PlaceContainerAbort", "PLAIN"];
};
life_container_active = false;
};
true;
};
switch (_code) do {
// -- Disable commander/tactical view
if (LIFE_SETTINGS(getNumber,"disableCommanderView") isEqualTo 1) then {
private _CommandMode = actionKeys "tacticalView";
if (_code in _CommandMode) then {
hint localize "STR_NOTF_CommanderView";
_handled = true;
};
};
case 62: {["theprogrammer_fnc_bourseGetBufferData"] spawn theprogrammer_fnc_bourseSendData;};
//Space key for Jumping
case 57: {
if (isNil "jumpActionTime") then {jumpActionTime = 0;};
if (_shift && {!(animationState player isEqualTo "AovrPercMrunSrasWrflDf")} && {isTouchingGround player} && {stance player isEqualTo "STAND"} && {speed player > 2} && {!life_is_arrested} && {((velocity player) select 2) < 2.5} && {time - jumpActionTime > 1.5}) then {
jumpActionTime = time; //Update the time.
[player] remoteExec ["life_fnc_jumpFnc",RANY]; //Global execution
_handled = true;
};
};
//Modifer le numéro pour changer la touche
case 46 : {
_currentPos = getPosATL life_barrier_activeObj;
detach life_barrier_activeObj;
life_barrier_activeObj setPos[(getPos life_barrier_activeObj select 0), (getPos life_barrier_activeObj select 1), 0];
life_barrier_activeObj enableSimulationGlobal true;
life_bar_placey pushBack life_barrier_activeObj;
life_barrier_active = false;
life_barrier_activeObj = ObjNull;
//hint "Vous avez placé l'objet !";
};
//Surrender (Shift + B)
case 48: {
if (_shift) then {
if (player getVariable ["playerSurrender",false]) then {
player setVariable ["playerSurrender",false,true];
} else {
[] spawn life_fnc_surrender;
};
_handled = true;
};
};
//Holster / recall weapon. (Shift + H)
case 35: {
if (_shift && !_ctrlKey && !(currentWeapon player isEqualTo "")) then {
life_curWep_h = currentWeapon player;
player action ["SwitchWeapon", player, player, 100];
player switchCamera cameraView;
};
if (!_shift && _ctrlKey && !isNil "life_curWep_h" && {!(life_curWep_h isEqualTo "")}) then {
if (life_curWep_h in [primaryWeapon player,secondaryWeapon player,handgunWeapon player]) then {
player selectWeapon life_curWep_h;
};
};
};
//Knock out, this is experimental and yeah... (Shift + G)
case 34: {
if (_shift) then {_handled = true};
if (_shift && !isNull cursorObject && cursorObject isKindOf "CAManBase" && isPlayer cursorObject && alive cursorObject && cursorObject distance player < 4 && speed cursorObject < 1) then {
if ((animationState cursorObject) != "Incapacitated" && (currentWeapon player == primaryWeapon player || currentWeapon player == handgunWeapon player) && currentWeapon player != "" && !life_knockout && !((animationState player) isEqualto "ace_amovpercmstpscapwnondnon") && !life_istazed && !life_isknocked) then {
[cursorObject] spawn life_fnc_knockoutAction;
};
};
};
//T Key (Trunk)
case 20: {
if (!_alt && {!_ctrlKey} && {!dialog} && {!life_action_inUse} && {!(player getVariable ["playerSurrender",false])} && {!((animationState player) isEqualto "ace_amovpercmstpscapwnondnon")} && {!life_isknocked} && {!life_istazed}) then {
if (!(isNull objectParent player) && alive vehicle player) then {
if ((vehicle player) in life_vehicles) then {
[vehicle player] spawn life_fnc_openInventory;
};
} else {
private "_list";
_list = ((ASLtoATL (getPosASL player)) nearEntities [["Box_IND_Grenades_F","B_supplyCrate_F"], 2.5]) select 0;
if (!(isNil "_list")) then {
_house = nearestObject [(ASLtoATL (getPosASL _list)), "House"];
if (_house getVariable ["locked", false]) then {
hint localize "STR_House_ContainerDeny";
} else {
[_list] spawn life_fnc_openInventory;
};
} else {
_list = ["landVehicle","Air","Ship"];
if (KINDOF_ARRAY(cursorObject,_list) && {player distance cursorObject < 7} && {isNull objectParent player} && {alive cursorObject} && {!life_action_inUse}) then {
if (cursorObject in life_vehicles || {locked cursorObject isEqualTo 0}) then {
[cursorObject] spawn life_fnc_openInventory;
};
};
};
};
};
};
//L Key?
case 38: {
//If cop run checks for turning lights on.
if (_shift && playerSide in [west,independent]) then {
if (!(isNull objectParent player) && (typeOf vehicle player) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"]) then {
if (!isNil {vehicle player getVariable "lights"}) then {
if (playerSide isEqualTo west) then {
[vehicle player] call life_fnc_sirenLights;
} else {
[vehicle player] call life_fnc_medicSirenLights;
};
_handled = true;
};
};
};
if (!_alt && !_ctrlKey) then { [] call life_fnc_radar; };
};
//Interaction key (default is Left Windows, can be mapped via Controls -> Custom -> User Action 10)
case _interactionKey: {
if (!life_action_inUse) then {
[] spawn {
private _handle = [] spawn life_fnc_actionKeyHandler;
waitUntil {scriptDone _handle};
life_action_inUse = false;
};
};
};
//Y Player Menu
case 21: {
if (!_alt && !_ctrlKey && !dialog && !((animationState player) isEqualto "ace_amovpercmstpscapwnondnon") && {!life_action_inUse}) then {
[] call life_fnc_p_openMenu;
};
};
/*
//F Key
case 33: {
if (playerSide in [west,independent] && {vehicle player != player} && {!life_siren_active} && {((driver vehicle player) == player)}) then {
[] spawn {
life_siren_active = true;
sleep 4.7;
life_siren_active = false;
};
private _veh = vehicle player;
if (isNil {_veh getVariable "siren"}) then {_veh setVariable ["siren",false,true];};
if ((_veh getVariable "siren")) then {
titleText [localize "STR_MISC_SirensOFF","PLAIN"];
_veh setVariable ["siren",false,true];
if !(isNil {(_veh getVariable "sirenJIP")}) then {
private _jip = _veh getVariable "sirenJIP";
_veh setVariable ["sirenJIP",nil,true];
remoteExec ["",_jip]; //remove from JIP queue
};
} else {
titleText [localize "STR_MISC_SirensON","PLAIN"];
_veh setVariable ["siren",true,true];
private "_jip";
if (playerSide isEqualTo west) then {
_jip = [_veh] remoteExec ["life_fnc_copSiren",RCLIENT,true];
} else {
_jip = [_veh] remoteExec ["life_fnc_medicSiren",RCLIENT,true];
};
_veh setVariable ["sirenJIP",_jip,true];
};
};
};
*/
// O Key
case 24: {
if (_shift) then {
if (soundVolume < 0.1) then {
0 fadeSound 1;
} else {
0 fadeSound (round((soundVolume - 0.1)*10)/10);
};
hint format [localize "STR_MISC_sound", (soundVolume*100)];
};
};
//U Key
case 22: {
if (!_alt && !_ctrlKey) then {
private _veh = if (isNull objectParent player) then {
cursorObject;
} else {
vehicle player;
};
if (_veh isKindOf "House_F" && {playerSide isEqualTo civilian}) then {
if (_veh in life_vehicles && {player distance _veh < 20}) then {
private _door = [_veh] call life_fnc_nearestDoor;
if (_door isEqualTo 0) exitWith {hint localize "STR_House_Door_NotNear"};
private
locked = _veh getVariable [format ["bis_disabled_Door%1",_door],0];
if (_locked isEqualTo 0) then {
veh setVariable [format ["bis_disabled_Door%1",_door],1,true];
veh animateSource [format ["Door%1_source", _door], 0];
systemChat localize "STR_House_Door_Lock";
} else {
veh setVariable [format ["bis_disabled_Door%1",_door],0,true];
veh animateSource [format ["Door%1_source", _door], 1];
systemChat localize "STR_House_Door_Unlock";
};
};
} else {
private _locked = locked _veh;
if (_veh in life_vehicles && {player distance _veh < 20}) then {
if (_locked isEqualTo 2) then {
#include "..\..\The-Programmer\Contravention\scripts\unlockVehCheck.sqf"
if (local _veh) then {
_veh lock 0;
// BI
_veh animateDoor ["door_back_R",1];
_veh animateDoor ["door_back_L",1];
_veh animateDoor ['door_R',1];
_veh animateDoor ['door_L',1];
_veh animateDoor ['Door_L_source',1];
_veh animateDoor ['Door_rear',1];
_veh animateDoor ['Door_rear_source',1];
_veh animateDoor ['Door_1_source',1];
_veh animateDoor ['Door_2_source',1];
_veh animateDoor ['Door_3_source',1];
_veh animateDoor ['Door_LM',1];
_veh animateDoor ['Door_RM',1];
_veh animateDoor ['Door_LF',1];
_veh animateDoor ['Door_RF',1];
_veh animateDoor ['Door_LB',1];
_veh animateDoor ['Door_RB',1];
_veh animateDoor ['DoorL_Front_Open',1];
_veh animateDoor ['DoorR_Front_Open',1];
_veh animateDoor ['DoorL_Back_Open',1];
_veh animateDoor ['DoorR_Back_Open ',1];
} else {
[_veh,0] remoteExecCall ["life_fnc_lockVehicle",_veh];
_veh animateDoor ["door_back_R",1];
_veh animateDoor ["door_back_L",1];
_veh animateDoor ['door_R',1];
_veh animateDoor ['door_L',1];
_veh animateDoor ['Door_L_source',1];
_veh animateDoor ['Door_rear',1];
_veh animateDoor ['Door_rear_source',1];
_veh animateDoor ['Door_1_source',1];
_veh animateDoor ['Door_2_source',1];
_veh animateDoor ['Door_3_source',1];
_veh animateDoor ['Door_LM',1];
_veh animateDoor ['Door_RM',1];
_veh animateDoor ['Door_LF',1];
_veh animateDoor ['Door_RF',1];
_veh animateDoor ['Door_LB',1];
_veh animateDoor ['Door_RB',1];
_veh animateDoor ['DoorL_Front_Open',1];
_veh animateDoor ['DoorR_Front_Open',1];
_veh animateDoor ['DoorL_Back_Open',1];
_veh animateDoor ['DoorR_Back_Open ',1];
};
systemChat localize "STR_MISC_VehUnlock";
[_veh,"unlockCarSound",50,1] remoteExec ["life_fnc_say3D",RANY];
} else {
if (local _veh) then {
_veh lock 2;
_veh animateDoor ["door_back_R",0];
_veh animateDoor ["door_back_L",0];
_veh animateDoor ['door_R',0];
_veh animateDoor ['door_L',0];
_veh animateDoor ['Door_L_source',0];
_veh animateDoor ['Door_rear',0];
_veh animateDoor ['Door_rear_source',0];
_veh animateDoor ['Door_1_source',0];
_veh animateDoor ['Door_2_source',0];
_veh animateDoor ['Door_3_source',0];
_veh animateDoor ['Door_LM',0];
_veh animateDoor ['Door_RM',0];
_veh animateDoor ['Door_LF',0];
_veh animateDoor ['Door_RF',0];
_veh animateDoor ['Door_LB',0];
_veh animateDoor ['Door_RB',0];
_veh animateDoor ['DoorL_Front_Open',0];
_veh animateDoor ['DoorR_Front_Open',0];
_veh animateDoor ['DoorL_Back_Open',0];
_veh animateDoor ['DoorR_Back_Open ',0];
} else {
[_veh,2] remoteExecCall ["life_fnc_lockVehicle",_veh];
_veh animateDoor ["door_back_R",0];
_veh animateDoor ["door_back_L",0];
_veh animateDoor ['door_R',0];
_veh animateDoor ['door_L',0];
_veh animateDoor ['Door_L_source',0];
_veh animateDoor ['Door_rear',0];
_veh animateDoor ['Door_rear_source',0];
_veh animateDoor ['Door_1_source',0];
_veh animateDoor ['Door_2_source',0];
_veh animateDoor ['Door_3_source',0];
_veh animateDoor ['Door_LM',0];
_veh animateDoor ['Door_RM',0];
_veh animateDoor ['Door_LF',0];
_veh animateDoor ['Door_RF',0];
_veh animateDoor ['Door_LB',0];
_veh animateDoor ['Door_RB',0];
_veh animateDoor ['DoorL_Front_Open',0];
_veh animateDoor ['DoorR_Front_Open',0];
_veh animateDoor ['DoorL_Back_Open',0];
_veh animateDoor ['DoorR_Back_Open ',0];
};
systemChat localize "STR_MISC_VehLock";
[_veh,"lockCarSound",50,1] remoteExec ["life_fnc_say3D",RANY];
};
};
};
};
};
};
_handled;[/CODE]