werednnbs 442 Posted September 10, 2015 Share Posted September 10, 2015 (edited) Hey guys,I wonder if i cloud help with two problems: 1º: When i try to move any inventory item goes to the character login. I think that's the file exchange.cpp in the funtion CExchange::CheckSpace() bool CExchange::CheckSpace() { static CGrid s_grid1(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 1 9 Rows a 5 Columns static CGrid s_grid2(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 2 9 Rows a 5 Columns static CGrid s_grid3(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 3 9 Rows a 5 Columns static CGrid s_grid4(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 4 9 Rows a 5 Columns s_grid1.Clear(); s_grid2.Clear(); s_grid3.Clear(); s_grid4.Clear(); LPCHARACTER victim = GetCompany()->GetOwner(); LPITEM item; int i; const int perPageSlotCount = INVENTORY_MAX_NUM / 4; for (i = 0; i < INVENTORY_MAX_NUM; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; BYTE itemSize = item->GetSize(); if (i < perPageSlotCount) // Notice: This is adjusted for 4 Pages only! s_grid1.Put(i, 1, itemSize); else if (i < perPageSlotCount * 2) s_grid2.Put(i - perPageSlotCount, 1, itemSize); else if (i < perPageSlotCount * 3) s_grid3.Put(i - perPageSlotCount * 2, 1, itemSize); else s_grid4.Put(i - perPageSlotCount * 3, 1, itemSize); } static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM); bool bDSInitialized = false; for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i) { if (!(item = m_apItems[i])) continue; BYTE itemSize = item->GetSize(); if (item->IsDragonSoul()) { if (!victim->DragonSoul_IsQualified()) return false; if (!bDSInitialized) { bDSInitialized = true; victim->CopyDragonSoulItemGrid(s_vDSGrid); } bool bExistEmptySpace = false; WORD wBasePos = DSManager::instance().GetBasePosition(item); if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM) return false; for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++) { WORD wPos = wBasePos + i; if (0 == s_vDSGrid[wBasePos]) { bool bEmpty = true; for (int j = 1; j < item->GetSize(); j++) { if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM]) { bEmpty = false; break; } } if (bEmpty) { for (int j = 0; j < item->GetSize(); j++) { s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] = wPos + 1; } bExistEmptySpace = true; break; } } if (bExistEmptySpace) break; } if (!bExistEmptySpace) return false; } else { int iPos = s_grid1.FindBlank(1, itemSize); if (iPos >= 0) { s_grid1.Put(iPos, 1, itemSize); continue; } iPos = s_grid2.FindBlank(1, itemSize); if (iPos >= 0) { s_grid2.Put(iPos, 1, itemSize); continue; } iPos = s_grid3.FindBlank(1, itemSize); if (iPos >= 0) { s_grid3.Put(iPos, 1, itemSize); continue; } iPos = s_grid4.FindBlank(1, itemSize); if (iPos >= 0) { s_grid4.Put(iPos, 1, itemSize); continue; } return false; // No space left in inventory } } return true; } Use 4 Inventories. And 2º: I implemented everything to shop offline system but when trying to open the interface does nothing and giver me these errors Syserr the server. RunState: LUA_ERROR: [string "nixo_private_shops"]:2: attempt to call field `split' (a nil value) WriteRunningStateToSyserr: LUA_ERROR: quest nixo_private_shops.start click Funtion in quest: when button or info begin infos = nixo_private_shops.get_input("get_input") data = string.split(infos, '|') if (nixo_private_shops.checkVariables(data, 0) == true and data[1] == "OPEN") then local shop_id = nixo_private_shops.RefreshShops() if (shop_id != 0) then nixo_private_shops.RefreshItems(shop_id) cmdchat("open_shop_gui") end end if (nixo_private_shops.checkVariables(data, 0) == true and data[1] == "REFRESH") then local shop_id = nixo_private_shops.RefreshShops() if (shop_id != 0) then nixo_private_shops.RefreshItems(shop_id) cmdchat("open_shop_gui_now") else cmdchat("close_shop_gui") end end if (nixo_private_shops.checkVariables(data, 1) == true and data[1] == "SELECT_SHOP") then if (nixo_private_shops.isMyShop(tonumber(data[2])) == true) then nixo_private_shops.RefreshItems(tonumber(data[2])) end end if (nixo_private_shops.checkVariables(data, 2) == true and data[1] == "WITH_DRAW") then if (nixo_private_shops.isMyShop(tonumber(data[2])) == true) then if (nixo_private_shops.getShopStatus(tonumber(data[2])) == 2) then if (nixo_private_shops.getEarnings(tonumber(data[2]), tonumber(data[3])) > 0) then nixo_private_shops.withDraw(tonumber(data[2]), tonumber(data[3])) nixo_private_shops.RefreshItems(tonumber(data[2])) else syschat("Nie mo¿na wyp³aciæ.") end else syschat("Aby wyp³aciæ zarobione waluty musisz zamkn¹æ sklep.") end end end if (nixo_private_shops.checkVariables(data, 2) == true and data[1] == "GET_ITEM") then if (nixo_private_shops.isMyShop(tonumber(data[2])) == true) then nixo_private_shops.getItem(tonumber(data[2]), tonumber(data[3])) nixo_private_shops.RefreshItems(tonumber(data[2])) end end if (nixo_private_shops.checkVariables(data, 1) == true and data[1] == "CLOSE_SHOP") then if (nixo_private_shops.isMyShop(tonumber(data[2])) == true and nixo_private_shops.getShopStatus(tonumber(data[2])) == 1) then pc.close_shop(tonumber(data[2])) local shop_id = nixo_private_shops.RefreshShops() if (shop_id != 0) then nixo_private_shops.RefreshItems(shop_id) else cmdchat("close_shop_gui") end syschat("Sklep zosta³ zamkniêty.") end end Infinitely appreciate your help.Sorry for my bad english! Edited September 10, 2015 by bigdon Link to comment Share on other sites More sharing options...
M.Sorin 282 Posted September 11, 2015 Share Posted September 11, 2015 Second problem: function split(str, delim, maxNb) if str == nil then return str end if string.find(str, delim) == nil then return { str } end if maxNb == nil or maxNb < 1 then maxNb = 0 end local result = {} local pat = "(.-)" .. delim .. "()" local nb = 0 local lastPos for part, pos in string.gfind(str, pat) do nb = nb + 1 result[nb] = part lastPos = pos if nb == maxNb then break end end if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end return result end 1 Link to comment Share on other sites More sharing options...
Kori 170 Posted September 11, 2015 Share Posted September 11, 2015 i have solved this but Thanks 1 Link to comment Share on other sites More sharing options...
werednnbs 442 Posted September 11, 2015 Author Share Posted September 11, 2015 Thank you for your support, the first problem is still, but do not know where it comes from! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now