potinho
Advanced OT User
Hello everyone, everything good? I'm using the script from the post below but I found a bug: If an offer is for more then 1 items (20 SSA, for example) it only returns one within the parcel. Can you help me fix the script?
Lua:
function getPlayerNameByGUID(guid)
local name = 0
local resultId = db.getResult("SELECT `name` FROM `players` WHERE `id` = " .. guid)
if(resultId:getID() ~= -1) then
name = resultId.getDataString(resultId, "name")
resultId:free()
end
return name
end
function onStartup()
local result = db.getResult("SELECT `id`, `player`, `item_id`, `item_name`, `count`, `cost`, `date` FROM `auction_system` ORDER by `date` ASC;")
local days = 30*3600*24
local nowtime = os.date('*t')
if (result and result:getID() ~= -1) then
while(true) do
local id = result:getDataInt("id")
local player = result:getDataString("player")
local item_id = result:getDataInt("item_id")
local item_name = result:getDataString("item_name")
local count = result:getDataInt("count")
local cost = result:getDataInt("cost")
local date = result:getDataInt("date")
local chest = doCreateItemEx(2595)
local time= os.time(nowtime) - date
local duedate = time - days
local town_id = 1
if duedate >= 0 then
doAddContainerItem(chest, item_id, count)
doPlayerSendMailByName(getPlayerNameByGUID(player), chest, town_id)
db.executeQuery("DELETE FROM `auction_system` WHERE `id` = '".. id .."';")
end
if not(result:next()) then
break
end
end
end
end
TFS 0.X - Offer expire auction system
I do using this auction system: TalkAction - Offline player to player item trader (Auction System). Using some others script as base i'm trying to make a script to when auction get more then 30 days on auction list it came back to offer creator, but i'm not getting, someone could help me...
otland.net
Last edited: