manogar1A 0 Posted January 2, 2020 On my server I have a function to sell. I have made an "array" with this data: sellPrices = //Precios de Venta [ ["RR_Wheat", 50], ["RR_wheatSeeds", 5], ["RR_woodLog", 50], ["RR_Logs", 100], ["RR_Weed", 70], ["RR_cocaineSeeds", 100], ["RR_MushroomSeeds", 100], ["RR_HeroinSeeds", 100], ["RR_weedSeeds", 40], ["RR_weedBag", 350], ["RR_weedGrow2", 70], ["RR_methBag", 500], ["RR_cocaine", 500], ["RR_cocainePlant", 300], ["RR_CocainePicked", 300], ["RR_mushrooms", 95], ["RR_mushroomPlant", 95], ["RR_mushroomPicked", 95], ["RR_coalOre", 50], ["RR_ironOre", 50], ["RR_goldOre", 50], ["RR_diamondOre", 50], ["RR_ironIngot", 520], ["RR_gem_diamond", 30000], ["RR_coal", 350], ["RR_goldIngot", 370], ["RR_steelIngot", 500] ]; and then in another file I put this: _data = lbData [ 1500, ( lbCurSel 1500 ) ]; if (_data isEqualTo (_x select 0)) then { SellPrice = (_x select 1); } foreach HRP_sellPrices; but when he asks for the money he goes to null ¿why? Share this post Link to post Share on other sites
killzone_kid 1326 Posted January 2, 2020 6 hours ago, manogar1A said: and then in another file I put this: This code is incomplete, so it won’t work as is Share this post Link to post Share on other sites
manogar1A 0 Posted January 2, 2020 4 hours ago, killzone_kid said: This code is incomplete, so it won’t work as is HRP_fnc_sellItems = { _data = lbData [ 1500, ( lbCurSel 1500 ) ]; if (_data isEqualTo (_x select 0)) then { SellPrice = _x select 1; } foreach HRP_sellPrices; player removeItem _data; _msg = format ["$%1 ha sido añadido a tu cartera %2", SellPrice,_data]; //[SellPrice] call HRP_fnc_addCash; ["Success", _msg, true] spawn HRP_fnc_Notifications; lbDelete [ 1500, ( lbCurSel 1500 ) ]; }; Share this post Link to post Share on other sites
7erra 629 Posted January 2, 2020 When setting up the dialog you could use lbSetValue to assign a value to each entry with the price from the array. When the player buys an item that value can be returned with lbValue. Share this post Link to post Share on other sites
killzone_kid 1326 Posted January 2, 2020 2 hours ago, 7erra said: When setting up the dialog you could use lbSetValue to assign a value to each entry with the price from the array. When the player buys an item that value can be returned with lbValue. And what is wrong with using lbData like OP did? Share this post Link to post Share on other sites
killzone_kid 1326 Posted January 2, 2020 3 hours ago, manogar1A said: } foreach HRP_sellPrices; This makes no sense Share this post Link to post Share on other sites
manogar1A 0 Posted January 2, 2020 3 minutes ago, killzone_kid said: This makes no sense i edit this before start this post xd Share this post Link to post Share on other sites
manogar1A 0 Posted January 2, 2020 This is my discord, I can pay whoever helps me :) eniorJR # 0050 (I'm spanish sorry for my english) Share this post Link to post Share on other sites