• 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!

TalkAction Basic Anti-dupe System

In the command /track only appears when I buy the items if I play at home and get the serial devolta already gone.

There is to see items in houses dupeds oO.
 
Last edited:
I dont know where i put the doItemSetAttribute(uid, "serial", generateSerial()) in shop.lua of gesior...

I tried that, but the serial wont appear yet..

My shop:

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
id = tonumber(result_plr:getDataInt("id"))
action = tostring(result_plr:getDataString("action"))
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
full_weight = getItemWeightById(itemtogive_id, 1)
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
doItemSetAttribute(new_container, "serial", generateSerial())
local iter = 0
while iter ~= container_count do
local new_container_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(new_container_item, "serial", generateSerial())
doAddContainerItemEx(new_container, new_container_item)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
doItemSetAttribute(received_item, "serial", generateSerial())
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(received_item, "serial", generateSerial())
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')

db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end

ty
 
Last edited:
Please, could you do auto-punishiment ? Removing BOTH items and baning BOTH players !
Thank you, and REP+

Heavy handed.

One could innocently purchase a duped item and be unaware of it.
And sometimes one can even dupe items on accident. Such as transferring items between characters and the server crashes for reasons unrelated to them.

The whole point of a tracking table is to generate a history and nuke repeat offenders hard, not dish zero tolerance out the gate.
 
edit your post to use [noparse]
Code:
[/noparse] tags please, and I may examine that for you.

In my ot, not working! I tried put doItemSetAttribute(new_container, "serial", generateSerial()) in many places of my shop.lua but do not work.
Code:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
id = tonumber(result_plr:getDataInt("id"))
action = tostring(result_plr:getDataString("action"))
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataStrin g("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
full_weight = getItemWeightById(itemtogive_id, 1)
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
doItemSetAttribute(new_container, "serial", generateSerial())
local iter = 0
while iter ~= container_count do
local new_container_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(new_container_item, "serial", generateSerial())
doAddContainerItemEx(new_container, new_container_item)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
doItemSetAttribute(received_item, "serial", generateSerial())
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(received_item, "serial", generateSerial())
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')

db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end
 
Need to edit the scripts of quests, shop, NPC sell items, add "serial" in the SQL table and remove all old items that do not have a serial before add this script?
 
i receive the msg "lost mysql connection"... how can i solve it?
 
Man have one bug


[21:41:35.953] [Error - TalkAction Interface]
[21:41:35.953] data/talkactions/scripts/trackitems.lua:eek:nSay
[21:41:35.953] Description:
[21:41:35.968] (luaGetPlayerNameByGUID) Player not found

[21:41:35.968] [Error - TalkAction Interface]
[21:41:35.968] data/talkactions/scripts/trackitems.lua:eek:nSay
[21:41:35.968] Description:
[21:41:35.968] data/talkactions/scripts/trackitems.lua:8: attempt to concatenate
a nil value
[21:41:35.968] stack traceback:
[21:41:35.968] data/talkactions/scripts/trackitems.lua:8: in function <data/tal
kactions/scripts/trackitems.lua:1>
 
I need help.

this error:

Lua:
Error execute query: near "USING": syntax error
<simple query executor>

with this..
Code:
SELECT * , SUBSTRING( CONVERT( attributes
USING latin1 )
FROM 18 ) AS  'serial'
FROM player_items
WHERE CONVERT( attributes
USING latin1 ) LIKE  '%serial%'
 
Back
Top