• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Send item to depot offer owner

caquinha

Member
Joined
Aug 8, 2016
Messages
248
Solutions
1
Reaction score
24
I'm using this market system for 8.60
https://otland.net/threads/offline-player-to-player-item-trader-auction-system.51447/

And i need some help to if offer have more then 30 days, it be delete for offers lists and send item back to player depot...
@Stellow made this script to delete offers but it not send item back to owners:

There is a way to convert this script 1.0 to 0.4
https://otland.net/threads/automatic-znote-aac-shop-tfs-1-0.224483/
It send parcel...

Code:
<globalevent name="marketcleaner" type="startup" event="script" value="marketcleaner.lua"/>

marketcleaner.lua
Code:
function onStartup()
   local result = db.getResult("SELECT `id`, `date` FROM `auction_system` ORDER by `date` ASC;")
   local days = 30*3600*24
   local nowtime = os.date('*t')
   if(result:getID() ~= -1) then
     while(true)
       local id = result:getDataInt("id")
       local date = result:getDataInt("date")
       local time= os.time(nowtime) - date
       local duedate = time - days
       if duedate >= 0 then
           -- delete offer
           db.executeQuery("DELETE FROM `auction_system` WHERE `id` = '".. id .."';")
       end
       if not(result:next()) then
           break
       end
   end
   end
   result:free()
end


Anyone know how to help me?
 
Last edited:
Send me a sample picture of your otz_communication table, so I can finish this script

function onStartup()
local result = db.getResult("SELECT `id`, `date`, `player` FROM `auction_system` ORDER by `date` ASC;")
local days = 30*3600*24
local nowtime = os.date('*t')
if(result:getID() ~= -1) then
while(true)
local id = result:getDataInt("id")
local pguid = result:getDataInt("player")
local date = result:getDataInt("date")
local time= os.time(nowtime) - date
local duedate = time - days
if duedate >= 0 then
-- delete offer
db.getResult("INSERT INTO z_ots_comunication (name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES ('".. .."',);")
db.executeQuery("DELETE FROM `auction_system` WHERE `id` = '".. id .."';")
end
if not(result:next()) then
break
end
end
end
result:free()
end
 
Send me a sample picture of your otz_communication table, so I can finish this script

What is it? I don't found much on forum about it...
Where i found my otz_communication?
It isnt from gesior? I use znote!
 
Last edited:
I already found...
But i think don't have nothing about it!

Table Ascending Action Rows Type Collation Size Overhead
accounts Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 6 InnoDB latin1_swedish_ci 32 KiB -
account_viplist Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 64 KiB -
auction_system Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM latin1_swedish_ci 1 KiB -
bans Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 48 KiB -
bounty_hunters Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1 MyISAM utf8_unicode_ci 2 KiB -
environment_killers Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1 InnoDB latin1_swedish_ci 32 KiB -
global_storage Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 5 InnoDB latin1_swedish_ci 16 KiB -
guilds Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 32 KiB -
guild_invites Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 32 KiB -
guild_kills Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 64 KiB -
guild_ranks Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 32 KiB -
guild_wars Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 64 KiB -
houses Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 407 InnoDB latin1_swedish_ci 64 KiB -
house_auctions Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 32 KiB -
house_data Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 16 KiB -
house_lists Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 16 KiB -
killers Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1 InnoDB latin1_swedish_ci 32 KiB -
marriage_system Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 16 KiB -
players Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 5 InnoDB latin1_swedish_ci 96 KiB -
player_deaths Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1 InnoDB latin1_swedish_ci 48 KiB -
player_depotitems Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 2 InnoDB latin1_swedish_ci 32 KiB -
player_items Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 71 InnoDB latin1_swedish_ci 32 KiB -
player_killers Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 48 KiB -
player_namelocks Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 32 KiB -
player_skills Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 28 InnoDB latin1_swedish_ci 32 KiB -
player_spells Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 32 KiB -
player_storage Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 97 InnoDB latin1_swedish_ci 32 KiB -
player_viplist Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 48 KiB -
server_config Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 2 InnoDB latin1_swedish_ci 16 KiB -
server_motd Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 2 InnoDB latin1_swedish_ci 16 KiB -
server_record Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 4 InnoDB latin1_swedish_ci 16 KiB -
server_reports Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 64 KiB -
tiles Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1,538 InnoDB latin1_swedish_ci 208 KiB -
tile_items Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1,540 InnoDB latin1_swedish_ci 288 KiB -
znote Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 3 MyISAM utf8_general_ci 2.1 KiB -
znote_accounts Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_changelog Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_deleted_characters Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 16 KiB -
znote_forum Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 4 MyISAM utf8_general_ci 2.1 KiB -
znote_forum_posts Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_forum_threads Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_guild_wars Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB utf8_general_ci 16 KiB -
znote_images Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_news Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_paygol Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_paypal Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_players Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 5 MyISAM utf8_general_ci 2.1 KiB -
znote_player_reports Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_shop Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_shop_logs Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_shop_orders Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_tickets Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_tickets_replies Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_visitors Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
znote_visitors_details Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 MyISAM utf8_general_ci 1 KiB -
__cornex_referral Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 1 InnoDB latin1_swedish_ci 16 KiB -
__cornex_referral_actions Browse Browse Structure Structure Search Search Insert Insert Empty Empty Drop Drop 0 InnoDB latin1_swedish_ci 16 KiB -
 
