Lua Help to fix trade-off in game 8.6

kennyubuntu

Member
Joined
May 20, 2016
Messages
96
Best answers
0
Reaction score
5
I'm tryng to when player use this item
Code:
14:44 You see a depot chest (Vol:30).
ItemID: [2594].
Item inside depot, show the options to market based on this script
https://otland.net/threads/offline-player-to-player-item-trader-auction-system.51447/

Someone could help me?

Code:
[14:41:05.436] [Error - LuaInterface::loadFile] data/actions/scripts/tradeoff_depotchest.lua:18: no loop to break near 'end'
[14:41:05.436] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/tradeoff_depotchest.lua)
[14:41:05.437] data/actions/scripts/tradeoff_depotchest.lua:18: no loop to break near 'end'
Code:
<action itemid="2594" script="tradeoff_depotchest.lua" />
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local result = db.getResult("SELECT * FROM `auction_system` ORDER BY `auction_system`.`id` ASC")
   if result:getID() == -1 then
     return true
   end
   local msg = "Trade Offline:\n\n!offer buy, ID\n!offer remove, ID\n!offer add, ItemName, ItemPrice, ItemCount\n\n"
   while true do
     local id = result:getDataString("id")
     local name = getPlayerNameByGUID(result:getDataString("player"))
     local item_name = getItemNameById(result:getDataString("item_id"))
     local count = result:getDataString("count")
     local custo = result:getDataString("cost")/1000
     local custo2 = result:getDataString("cost")
     if isPlayer(cid) then
       msg = ""..msg.."ID : "..id.."\nItem Name : "..item_name.." - Item Count : "..count.." - Item Cust : "..custo.."k("..custo2.."GP) - Dono : "..name.."\n"
     end
     if not result:next() then
       break
     end
   end
   doPlayerPopupFYI(cid, msg) return true
end
 
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
96
Best answers
0
Reaction score
5
I tried
Danger II code
:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local result = db.getResult("SELECT * FROM `auction_system` ORDER BY `auction_system`.`id` ASC")

  local msg = "Trade Offline:\n\n!offer buy, ID\n!offer remove, ID\n!offer add, ItemName, ItemPrice, ItemCount\n\n"
  if(result:getID() == -1) then
  repeat
  local id = result:getDataString("id")
  local name = getPlayerNameByGUID(result:getDataString("player"))
  local item_name = getItemNameById(result:getDataString("item_id"))
  local count = result:getDataString("count")
  local custo = result:getDataString("cost")/1000
  local custo2 = result:getDataString("cost")
  if isPlayer(cid) then
  msg = ""..msg.."ID : "..id.."\nItem Name : "..item_name.." - Item Count : "..count.." - Item Cust : "..custo.."k("..custo2.."GP) - Dono : "..name.."\n"
  end
  until not result.next(result_plr)
  result.free(result_plr)
  end
  doPlayerPopupFYI(cid, msg) return true
end

just show me
Code:
Trade Offline:

!offer buy, ID
!offer remove,ID
!offer add, ItemName, ItemPrice, ItemCount
Not show me the items
 
Top