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

CreatureEvent Item not able to trade

Jetro

jangeldev
Joined
Aug 1, 2011
Messages
452
Reaction score
68
Location
Venezuela
Here is a very simple script, was requested here http://otland.net/f16/item-not-able-trade-147036/, this basically don't let to trade an item, it is easy to configurate:

Lua:
local itemsnoTrade = {2160}
 
function onTradeRequest(cid, target, item, targetItem)
 
	if (isInArray(itemsnoTrade, item.itemid)) then
			doPlayerSendCancel (cid, "You can't trade this item.")
		return false
	end
 
	return true
end

XML:
<event type="traderequest" name="tradeRequest" event="script" value="trade.lua"/>

login.lua
Lua:
registerCreatureEvent(cid, "tradeRequest")

you can add/remove the items who can't be traded in this line, of course, separating by commas :
Lua:
local itemsnoTrade = {2160, 2148}

note: if you are using tfs 0.3.6pl1 and the table itemsnoTrade has only one value you have to change the line:
Lua:
if (isInArray(itemsnoTrade, item.itemid)) then
for :
Lua:
if (isInArray(itemsnoTrade, item.itemid) or itemsnoTrade[1] == item.itemid) then
I hope you like it
Regards
 
Last edited:
How to make it undropable ? (you can put it into your depot but not in parcel , boxes, drop it on ground) :D
 
tfs 1.3? please

Lua:
local blockedItems = {2160}

local ec = EventCallback

ec.onTradeRequest = function(self, target, item)
    if table.contains(blockedItems, item:getId()) then
        self:sendTextMessage(MESSAGE_INFO_DESCR, 'You can not trade this item.')
        return false
    end
end

ec:register()
 
Back
Top