/\
Thats my structure on phpmyadmin, there is nothing about otz_communication table...
There is something left or what?
 
This otz_communication thing is from gesior AAC, i using znote AAC
There is a way to send parcel in 0.4 like i edited in first post?
 
Like I wrote here: How to send all depot items from another city?

You have to remake your data/globalevents/scripts/serversave.lua. Your new servesave.lua have to close server, kick all players, execute script to clear all old market auctions and then, execute script to add items to player's depots and another script to open server, or restart and open server.

Making such system is time absorbing. If you are looking for someone who can write it for free, it may take you some time.
 
Like I wrote here: How to send all depot items from another city?

You have to remake your data/globalevents/scripts/serversave.lua. Your new servesave.lua have to close server, kick all players, execute script to clear all old market auctions and then, execute script to add items to player's depots and another script to open server, or restart and open server.

Making such system is time absorbing. If you are looking for someone who can write it for free, it may take you some time.

Thankts to your other script, i follow your logic and i made this script:

Code:
 <globalevent name="marketcleaner" type="startup" event="script" value="marketcleaner.lua"/>

Code:
function onStartup()
   local result = db.getResult("SELECT `id`, `date` FROM `auction_system` ORDER by `date` ASC;")
   local days = 30*3600*24
   local nowtime = os.date('*t')
   if(result:getID() ~= -1) then
     while(true)
       local id = result:getDataInt("id")
       local date = result:getDataInt("date")
       local time= os.time(nowtime) - date
       local duedate = time - days

       if duedate >= 0 then
           -- send item back to old owner
           local item = result:getDataInt("item_id")
           local cfg = {
               TownId = 1,
               parcelId = 2595,
               labelId = 2599,
               mailBoxPos = {x = 65, y = 42, z = 6}
           }
           local parcel = {} -- leave it
           local label = doCreateItemEx(cfg.labelId, 1)

           local parcelNumber = 1
           doSetItemText(label, getCreatureName(cid).. "\n" ..getTownName(townid))
           doAddContainerItemEx(parcel[parcelNumber], item )
           doTeleportThing(parcel[parcelNumber], cfg.mailBoxPos)


           -- delete offer
           db.executeQuery("DELETE FROM `auction_system` WHERE `id` = '".. id .."';")
       end
       if not(result:next()) then
           break
       end
   end
   end
   result:free()
end


It should not work? Because when start there is no players online
 
Last edited:
I tried to use your script, but not work here, show me this when start the server

Code:
[23:38:06.022] [Error - LuaInterface::loadFile] data/globalevents/scripts/marketcleaner.lua:7: 'do' expected near 'local'
[23:38:06.022] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/marketcleaner.lua)
[23:38:06.022] data/globalevents/scripts/marketcleaner.lua:7: 'do' expected near 'local'

Code:
function onStartup()
   local result = db.getResult("SELECT `id`, `date` FROM `auction_system` ORDER by `date` ASC;")
   local days = 30*3600*24
   local nowtime = os.date('*t')
   if(result:getID() ~= -1) then
     while(true)
       local id = result:getDataInt("id")
       local date = result:getDataInt("date")
       local time= os.time(nowtime) - date
       local duedate = time - days

       if duedate >= 0 then
           -- send item back to old owner
           local item = result:getDataInt("item_id")
           local cfg = {
               TownId = 1,
               parcelId = 2595,
               labelId = 2599,
               mailBoxPos = {x = 65, y = 42, z = 6}
           }
           local parcel = {} -- leave it
           local label = doCreateItemEx(cfg.labelId, 1)

           local parcelNumber = 1
           doSetItemText(label, getCreatureName(cid).. "\n" ..getTownName(townid))
           doAddContainerItemEx(parcel[parcelNumber], item )
           doTeleportThing(parcel[parcelNumber], cfg.mailBoxPos)


           -- delete offer
           db.executeQuery("DELETE FROM `auction_system` WHERE `id` = '".. id .."';")
       end
       if not(result:next()) then
           break
       end
   end
   end
   result:free()
end
 
Back
Top