Français Not solved Ajouter des logs discord dans le Weapon Shop

  • Auteur de la discussion Auteur de la discussion cadnalex
  • Date de début Date de début
  • Bonjour Visiteur ! Les sujets de cette catégorie sont clos. Si vous souhaitez réouvrir, merci de nous contacter en précisant le lien du post à réouvrir !

    Hello Visiteur ! The topics in this category are closed. If you wish to reopen, please contact us with the link of the post you wish to reopen !

cadnalex

User
14/5/22
51
5
3
300
J'utilise le weaponshops (maverick) et je voulais utiliser le discord log dessus dans ma mission il a déjà ce système mais je n'arrive pas à le configurer.
[CODE title="ancien magasin"]#include "..\..\script_macros.hpp"
/*
File: fn_weaponShopBuySell.sqf
Author: Bryan "Tonic" Boardwine

Description:
Master handling of the weapon shop for buying / selling an item.
*/
disableSerialization;
private ["_price","_item","_itemInfo","_bad"];
if ((lbCurSel 38403) isEqualTo -1) exitWith {hint localize "STR_Shop_Weapon_NoSelect"};
_price = lbValue[38403,(lbCurSel 38403)]; if (isNil "_price") then {_price = 0;};
_item = lbData[38403,(lbCurSel 38403)];
_itemInfo = [_item] call life_fnc_fetchCfgDetails;

Private _ItemLibNovato = ["ItemGPS","Binocular","FirstAidKit","ItemCompass","ItemWatch","NVGoggles","ItemMap"];

If (RJ_Novato && !(_item In _ItemLibNovato)) ExitWith {["Você é novato e não pode comprar armas!","error"] Call RJM_fnc_Notificar};

Private _SidesComDesconto = GetText(MissionConfigFile >> "RJ_CfgDoadores" >> "RJ_SidesComDesconto");

_SidesComDesconto = Call Compile _SidesComDesconto;

If (PlayerSide In _SidesComDesconto && RJ_NivelDoador > 0) Then {
Private buyMultiplier = GetNumber(MissionConfigFile >> "RJ_CfgDoadores" >> Format["RJ_DescontoArmasDoador%1",RJ_NivelDoador]);
If (IsNil "_buyMultiplier") Then {_buyMultiplier = 1};
_price = _price * _buyMultiplier;
};


Private _exit = false;
Private _logar = false;
_bad = "";

if ((_itemInfo select 6) != "CfgVehicles") then {
if ((_itemInfo select 4) in [4096,131072]) then {
if (!(player canAdd _item) && (uiNamespace getVariable ["Weapon_Shop_Filter",0]) != 1) exitWith {_bad = (localize "STR_NOTF_NoRoom")};
};
};

if (_bad != "") exitWith {hint _bad};

if ((uiNamespace getVariable ["Weapon_Shop_Filter",0]) isEqualTo 1) then {
[True,1,_price] Call RJM_fnc_AtualizarGrana;
[_item,false] call life_fnc_handleItem;
hint parseText format [localize "STR_Shop_Weapon_Sold",_itemInfo select 1,[_price] call life_fnc_numberText];
[nil,(uiNamespace getVariable ["Weapon_Shop_Filter",0])] call life_fnc_weaponShopFilter; //Update the menu.
} else {
private _altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _EusaArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = [[["Altis", _altisArray], ["Tanoa", _tanoaArray], ["Eusa", _EusaArray]]] call TON_fnc_terrainSort;
private _hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
if (!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") >= _price}) then {
_action = [
format [(localize "STR_Shop_Virt_Gang_FundsMSG")+ "<br/><br/>" +(localize "STR_Shop_Virt_Gang_Funds")+ " <t color='#8cff9b'>$%1</t><br/>" +(localize "STR_Shop_Virt_YourFunds")+ " <t color='#8cff9b'>$%2</t>",
[(group player getVariable "gang_bank")] call life_fnc_numberText,
[CASH] call life_fnc_numberText
],
localize "STR_Shop_Virt_YourorGang",
localize "STR_Shop_Virt_UI_GangFunds",
localize "STR_Shop_Virt_UI_YourCash"
] call BIS_fnc_guiMessage;
if (_action) then {
hint parseText format [localize "STR_Shop_Weapon_BoughtGang",_itemInfo select 1,[_price] call life_fnc_numberText];
_funds = group player getVariable "gang_bank";
_funds = _funds - _price;
group player setVariable ["gang_bank",_funds,true];
[_item,true] call life_fnc_handleItem;

if (life_HC_isActive) then {
[1,group player] remoteExecCall ["HC_fnc_updateGang",HC_Life];
} else {
[1,group player] remoteExecCall ["TON_fnc_updateGang",RSERV];
};


} else {
if (_price > CASH) exitWith {hint localize "STR_NOTF_NotEnoughMoney"};
//hint parseText format [localize "STR_Shop_Weapon_BoughtItem",_itemInfo select 1,[_price] call life_fnc_numberText];
[format [localize "STR_Shop_Weapon_BoughtItem",_itemInfo select 1,[_price] call life_fnc_numberText]] Call RJM_fnc_Notificar;
[True,0,_price] Call RJM_fnc_AtualizarGrana;
[_item,true] call life_fnc_handleItem;
};
} else {
//hint parseText format [localize "STR_Shop_Weapon_BoughtItem",_itemInfo select 1,[_price] call life_fnc_numberText];
If (life_inv_cartaocredito > 0 && !((uiNamespace getVariable ["Weapon_Shop",""]) in ["rebel","black"])) Then {
if (_price > BANK) exitWith {hint localize "STR_NOTF_NotEnoughMoney"; _exit = true};
[False,0,_price] Call RJM_fnc_AtualizarGrana;
[format [localize "STR_Shop_Weapon_BoughtItemCartao",_itemInfo select 1,[_price] call life_fnc_numberText]] Call RJM_fnc_Notificar;
} Else {
if (_price > CASH) exitWith {hint localize "STR_NOTF_NotEnoughMoney"; _exit = true};
[True,0,_price] Call RJM_fnc_AtualizarGrana;
[format [localize "STR_Shop_Weapon_BoughtItem",_itemInfo select 1,[_price] call life_fnc_numberText]] Call RJM_fnc_Notificar;
};
If (_exit) ExitWith {};
[_item,true] call life_fnc_handleItem;
_logar = true;
};
};

[3] call SOCK_fnc_updatePartialRJ;

If (IsNil "RJ_DiscordAtivo" || !_logar || (PlayerSide IsEqualTo Independent)) exitWith {};
If (_item In ["Rangefinder","Binocular","NVGoggles","FirstAidKit","ItemGPS"]) exitWith {};

If (RJ_ItemsComprados IsEqualTo []) Then {
[] Spawn {
Private ["_price","_item","_count","_contados"];
_contados = [];
UiSleep 4;
{
_price = _X Select 0;
_item = _X Select 1;

If !(_item In _contados) Then {
_contados PushBack _item;
_count = {_item IsEqualTo (_X Select 1)} Count RJ_ItemsComprados;
_price = _price * _count;
_item = If (isClass(configFile >> "CfgWeapons" >> _item)) Then {getText(configFile >> "CfgWeapons" >> _item >> "displayName")} Else {getText(configFile >> "CfgMagazines" >> _item >> "displayName")};
RJ_DiscordLog = [0,[profileName,getPlayerUid player,_price,_item,_count]];
PublicVariableServer "RJ_DiscordLog";
};
} ForEach RJ_ItemsComprados;
RJ_ItemsComprados = [];
};
};

RJ_ItemsComprados PushBack [_price,_item];


[/CODE]
[CODE title="nouveau magasin"]/*--------------------------------------------------------------------------
Author: Maverick Applications
Website: https://maverick-applications.com

You're not allowed to use this file without permission from the author!
---------------------------------------------------------------------------*/

#define MAVFNC MAV_guiWeaponShop
#define MAVCFG missionConfigFile >> "maverick_weaponshop_cfg"
#include "gui_includes.h"

#define CASH (missionNamespace getVariable getText (MAVCFG >> "cashVar"))
#define SYMBOL getText (MAVCFG >> "cashSymbol")

disableSerialization;

params [
["_mode", "", [""]],
["_params", [], [[]]]
];

switch _mode do {
case "onLoad": {
_params params [
["_display", displayNull, [displayNull]]
];

showChat false;
MAVV(Cart) = [];
MAVV(Total) = 0;
MAVV(Spam) = diag_tickTime;
MAVV(Mouse) = false;
MAVV(Sound) = soundVolume;

0 fadeSound 0;

MAVV(Building) = "Land_House_Small_02_F" createVehicleLocal [0, 0, 0];
MAVV(Building) setDir 290.479;

private _randPos = [[[[worldSize / 2, worldSize / 2, 0], worldSize / 2]], ["water"]] call BIS_fnc_randomPos;
MAVV(Building) setPosATL [_randPos param [0], _randPos param [1], 5000];
MAVV(Building) setVectorUp [0, 0, 1];

MAVV(Logic) = "Land_Tyre_F" createVehicleLocal [0, 0, 0];
MAVV(Logic) setPosATL (MAVV(Building) modelToWorld [-2.9, -3.2, -0.72]);
MAVV(Logic) setVectorUp [0, 0, 1];
MAVV(Logic) hideObject true;

MAVV(Holder) = "GroundWeaponHolder_Scripted" createVehicleLocal [0, 0, 0];
MAVV(Holder) attachTo [MAVV(Logic), [0, -0.63, 1.45]];
MAVV(Holder) setVectorDirAndUp [[0, 0, 1], [0, -1, 0]];

if (sunOrMoon isEqualTo 0) then {
MAVV(Light) = "#lightpoint" createVehicleLocal [0, 0, 0];
MAVV(Light) setLightBrightness 0.2;
MAVV(Light) setLightAmbient [1,1,1];
MAVV(Light) setLightColor [1,1,1];
MAVV(Light) setPosATL (MAVV(Building) modelToWorld [-2.9, -3.2, 2.0]);
};

MAVV(Camera) = "CAMERA" camCreate [0, 0, 0];
cameraEffectEnableHUD false;
showCinemaBorder false;
MAVV(Camera) setPosATL (MAVV(Building) modelToWorld [-1.5, -3.3, 0.95]);
MAVV(Camera) camSetFOV 0.75;
MAVV(Camera) camSetFocus [1.394, 1];
MAVV(Camera) setVectorDirAndUp [[-0.351803,-0.915757,-0.19397], [-0.0695604,-0.181068,0.981007]];
MAVV(Camera) camCommit 0;
MAVV(Camera) cameraEffect ["Internal", "Back"];

private _ctrlTitle = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TITLE;
_ctrlTitle ctrlSetText (getText (MAVV(Cfg) >> "title"));

private _ctrlCashOnHand = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_ONHAND;
_ctrlCashOnHand ctrlSetText format [getText (MAVCFG >> "localization" >> "msgCashOnHand"), SYMBOL, [CASH] call BIS_fnc_numberText];

private _ctrlCloseButton = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_CLOSE;
_ctrlCloseButton ctrlAddEventHandler ["ButtonClick", {ctrlParent (_this select 0) closeDisplay 0;}];

private _ctrlTV = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TREE;
_ctrlTV ctrlAddEventhandler ["TreeSelChanged", {["onTreeChanged", _this] call MAVFNC}];

private _ctrlCart = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_LIST;
_ctrlCart ctrlAddEventHandler ["LBDblClick", {["remove", _this] call MAVFNC}];

private _cartTitle = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TOTAL;
_cartTitle ctrlSetText format [getText (MAVCFG >> "localization" >> "msgCartTotal"), SYMBOL, [MAVV(Total)] call BIS_fnc_numberText];

private _infoBtn = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_INFOBTN;
_infoBtn ctrlSetTooltip getText (MAVCFG >> "localization" >> "msgInfoTooltip");

private _ctrlTabs = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TABS;
_ctrlTabs ctrlAddEventHandler ["ToolBoxSelChanged", {["onTabChanged", _this] call MAVFNC}];

private _ctrlSearch = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_SEARCH;
_ctrlSearch ctrlAddEventHandler ["KeyUp", {["onKeyUp", _this] call MAVFNC}];

private _ctrlButtonSearch = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_SEARCHBTN;
_ctrlButtonSearch ctrlAddEventHandler ["ButtonClick", {["onSearch", _this] call MAVFNC}];

private _ctrlButtonCollapse = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_COLLAPSE;
_ctrlButtonCollapse ctrlAddEventHandler ["ButtonClick", {["onCollapse", _this] call MAVFNC}];

private _ctrlButtonExpand = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_EXPAND;
_ctrlButtonExpand ctrlAddEventHandler ["ButtonClick", {["onExpand", _this] call MAVFNC}];

_display displayAddEventHandler ["MouseButtonDown", {
if (_this select 1 isEqualTo 0) then {MAVV(Mouse) = true;};
}];

_display displayAddEventHandler ["MouseButtonUp", {
if (_this select 1 isEqualTo 0) then {MAVV(Mouse) = false;};
}];

_display displayAddEventHandler ["MouseMoving", {
if (MAVV(Mouse) && {!isNil MAVQ(Holder)}) then {
params ["", "_x", "_y"];
private _dir = getDir MAVV(Logic);
MAVV(Logic) setDir (_dir + (_x * ((getNumber (MAVCFG >> "rotationSpeed") max 1) min 10)));
};
}];

["onTabChanged", [_ctrlTabs, 0]] call MAVFNC;
};

case "onTabChanged": {
_params params [
["_ctrlTabs", controlNull, [controlNull]],
["_ctrlSelIndex", -1, [0]]
];

private _display = ctrlParent _ctrlTabs;
private _cat = ["weapons", "magazines", "attachments", "items"] select _ctrlSelIndex;

private _ctrlTV = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TREE;
tvClear _ctrlTV;

switch _cat do {
case "weapons": {
{
_x params ["_class", "_price", "_condition", "_display"];

if (call compile _condition) then {
(_class call MAV_shop_fnc_itemInfo) params ["_itemName", "_itemPicture"];
private _aComp = [_class, true] call MAV_shop_fnc_weaponCompatibleItems;
private _weaponName = [_display, _itemName] select (_display isEqualTo "");
private _weaponIndex = _ctrlTV tvAdd [[], _weaponName];
_ctrlTV tvSetPicture [[_weaponIndex], _itemPicture];
_ctrlTV tvSetData [[_weaponIndex], str ([_class, _price, _display])];

{
_x params ["_comp", "_compT"];
private _array = getArray (MAVV(Cfg) >> _comp);
private _arrayComp = (_array apply {private _lower = toLower (_x param [0]); _lower}) arrayIntersect _aComp;
if !(_arrayComp isEqualTo []) then {
private _compIndex = _ctrlTV tvAdd [[_weaponIndex], _compT];

{
private _compItem = _x;
private _index = [_compItem, _array apply {[toLower (_x param [0]), _x param [1], _x param [2], _x param [3]]}] call MAV_shop_fnc_index;
(_array select _index) params ["_subClass", "_subPrice", "_subCondition", "_subDisplay"];

if (call compile _subCondition) then {
(_compItem call MAV_shop_fnc_itemInfo) params ["_itemName", "_itemPicture"];
private _compName = [_subDisplay, _itemName] select (_subDisplay isEqualTo "");
private _compWeaponIndex = _ctrlTV tvAdd [[_weaponIndex, _compIndex], _compName];
_ctrlTV tvSetPicture [[_weaponIndex, _compIndex, _compWeaponIndex], _itemPicture];
_ctrlTV tvSetData [[_weaponIndex, _compIndex, _compWeaponIndex], str ([_subClass, _subPrice, _subDisplay])];
};
} forEach _arrayComp;
};
} forEach [["magazines", "Magazines"], ["attachments", "Attachments"]];
};
} forEach (getArray (MAVV(Cfg) >> _cat));
};
default {
{
_x params ["_class", "_price", "_condition", "_display"];

if (call compile _condition) then {
(_class call MAV_shop_fnc_itemInfo) params ["_itemName", "_itemPicture"];
private _weaponName = [_display, _itemName] select (_display isEqualTo "");
private _weaponIndex = _ctrlTV tvAdd [[], _weaponName];
_ctrlTV tvSetPicture [[_weaponIndex], _itemPicture];
_ctrlTV tvSetData [[_weaponIndex], str ([_class, _price, _display])];
_ctrlTV tvSetValue [[_weaponIndex], _price];
};
} forEach (getArray (MAVV(Cfg) >> _cat));
};
};

if (_ctrlTV tvCount [] isEqualTo 0) then {
_ctrlTV tvAdd [[], getText (MAVCFG >> "localization" >> "msgEmptyShop")];
};

_ctrlTV tvSetCurSel [0];

private _enable = _ctrlSelIndex isEqualTo 0;

private _ctrlButtonCollapse = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_COLLAPSE;
_ctrlButtonCollapse ctrlEnable _enable;

private _ctrlButtonExpand = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_EXPAND;
_ctrlButtonExpand ctrlEnable _enable;
};

case "onTreeChanged": {
_params params [
["_ctrlFactoryTreeView", controlNull, [controlNull]],
["_path", [], [[]]]
];

private _display = ctrlParent _ctrlFactoryTreeView;
private _btnAddAction = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_ADD;
private _info = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_INFO;

if (ctrlShown _btnAddAction) then {
_btnAddAction ctrlRemoveAllEventHandlers "ButtonClick";
_btnAddAction ctrlShow false;
};

private _data = _ctrlFactoryTreeView tvData _path;

if (_data isEqualTo "") exitWith {
_info ctrlSetStructuredText parseText "";
};

(parseSimpleArray _data) params ["_className", "_price"];

private _afford = (MAVV(Total) + _price) > CASH;

_info ctrlSetStructuredText parseText format [getText (MAVCFG >> "localization" >> "msgInfoText"), (["#1CFF0B", "#D01700"] select _afford), [_price] call BIS_fnc_numberText, SYMBOL];

if !(isClass (configFile >> "CfgMagazines" >> _className)) then {
clearWeaponCargo MAVV(Holder);
MAVV(Holder) addWeaponCargo [_className, 1];
MAVV(Holder) setVectorDirAndUp [[0, 0, 1], [0, -1, 0]];
MAVV(Logic) setVectorUp [0, 0, 1];
MAVV(Logic) setDir 18;
};

if !(_afford) then {
_btnAddAction ctrlAddEventHandler ["ButtonClick", {["add", _this] call MAVFNC}];
_btnAddAction ctrlShow true;
};
};
case "add": {
if (MAVV(Spam) > diag_tickTime) exitWith {};
MAVV(Spam) = diag_tickTime + 0.3;

_params params [
["_ctrlAddBtn", controlNull, [controlNull]]
];

if (count MAVV(Cart) isEqualTo getNumber (MAVV(Cfg) >> "maxCart")) exitWith {
titleText [getText (MAVCFG >> "localization" >> "msgCartFull"), "PLAIN", 0.5];
};

private _display = ctrlParent _ctrlAddBtn;
private _tvList = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TREE;
private _cartList = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_LIST;
private _cartTitle = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TOTAL;
private _completeBtn = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_COMPLETE;

private _tvIndex = tvCurSel _tvList;
private _tvData = _tvList tvData _tvIndex;

if (_tvData isEqualTo "") exitWith {};

(parseSimpleArray _tvData) params ["_className", "_price", "_itemDisplay"];

(_className call MAV_shop_fnc_itemInfo) params ["_itemName", "_itemPicture"];
private _header = [_itemDisplay, _itemName] select (_itemDisplay isEqualTo "");

private _index = _cartList lbAdd _header;
_cartList lbSetData [_index, _className];
_cartList lbSetValue [_index, _price];
_cartList lbSetPicture [_index, _itemPicture];

MAVV(Cart) pushBack [toLower _className, _price];
MAVV(Total) = MAVV(Total) + _price;

_cartTitle ctrlSetText format [getText (MAVCFG >> "localization" >> "msgCartTotal"), SYMBOL, [MAVV(Total)] call BIS_fnc_numberText];

if (!(lbSize _cartList isEqualTo 0) && {!(ctrlShown _completeBtn)}) then {
_completeBtn ctrlAddEventHandler ["ButtonClick", {["complete", _this] call MAVFNC}];
_completeBtn ctrlShow true;
};

_tvList tvSetCurSel _tvIndex;
};

case "remove": {
if (MAVV(Spam) > diag_tickTime) exitWith {};
MAVV(Spam) = diag_tickTime + 0.3;

_params params [
["_cartList", controlNull, [controlNull]],
["_index", -1, [0]]
];

if (_index isEqualTo -1) exitWith {};

private _display = ctrlParent _cartList;
private _value = _cartList lbValue _index;

MAVV(Cart) deleteAt _index;
_cartList lbDelete _index;

MAVV(Total) = MAVV(Total) - _value;

private _cartTitle = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TOTAL;
_cartTitle ctrlSetText format [getText (MAVCFG >> "localization" >> "msgCartTotal"), SYMBOL, [MAVV(Total)] call BIS_fnc_numberText];

if (lbSize _cartList isEqualTo 0) then {
private _completeBtn = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_COMPLETE;
_completeBtn ctrlRemoveAllEventHandlers "ButtonClick";
_completeBtn ctrlShow false;
};

private _tvList = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_TREE;
_tvList tvSetCurSel (tvCurSel _tvList);
};

case "complete": {
if (MAVV(Spam) > diag_tickTime) exitWith {};
MAVV(Spam) = diag_tickTime + 1;

_params params [
["_completeBtn", controlNull, [controlNull]]
];

private _display = ctrlParent _completeBtn;

if (isNull _display) exitWith {};

if (MAVV(Cart) isEqualTo []) exitWith {
hint getText (MAVCFG >> "localization" >> "msgCartEmpty");
};

if (MAVV(Total) > CASH) exitWith {
hint getText (MAVCFG >> "localization" >> "msgNotEnoughCash");
};

private _override = cbChecked (_display displayCtrl MAV_IDC_GUIWEAPONSHOP_CHECK);
private _cash = 0;
private _global = false;
private _added = false;

{
_x params ["_item", "_price"];
if ([_item, _override] call MAV_shop_fnc_handleGear) then {
_cash = _cash + _price;
_added = true;
} else {
_global = true;
};
} count (MAVV(Cart) select {_x param [0] isEqualType "" && {!(_x param [0] isEqualTo "")}});

_display closeDisplay 1;

if (_cash isEqualTo 0 && {!_added}) exitWith {
hint getText (MAVCFG >> "localization" >> "msgOverrideAlert");
};

missionNamespace setVariable [getText (MAVCFG >> "cashVar"), (CASH - _cash)];
hint format [getText (MAVCFG >> "localization" >> "msgTransactionComplete"), SYMBOL, [_cash] call BIS_fnc_numberText];
[True,0,_price] Call RJM_fnc_AtualizarGrana;

if (_global) then {
hint getText (MAVCFG >> "localization" >> "msgNotEnoughSpace");
};

call compile getText (MAVCFG >> "saveFunction");

If (IsNil "RJ_DiscordAtivo" || !_logar || (PlayerSide IsEqualTo Independent)) exitWith {};
If (_item In ["Rangefinder","Binocular","NVGoggles","FirstAidKit","ItemGPS"]) exitWith {};

If (RJ_ItemsComprados IsEqualTo []) Then {
[] Spawn {
Private ["_price","_item","_count","_contados"];
_contados = [];
UiSleep 4;
{
_price = _X Select 0;
_item = _X Select 1;

If !(_item In _contados) Then {
_contados PushBack _item;
_count = {_item IsEqualTo (_X Select 1)} Count RJ_ItemsComprados;
_price = _price * _count;
_item = If (isClass(MAVCFG >> "shops" >> _item)) Then {getText(MAVCFG >> "shops" >> _item >> "displayName")} Else {getText(MAVCFG >> "shops" >> _item >> "displayName")};
RJ_DiscordLog = [0,[profileName,getPlayerUid player,_price,_item,_count]];
PublicVariableServer "RJ_DiscordLog";
};
} ForEach RJ_ItemsComprados;
RJ_ItemsComprados = [];
};
};

RJ_ItemsComprados PushBack [_price,_item];
};

case "onKeyUp": {
_params params ["_ctrl"];
private _display = ctrlParent _ctrl;
private _searchBtn = _display displayCtrl MAV_IDC_GUIWEAPONSHOP_SEARCHBTN;
private _ctrlText = ctrlText _ctrl isEqualTo "";
_searchBtn ctrlSetText (["\a3\3DEN\Data\Displays\Display3DEN\search_end_ca.paa", "\a3\3DEN\Data\Displays\Display3DEN\search_start_ca.paa"] select _ctrlText);
_searchBtn ctrlSetTooltip ([getText (MAVCFG >> "localization" >> "msgClear"), getText (MAVCFG >> "localization" >> "msgSearch")] select _ctrlText);
};

case "onSearch": {
private _ctrl = ctrlParent (_params param [0]) displayCtrl MAV_IDC_GUIWEAPONSHOP_SEARCH;
_ctrl ctrlSetText "";
["onKeyUp", [_ctrl]] call MAVFNC;
};

case "onCollapse": {
tvCollapseAll (ctrlParent (_params param [0]) displayCtrl MAV_IDC_GUIWEAPONSHOP_TREE);
};

case "onExpand": {
tvExpandAll (ctrlParent (_params param [0]) displayCtrl MAV_IDC_GUIWEAPONSHOP_TREE);
};

case "onUnload": {
if !(isNil MAVQ(Light)) then {
deleteVehicle MAVV(Light);
MAVV(Light) = nil;
};

MAVV(Cart) = nil;
MAVV(Total) = nil;
MAVV(Cfg) = nil;
MAVV(Type) = nil;
MAVV(Spam) = nil;
MAVV(Mouse) = nil;

deleteVehicle MAVV(Logic);
MAVV(Logic) = nil;

clearWeaponCargo MAVV(Holder);
deleteVehicle MAVV(Holder);
MAVV(Holder) = nil;

MAVV(Camera) cameraEffect ["TERMINATE", "BACK"];
camDestroy MAVV(Camera);
MAVV(Camera) = nil;

deleteVehicle MAVV(Building);
MAVV(Building) = nil;

showChat true;
0 fadeSound MAVV(Sound);
MAVV(Sound) = nil;
};
};
[/CODE]
 
