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?

@DangerII make this script, but just show the commands, not show the items...

How to fix?

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
Its show me just
Code:
Trade Offline:

!offer buy, ID
!offer remove,ID
!offer add, ItemName, ItemPrice, ItemCount
 
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
96
Best answers
0
Reaction score
5
Shouldn't it be?
Code:
if(result:getID() ~= -1) then
I was changed it, but gave me other error
Code:
[16:16:28.536] [Error - Action Interface]
[16:16:28.536] data/actions/scripts/tradeoff_depotchest.lua:onUse
[16:16:28.536] Description:
[16:16:28.536] data/lib/004-database.lua:91: attempt to index local 'self' (a nil value)
[16:16:28.536] stack traceback:
[16:16:28.536]    data/lib/004-database.lua:91: in function 'next'
[16:16:28.536]    data/actions/scripts/tradeoff_depotchest.lua:16: in function <data/actions/scripts/tradeoff_depotchest.lua:1>
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
  local result = db.getResult("SELECT * FROM `auction_system` ORDER BY `auction_system`.`id` ASC")

  local msg = "Market:\n\n/market buy, ID\n/market remove, ID\n/market 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
 

Omni Cloud

Banned User
Joined
May 31, 2016
Messages
312
Best answers
0
Reaction score
149
You are only allowed to bump a thread once every 24 hours.
 

Mkalo

ボーカロイド
Joined
Jun 1, 2011
Messages
1,118
Best answers
54
Reaction score
899
Location
Japan
Change
Code:
  until not result.next(result_plr)
  result.free(result_plr)
To
Code:
  until not result:next()
  result:free()
 
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
96
Best answers
0
Reaction score
5
Change
Code:
  until not result.next(result_plr)
  result.free(result_plr)
To
Code:
  until not result:next()
  result:free()
Ty!! It's work now!

But there is other function like doPlayerPopupFYI
Or a way to make buttons in doPlayerPopupFYI
To make search button by item,by seller, my offers...

To be a nice in-game market in 8.60?
 

Mkalo

ボーカロイド
Joined
Jun 1, 2011
Messages
1,118
Best answers
54
Reaction score
899
Location
Japan
Ty!! It's work now!

But there is other function like doPlayerPopupFYI
Or a way to make buttons in doPlayerPopupFYI
To make search button by item,by seller, my offers...

To be a nice in-game market in 8.60?
No
 

Mkalo

ボーカロイド
Joined
Jun 1, 2011
Messages
1,118
Best answers
54
Reaction score
899
Location
Japan
Yes! ZEZENIUM!!!
But now with task training and izi game i stoped play...

There is no way to make anything like this with no client edit?
Mate, understand. If there isn't the stuff that you want coded in the client code HOW ARE YOU GOING TO CREATE SOMETHING IN THE CLIENT. You can only use whatever cipsoft coded and they didn't code anything to create windows (not until modalwindows but they are still limited.)
 
Top