J'enverrai le journal du magasin de véhicules et du magasin de produits qui fonctionne.

Code:
/*
    Author: Louis Wood
    Website: www.the-programmer.com
    Discord: discord.the-programmer.com

    Terms of use:
        - This file is forbidden unless you have permission from the author. If you have this file without permission to use it please do not use it and do not share it.
        - If you have permission to use this file, you can use it on your server however it is strictly forbidden to share it.
        - Out of respect for the author please do not delete this information.
*/
if (isNull (findDisplay 1416)) exitWith {};

_fn_changeTexture = {
    params ["_index"];

    private _display = findDisplay 1416;
    private _vehicle = _display getVariable "CameraTargetVS";

    private _exit = if (_index isEqualTo 0) then {
        if ((lbText [567, 0]) isEqualTo ("    " + (["STR_NO_TEXTURE_AVAILABLE","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize))) exitWith {true};
        if ((lbText [567, 0]) isEqualTo ("    " + (["STR_CUSTOM_PAINT","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize))) exitWith {
            if !(ctrlEnabled 550) then {
                ctrlShow [555, false];
                ctrlShow [556, false];
                ctrlShow [506, true];
                ctrlShow [507, true];
                ctrlShow [508, true];
                ctrlShow [509, true];
                ctrlShow [510, true];

                {
                    ctrlEnable [_x, true];
                } forEach [511,512,513,550,551,552,553,554];
            };

            {
                _vehicle setObjectTexture [_forEachIndex, _x];
            } forEach (_display getVariable "DefaultTexturesVS");

            (_display getVariable "RGBVS") params ["_R", "_G", "_B"];

            _R = linearConversion [0, 255, _R, 0, 1];
            _G = linearConversion [0, 255, _G, 0, 1];
            _B = linearConversion [0, 255, _B, 0, 1];

            _vehicle setObjectTexture [0, format ["#(rgb,8,8,3)color(%1,%2,%3,1)", _R, _G, _B]];

            true
        };
        false
    } else {false};

    if (_exit) exitWith {};
    ctrlShow [556, false];

    if (ctrlEnabled 550) then {
        ctrlShow [506, false];
        ctrlShow [507, false];
        ctrlShow [508, false];
        ctrlShow [509, false];
        ctrlShow [510, false];
        ctrlShow [555, true];


        {
            ctrlEnable [_x, false];
        } forEach [511,512,513,550,551,552,553,554];
    };

    {
        _vehicle setObjectTexture [_forEachIndex, _x];
    } forEach (_display getVariable "DefaultTexturesVS");

    {
        _vehicle setObjectTexture [_forEachIndex, _x];
    } forEach (call compile (lbData [567, _index]));
};

_fn_set_description = {
    params ["_oldClassName", "_className"];

    private _display = findDisplay 1416;
    private _config = configFile >> "CfgVehicles" >> _className;
    private _descCtrlMin = _display getVariable "DescCtrlMinVS";
    private _descCtrlStart = _descCtrlMin;
    private _oldType = (_oldClassName isKindOf "Air") || (_oldClassName isKindOf "Ship");
    private _air = _className isKindOf "Air";
    private _ship = _className isKindOf "Ship";
    private _type = _air || _ship;

    if (_type) then {
        _descCtrlStart = if (_air) then {_descCtrlStart + 2} else {_descCtrlStart + 1};
    };

    if ((_oldClassName isEqualTo "") || (_type != _oldType)) then {      
        if (_display getVariable "FilterVS") then {[false] call tp_vehicleshop_tpfn_vehicleShopFilterButton};

        if (_oldClassName != "") then {
            private _pos = if (_type) then {
                for "_i" from 517 to 525 do {
                    ctrlShow [_i, false];
                };

                -0.135667 * safeZoneH
            } else {0.135667 * safeZoneH};

            private _ctrl = _display displayCtrl 514;
            (ctrlPosition _ctrl) params ["_Px", "_Py", "_W", "_H"];
            _ctrl ctrlSetPosition [_Px, _Py, _W, _H + _pos];
            _ctrl ctrlCommit 0;

            {
                _ctrl = _display displayCtrl _x;
                (ctrlPosition _ctrl) params ["_Px", "_Py"];
                _ctrl ctrlSetPosition [_Px, _Py + _pos];
                _ctrl ctrlCommit 0;
            } forEach [515, 526, 527, 528, 529, 530, 531, 532];
        };

        if ((_display getVariable "FilterDepVS") && ((!_type) && (!(ctrlShown (_display displayCtrl 525))))) then {
            for "_i" from 517 to 525 do {
                ctrlShow [_i, true];
            };
        };

        (_display displayCtrl 535) ctrlSetPosition [0.801015 * safezoneW + safezoneX, ([0.621529, 0.64375, 0.665973, 0.688195, 0.710417, 0.732639] select (_descCtrlStart - 557)) * safezoneH + safezoneY];
        (_display displayCtrl 567) ctrlSetPosition [0.801015 * safezoneW + safezoneX, 0.307639 * safezoneH + safezoneY, 0.197656 * safezoneW, 0.311585 * safezoneH + ((_descCtrlStart - 557) * (0.02222 * safezoneH))];

        (_display displayCtrl 535) ctrlCommit 0;
        (_display displayCtrl 567) ctrlCommit 0;

        private _nameCtrlIndex = if (_descCtrlStart isEqualTo 557) then {538} else {_descCtrlStart - 1};
        private _nameCtrlPos = if (_nameCtrlIndex isEqualTo 538) then {[0.801015 * safezoneW + safezoneX, 0.653472 * safezoneH + safezoneY]} else {ctrlPosition (_display displayCtrl _nameCtrlIndex)};
        private _cmpt = _descCtrlStart;

        ctrlShow [538, false];

        for "_i" from _descCtrlMin to _descCtrlStart do {
            ctrlShow [_i, false];
            ctrlShow [_i - 18, false];
        };

        (_display displayCtrl 538) ctrlSetPosition [_nameCtrlPos select 0, _nameCtrlPos select 1];
        (_display displayCtrl 538) ctrlCommit 0;

        ctrlShow [538, true];
        ctrlShow [_descCtrlStart, true];
        ctrlShow [_descCtrlStart - 18, true];
        ctrlShow [_descCtrlStart + 1, true];
        ctrlShow [_descCtrlStart - 17, true];

        (_display displayCtrl _cmpt) ctrlSetText (["STR_MAXIMUM_SPEED","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize);
        _cmpt = _cmpt + 1;

        (_display displayCtrl _cmpt) ctrlSetText (["STR_NUMBER_OF_SEATS","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize);
        _cmpt = _cmpt + 1;

        if !(_air) then {
            (_display displayCtrl _cmpt) ctrlSetText (["STR_ENIGNE_POWER","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize);
            _cmpt = _cmpt + 1;
        };

        if !(_type) then {
            (_display displayCtrl _cmpt) ctrlSetText (["STR_ENIGNE_TORQUE","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize);
        };
    };
   
    private _cmpt = _descCtrlStart - 18;

    (_display displayCtrl 538) ctrlSetText getText (_config >> "displayName");

    (_display displayCtrl _cmpt) ctrlSetText format ["%1 km/h", getNumber (_config >> "maxSpeed")];
    _cmpt = _cmpt + 1;

    (_display displayCtrl _cmpt) ctrlSetText str (getNumber (_config >> "transportSoldier") + count ("true" configClasses (_config >> "Turrets")) + 1);
    _cmpt = _cmpt + 1;

    if !(_air) then {
        (_display displayCtrl _cmpt) ctrlSetText format ["%1 %2", getNumber (_config >> "enginePower"), (["STR_HP","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize)];
        _cmpt = _cmpt + 1;
    };

    if !(_type) then {
        (_display displayCtrl _cmpt) ctrlSetText format ["%1 Nm", getNumber (_config >> "peakTorque")];
        _cmpt = _cmpt + 1;
    };

    (_display displayCtrl _cmpt) ctrlSetText format ["%1 L", (if ((getNumber (missionConfigFile >> "The_Programmer_Vehicle_Shop" >> "physical_trunk_capacity")) isEqualTo 1) then {getNumber (_config >> "maximumLoad")} else {getNumber (missionConfigFile >> "LifeCfgVehicles" >> _className >> "vItemSpace")})];
    _cmpt = _cmpt + 1;

    (_display displayCtrl _cmpt) ctrlSetText format ["%1 L", getNumber (_config >> "fuelCapacity")];
    _cmpt = _cmpt + 1;

    if (["Max_Settings_FuelStations"] call theprogrammer_core_fnc_isProductInstalled) then {
        (_display displayCtrl _cmpt) ctrlSetText ([_className,true] call max_fuelstations_fnc_getFuelType);
        _cmpt = _cmpt + 1;
    };

    if (["Stock_System_Config"] call theprogrammer_core_fnc_isProductInstalled) then {
        _rarityItem = ["vehicles", _className] call stock_system_fnc_getRarityItem;

        if ((count _rarityItem) > 0) then {
            (_display displayCtrl _cmpt) ctrlSetText str (_rarityItem select 0);
        } else {
            (_display displayCtrl _cmpt) ctrlSetText (["STR_STOCK_UNLIMITED","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize);
        };
    };
};

_fn_headlight = {
    private _display = findDisplay 1416;
    private _texturesPath = getText (missionConfigFile >> "The_Programmer_Vehicle_Shop" >> "textures_base_path");
    private _vehicle = _display getVariable "CameraTargetVS";
    private _state = lightIsOn _vehicle;
    private _picture = if (_state isEqualTo "ON") then {_texturesPath + "\light_on.paa"} else {_texturesPath + "\light_off.paa"};
    private _tooltip = if (_state isEqualTo "ON") then {(["STR_TURN_ON_HEADLIGHTS","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize)} else {(["STR_TURN_OFF_HEADLIGHTS","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize)};

    _vehicle switchLight (if (_state isEqualTo "ON") then {"OFF"} else {"ON"});
    (_display displayCtrl 549) ctrlSetText _picture;
    (_display displayCtrl 549) ctrlSetTooltip _tooltip;
};

_fn_buy = {
    params ["_mode"];

    private _display = findDisplay 1416;
    private _index = _display getVariable "ButtonIndexVS";
    private _vehicle = (_display getVariable "CurrentVehiclesVS") select _index;
    private _className = _vehicle select 0;
    private _price = if (_mode) then {_vehicle select 3} else {_vehicle select 4};
    private _configMission = missionConfigFile >> "LifeCfgVehicles" >> _className;
    private _customPaint = ((getNumber (_configMission >> "customPaint")) isEqualTo 1);
    private _conditions = getText (_configMission >> "conditions");
    private _otherCondition = if (_mode) then {_vehicle select 5} else {_vehicle select 6};

    _canBuy = true;
    if ((["Stock_System_Config"] call theprogrammer_core_fnc_isProductInstalled) && _mode) then {
        _rarityItem = ["vehicles", _className] call stock_system_fnc_getRarityItem;
        _canBuy = [_rarityItem, true] call stock_system_fnc_actionCanBuyRareItem;
        _price = [_rarityItem, _price] call stock_system_fnc_getRarityItemPrice;
    };
    //-------------------CADNALEX-------------------//
    Private _SidesComDesconto = GetText(MissionConfigFile >> "RJ_CfgDoadores" >> "RJ_SidesComDesconto");

    _SidesComDesconto = Call Compile _SidesComDesconto;

    If (PlayerSide In _SidesComDesconto && RJ_NivelDoador > 0) Then {
    _buyMultiplier = GetNumber(MissionConfigFile >> "RJ_CfgDoadores" >> Format["RJ_DescontoVeiculosDoador_%1",RJ_NivelDoador]);
   
    _price = round(_price * _buyMultiplier);
    };
    //-------------------CADNALEX-------------------//
    if !(_canBuy) exitWith {};
    if (((_conditions != "") && (!(call compile _conditions))) || (!_otherCondition)) exitWith {};
    //
    if (_price >= 20000) Then {["VehiclePurchased"] spawn mav_ttm_fnc_addExp};
    //-------------------CADNALEX-------------------//
    private _spawns = _display getVariable "SpawnsVS";
    private _spawnBlocked = true;
    private _spawn = "";

    {
        if ((count (nearestObjects [(getMarkerPos _x), ["Car","Ship","Air"], 5])) isEqualTo 0) exitWith {_spawn = _x; _spawnBlocked = false};
    } forEach _spawns;

    if (_spawnBlocked) exitWith {closeDialog 0; hint (["STR_DELIVERY_LOCATION","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize)};

    private _exit = if ((["The_Programmer_BankingSystem"] call theprogrammer_core_fnc_isProductInstalled) && ((getNumber (missionConfigFile >> "The_Programmer_Vehicle_Shop" >> "can_pay_by_card")) isEqualTo 1)) then {
        _handle = [_price] spawn the_programmer_bank_system_fnc_paymentType;
        waitUntil {scriptDone _handle};

        no_money;
    } else {
        //-------------------CADNALEX-------------------//
        if (RJM_GRANA < _price) exitWith {true;};

        [True,0,_price] Call RJM_fnc_AtualizarGrana;
        [0] call SOCK_fnc_updatePartialRJ;

        false;
        //-------------------CADNALEX-------------------//
    };

    if (_exit) exitWith {closeDialog 0;};

    _vehicle = createVehicle [_className, (getMarkerPos _spawn), [], 0, "NONE"];
    _vehicle allowDamage false;
    _vehicle setPos (getMarkerPos _spawn);
    _vehicle setVectorUp (surfaceNormal (getMarkerPos _spawn));
    _vehicle setDir (markerDir _spawn);
    _vehicle lock 2;

    private _index = lbCurSel 567;
    private _color = [];

    private _texture = if (_index isEqualTo 0) then {
        if ((lbText [567, 0]) isEqualTo ("    " + (["STR_NO_TEXTURE_AVAILABLE","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize))) exitWith {false};
        if ((lbText [567, 0]) isEqualTo ("    " + (["STR_CUSTOM_PAINT","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize))) exitWith {
            private _RGB = _display getVariable "RGBVS";

            _RGB params ["_R", "_G", "_B"];

            _R = linearConversion [0, 255, _R, 0, 1];
            _G = linearConversion [0, 255, _G, 0, 1];
            _B = linearConversion [0, 255, _B, 0, 1];

            _vehicle setObjectTextureGlobal [0, format ["#(rgb,8,8,3)color(%1,%2,%3,1)", _R, _G, _B]];

            _color = _RGB;

            false
        };
        true
    } else {true};

    if (_texture) then {
        private _textures = call compile (lbData [567, _index]);

        {
            _vehicle setObjectTextureGlobal [_forEachIndex, _x];
            _color pushBack (_x regexReplace ["\\", "\\\\"]);
        } forEach _textures;
    };

    [_vehicle] call life_fnc_clearVehicleAmmo;
   
    _vehicle setVariable ["trunk_in_use",false,true];
    _vehicle setVariable ["vehicle_info_owners",[[getPlayerUID player,profileName]],true];

    _vehicle disableTIEquipment true;

    switch (playerSide) do {
        case west: {
            [_vehicle,"cop_offroad",true] spawn life_fnc_vehicleAnimate;
        };
        case civilian: {
            if (_className == "B_Heli_Light_01_F") then {
                [_vehicle,"civ_littlebird",true] spawn life_fnc_vehicleAnimate;
            };
        };
        case independent: {
            [_vehicle,"med_offroad",true] spawn life_fnc_vehicleAnimate;
        };
    };

    _vehicle allowDamage true;

    life_vehicles pushBack _vehicle;

    [getPlayerUID player, playerSide, _vehicle, 1] remoteExecCall ["TON_fnc_keyManagement", 2];

    if (_mode) then {
        [getPlayerUID player, playerSide, _vehicle, _color] remoteExecCall ["TON_fnc_vehicleCreate", 2];
    };

    if (["Max_Settings_Immatriculation"] call theprogrammer_core_fnc_isProductInstalled) then {
        [_mode,_vehicle] spawn max_immat_fnc_vehicleBuyImmatriculation;
    };

    if (["Max_Settings_GiveVehicle"] call theprogrammer_core_fnc_isProductInstalled) then {
        _vehicle setVariable ["vehicle_has_keys",[(getPlayerUID player)],true];
    };

    if ((["Stock_System_Config"] call theprogrammer_core_fnc_isProductInstalled) && _mode) then {
        ["vehicles",_className, "-"] remoteExec ["stock_system_fnc_updateCopiesLeft",2];
    };

    if ((getNumber (missionConfigFile >> "The_Programmer_Vehicle_Shop" >> "enable_logs")) isEqualTo 1) then {
        advanced_log = format [(["STR_MONEY_LOG","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize), profileName, (getPlayerUID player), _className, [_price] call theprogrammer_core_fnc_numberToText, [RJM_GRANA] call theprogrammer_core_fnc_numberToText, [RJM_BANCO] call theprogrammer_core_fnc_numberToText, systemTime select 2, systemTime select 1, systemTime select 0, systemTime select 3, systemTime select 4, systemTime select 5];
        publicVariableServer "advanced_log";
    };
    //-------------------CADNALEX-------------------//
    If (IsNil "RJ_DiscordAtivo" || !(PlayerSide IsEqualTo Civilian)) exitWith {};

    RJ_DiscordLog = [2,[profileName,getPlayerUid player,_price,(getText(configFile >> "CfgVehicles" >> _className >> "displayName")),0]];
    PublicVariableServer "RJ_DiscordLog";
    //-------------------CADNALEX-------------------//

    if (_mode) then {
        hint format [(["STR_VEHICLE_BOUGHT","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize), getText(configFile >> "CfgVehicles" >> _className >> "displayName"), [_price] call theprogrammer_core_fnc_numberToText];
    } else {
        hint format [(["STR_VEHICLE_RENTED","The_Programmer_Vehicle_Shop","VehicleShop_Localization"] call theprogrammer_core_fnc_localize), getText(configFile >> "CfgVehicles" >> _className >> "displayName"), [_price] call theprogrammer_core_fnc_numberToText];
    };

    closeDialog 0;
};

private _function = _this select 0;
call compile _function;

la partie faisant référence au discord log est de la ligne 372 à 377
il utilise cette structure pour monter le journal sur discord

Code:
/*

    Author: RobérioJr

*/

private _text = "Script Fudido";
private _cor = "caaed6";

switch (_this select 4) do {
    case 0: {_text = "Compra";_cor = "0049FF"};
    case 1: {_text = "Venda";_cor = "fd1010"};
    case 2: {_text = "Seguro";_cor = "4ada76"};
};

[
    "CompraV",
    "",
    "",
    "",
    false,
    [
        [
            _text,
            "",
            "",
            _cor,
            true,
            "",
            "",
            [],
            [],
            [
                ["Jogador",format["%1 (%2)",_this select 0,_this select 1],false],
                ["Veiculo",format["%1",_this select 3],true],
                ["Valor",format["%1",[_this select 2] Call life_fnc_numberText],true]
            ]
        ]
    ]
] call DiscordEmbedBuilder_fnc_buildSqf;

magasin de produits

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

    Description:
    Buy a virtual item from the store.
*/
private ["_type","_price","_amount","_diff","_name","_hideout"];
if ((lbCurSel 2401) isEqualTo -1) exitWith {hint localize "STR_Shop_Virt_Nothing"};
_type = lbData[2401,(lbCurSel 2401)];
_price = lbValue[2401,(lbCurSel 2401)];
_amount = ctrlText 2404;

if (!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";};

_diff = [_type,parseNumber(_amount),life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
_amount = parseNumber(_amount);

if (_diff <= 0) exitWith {hint localize "STR_NOTF_NoSpace"};

_amount = _diff;

private _altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _EusaArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _hideoutObjs = [[["Altis", _altisArray], ["Tanoa", _tanoaArray], ["Eusa", _EusaArray]]] call TON_fnc_terrainSort;

_hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;

Private _ValorDinamico = (MissionNamespace GetVariable [Format["item_%1",_type],[0,0]]) Select 1;

If !(_ValorDinamico IsEqualTo 0) Then {_price = _ValorDinamico};

If ((RJ_TrafArmas || RJ_TrafItems) && _type in ["couro","polvora1","polvora2","componentes1","componentes2"]) Then {_price = Round(_price * 0.35)};

if ((_price * _amount) > CASH && {!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") <= _price * _amount}}) exitWith {hint localize "STR_NOTF_NotEnoughMoney"};
if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay"};
life_action_delay = time;

_name = M_CONFIG(getText,"VirtualItems",_type,"displayName");

if ([true,_type,_amount] call life_fnc_handleInv) then {
    if (!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") >= _price}) then {
        _action = [
            format [(localize "STR_Shop_Virt_Gang_FundsMSG")+ "<br/><br/>" +(localize "STR_Shop_Virt_Gang_Funds")+ " <t color='#8cff9b'>$%1</t><br/>" +(localize "STR_Shop_Virt_YourFunds")+ " <t color='#8cff9b'>$%2</t>",
                [(group player getVariable "gang_bank")] call life_fnc_numberText,
                [CASH] call life_fnc_numberText
            ],
            localize "STR_Shop_Virt_YourorGang",
            localize "STR_Shop_Virt_UI_GangFunds",
            localize "STR_Shop_Virt_UI_YourCash"
        ] call BIS_fnc_guiMessage;
        if (_action) then {
            hint format [localize "STR_Shop_Virt_BoughtGang",_amount,(localize _name),[(_price * _amount)] call life_fnc_numberText];
            _funds = group player getVariable "gang_bank";
            _funds = _funds - (_price * _amount);
            group player setVariable ["gang_bank",_funds,true];

            if (life_HC_isActive) then {
                [1,group player] remoteExecCall ["HC_fnc_updateGang",HC_Life];
            } else {
                [1,group player] remoteExecCall ["TON_fnc_updateGang",RSERV];
            };

        } else {
            if ((_price * _amount) > CASH) exitWith {[false,_type,_amount] call life_fnc_handleInv; hint localize "STR_NOTF_NotEnoughMoney";};
            hint format [localize "STR_Shop_Virt_BoughtItem",_amount,(localize _name),[(_price * _amount)] call life_fnc_numberText];
            [True,0,(_price * _amount)] Call RJM_fnc_AtualizarGrana;
        };
    } else {
        If (life_inv_cartaocredito > 0) Then {
            if ((_price * _amount) > BANK) exitWith {hint localize "STR_NOTF_NotEnoughMoney"; [false,_type,_amount] call life_fnc_handleInv;};
            [False,0,(_price * _amount)] Call RJM_fnc_AtualizarGrana;
            [format [localize "STR_Shop_Virt_BoughtItemCartao",(localize _name),[(_price * _amount)] call life_fnc_numberText]] Call RJM_fnc_Notificar;
        } Else {
            if ((_price * _amount) > CASH) exitWith {hint localize "STR_NOTF_NotEnoughMoney"; [false,_type,_amount] call life_fnc_handleInv;};
            [True,0,(_price * _amount)] Call RJM_fnc_AtualizarGrana;
            [format [localize "STR_Shop_Virt_BoughtItem",(localize _name),[(_price * _amount)] call life_fnc_numberText]] Call RJM_fnc_Notificar;
        };
    };
    [] call life_fnc_virt_update;
};

[3] call SOCK_fnc_updatePartialRJ;

If (IsNil "RJ_DiscordAtivo" || !(PlayerSide IsEqualTo Civilian)) exitWith {};
If (_type In ["waterBottle","tbacon","pickaxe","machado","redgull","toolkit","fuelFull","farinha","cocacola","chocolate","donuts","pizza","ruffles"]) exitWith {};

If (RJ_ItemsVComprados IsEqualTo []) Then {
    [] Spawn {
        Private ["_price","_item","_count","_contados"];
        _contados = [];
        UiSleep 3;
        {  
            _price = _X Select 0;
            _item = _X Select 1;
           
            If !(_item In _contados) Then {
                _count = {_item IsEqualTo (_X Select 1)} Count RJ_ItemsVComprados;
                _price = _price * _count;
                RJ_DiscordLog = [0,[profileName,getPlayerUid player,_price,localize (getText(missionConfigFile >> "VirtualItems" >> _item >> "displayName")),_count]];
                PublicVariableServer "RJ_DiscordLog";
                _contados PushBack _item;
            };
        } ForEach RJ_ItemsVComprados;
        RJ_ItemsVComprados = [];
    };
};

For "_i" From 1 To _amount Do {RJ_ItemsVComprados PushBack [Round(_price/_amount),_type]};

la partie faisant référence à discordlog est de la ligne 87 à 111

il utilise cette structure pour monter le journal sur discord

Code:
/*



    Author: RobérioJr



*/



[

    "CompraI",

    "",

    "",

    "",

    false,

    [

        [

            "",//"Compra De Item"

            "",

            "",

            "0049FF",

            true,

            "",

            "",

            [],

            [],

            [

                ["Jogador",format["%1 (%2)",_this select 0,_this select 1],false],

                ["Item",format["%1 (%2)",_this select 3,_this select 4],true],

                ["Valor",format["%1",[_this select 2] Call life_fnc_numberText],true]

            ]

        ]

    ]

] call DiscordEmbedBuilder_fnc_buildSqf;

résultat
 

Fichiers joints

  • res1.png
    res1.png
    11.7 KB · Affichages: 14
  • res2.png
    res2.png
    14.3 KB · Affichages: 14
Il faudrait insérer ce code au bon endroit :
Code:
RJ_DiscordLog = [0,[profileName,getPlayerUid player,_price,_item,_count]];
PublicVariableServer "RJ_DiscordLog";

Mais je ne connais pas le fonctionnement de votre weaponshop.
Le plus simple serait de poser la question au développeur de ce script directement, c'est son rôle de vous aider là dessus :)
 
il n'y a plus de support le site que j'ai acheté n'existe plus.
J'ai édité le fichier et une partie fonctionne.
J'ai aussi mis le système de log que j'ai trouvé ici sur le forum pour avoir une comparaison.(https://forum.the-programmer.com/po...ions-des-joueurs-dans-la-base-de-données.338/)
le problème que j'ai maintenant est que dans le magasin, je peux acheter plusieurs articles à la fois, mais un seul apparaît dans le journal.
[CODE title="pièce modifiée"]{
_x params ["_item", "_price"];
if ([_item, _override] call MAV_shop_fnc_handleGear) then {
["compra armas",format ["O jogador: %1 id: %2 comprou: %3 por %4",profileName,(getPlayerUid player),_item,_price]] remoteExec ["TON_fnc_insertLog",2];
If (RJ_ItemsComprados IsEqualTo []) Then {
[] Spawn {
Private ["_price","_item","_count","_contados"];
_contados = [];
UiSleep 4;
{
_price = _X Select 0;
_item = _X Select 1;

If !(_item In _contados) Then {
_contados PushBack _item;
_count = {_item IsEqualTo (_X Select 1)} Count RJ_ItemsComprados;
_price = _price * _count;
RJ_DiscordLog = [0,[profileName,getPlayerUid player,_price,_item,_count]];
PublicVariableServer "RJ_DiscordLog";
};
} ForEach RJ_ItemsComprados;
RJ_ItemsComprados = [];
};
};

RJ_ItemsComprados PushBack [_price,_item];
};
} count (MAVV(Cart) select {_x param [0] isEqualType "" && {!(_x param [0] isEqualTo "")}});[/CODE]
 
Je mets le journal sur tout sur mon serveur, tout a fonctionné mais j'ai un problème avec ce script.
[CODE title="fn_derrubarItens.sqf"]#include "..\..\script_macros.hpp"
/*
File: fn_dropItems.sqf
Author: Bryan "Tonic" Boardwine

Description:
Called on death, player drops any 'virtual' items they may be carrying.
*/

private ["_obj","_unit","_item","_value"];
_unit = _this select 0;

Private _ins = lineIntersectsSurfaces [
AGLtoASL (player modelToWorld [0,0.5,0]),
AGLtoASL (player modelToWorld [0,0.5,-100]),
vehicle player
];

Private _pos = if ((count _ins) IsEqualTo 0 || !(IsNull ObjectParent Player)) Then {
Private _Temp = player modelToWorld [2.8,0,0];
[(_Temp select 0),(_Temp select 1),0]
} Else {
(_ins select 0 select 0)
};

{
if (_x isEqualType "") then {_item = _x;} else {_item = configName _x};
_value = ITEM_VALUE(_item);
_itemName = ITEM_VARNAME(_item);

switch (_item) do {
case "waterBottle": {
if (_value > 0) then {
_obj = "Land_BottlePlastic_V1_F" createVehicle _pos;
//_obj setVariable ["water",_value,true];
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "tbacon": {
if (_value > 0) then {
_obj = "Land_TacticalBacon_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "redgull": {
if (_value > 0) then {
_obj = "Land_Can_V3_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "fuelEmpty": {
if (_value > 0) then {
_obj = "Land_CanisterFuel_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "fuelFull": {
if (_value > 0) then {
_obj = "Land_CanisterFuel_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "coffee": {
if (_value > 0) then {
_obj = "Land_Can_V3_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "RJM_GRANA": {
if (CASH > 0) then {
_obj = "Land_Money_F" createVehicle _pos;
_obj setVariable ["item",["RJ_money",missionNamespace getVariable [_item,0]],true];
_obj setPosASL _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
//missionNamespace setVariable ["CASH",0];
[True,2,0] Call RJM_fnc_AtualizarGrana;
};
};

case "defibrillator": {
if (_value > 0) then {
_obj = "Land_Defibrillator_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "gag": {
if (_value > 0) then {
_obj = "Land_DuctTape_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "cocacola": {
if (_value > 0) then {
_obj = "Land_Can_V2_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "blindfold": {
if (_value > 0) then {
_obj = "Land_FoodSack_01_empty_brown_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "cartaocredito": {
if (_value > 0) then {
missionNamespace setVariable [_itemName,0];
};
};

default {
if (_value > 0) then {
_obj = "Land_Suitcase_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};
};

} forEach (("true" configClasses (missionConfigFile >> "VirtualItems")) + ["RJM_GRANA"]);
RJ_DiscordLog = [19,[profileName,(getPlayerUid player),_itemName,_value]];
PublicVariableServer "RJ_DiscordLog";
[/CODE]
si je l'utilise comme ça, il retourne nil.
[CODE title="fn_derrubarItens.sqf"]#include "..\..\script_macros.hpp"
/*
File: fn_dropItems.sqf
Author: Bryan "Tonic" Boardwine

Description:
Called on death, player drops any 'virtual' items they may be carrying.
*/

private ["_obj","_unit","_item","_value"];
_unit = _this select 0;

Private _ins = lineIntersectsSurfaces [
AGLtoASL (player modelToWorld [0,0.5,0]),
AGLtoASL (player modelToWorld [0,0.5,-100]),
vehicle player
];

Private _pos = if ((count _ins) IsEqualTo 0 || !(IsNull ObjectParent Player)) Then {
Private _Temp = player modelToWorld [2.8,0,0];
[(_Temp select 0),(_Temp select 1),0]
} Else {
(_ins select 0 select 0)
};

{
if (_x isEqualType "") then {_item = _x;} else {_item = configName _x};
_value = ITEM_VALUE(_item);
_itemName = ITEM_VARNAME(_item);

switch (_item) do {
case "waterBottle": {
if (_value > 0) then {
_obj = "Land_BottlePlastic_V1_F" createVehicle _pos;
//_obj setVariable ["water",_value,true];
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "tbacon": {
if (_value > 0) then {
_obj = "Land_TacticalBacon_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "redgull": {
if (_value > 0) then {
_obj = "Land_Can_V3_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "fuelEmpty": {
if (_value > 0) then {
_obj = "Land_CanisterFuel_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "fuelFull": {
if (_value > 0) then {
_obj = "Land_CanisterFuel_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "coffee": {
if (_value > 0) then {
_obj = "Land_Can_V3_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "RJM_GRANA": {
if (CASH > 0) then {
_obj = "Land_Money_F" createVehicle _pos;
_obj setVariable ["item",["RJ_money",missionNamespace getVariable [_item,0]],true];
_obj setPosASL _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
//missionNamespace setVariable ["CASH",0];
[True,2,0] Call RJM_fnc_AtualizarGrana;
};
};

case "defibrillator": {
if (_value > 0) then {
_obj = "Land_Defibrillator_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "gag": {
if (_value > 0) then {
_obj = "Land_DuctTape_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "cocacola": {
if (_value > 0) then {
_obj = "Land_Can_V2_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "blindfold": {
if (_value > 0) then {
_obj = "Land_FoodSack_01_empty_brown_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};

case "cartaocredito": {
if (_value > 0) then {
missionNamespace setVariable [_itemName,0];
};
};

default {
if (_value > 0) then {
_obj = "Land_Suitcase_F" createVehicle _pos;
[_obj] remoteExecCall ["life_fnc_simDisable",RANY];
_obj setPosASL _pos;
_obj setVariable ["item",[_item,_value],true];
missionNamespace setVariable [_itemName,0];
};
};
};
RJ_DiscordLog = [19,[profileName,(getPlayerUid player),_itemName,_value]];
PublicVariableServer "RJ_DiscordLog";
} forEach (("true" configClasses (missionConfigFile >> "VirtualItems")) + ["RJM_GRANA"]);

[/CODE]
si j'utilise comme ça, il renvoie tous les obj virtuels.
ce script fait tomber les objets virtuels au sol lorsque le joueur meurt.
 
Est-ce que c'est la suite de ce post ? Si c'est une autre question tu peux créer un nouveau post, ce sera plus simple pour suivre ;)

Pour les notifications discord c'était résolu finalement ?
encore et sur le notifications discord de sorte que pour un autre script. créer un autre message ?
 
Bonsoir, le sujet est passé comme non solutionné suite à la non réponse au message précédent d'AlphaSlik.