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

[TFS 1.X] "Unique Items" Can't trade or drop this item.

Athenuz

Owlz!
Joined
Oct 1, 2015
Messages
234
Reaction score
27
Location
México
Hello!

I'd like to know if someone can help me to make this?
Add a kind of attribute or something (if its source edition, to add the "unique" attribute at items.xml could be awesome) Or any working script...

The goal is prevent the item of being dropped to the floor, traded, or selleable at market (the market think i suppose i can prevent at items.otb)

Regards ^^
 
set unique description for these items and go to events/events.xml
enable all item-related events
use this:
Code:
if item:getDescription():match("same text as item description") then
return false
end

this will make item unmoveable and untradeable
players will still be able to use it if they find it in dead bodies unless you combine that code above with
Code:
item:getDescription():match(player:getName())
and add it to onUse script

if you want to do that for certain ids just do a table and do this in all kinds of events such as look, move, trade, etc.
Code:
local special_items = {2363, 2365}
...
if isInArray(special_items, item:getId()) and not item:getDescription():match("same text as item description") then
-- set desc and player name to block item
end
 
Last edited:
set unique description for these items and go to events/events.xml
enable all item-related events
use this:
Code:
if item:getDescription():match("same text as item description") then
return false
end

this will make item unmoveable and untradeable
players will still be able to use it if they find it in dead bodies unless you combine that code above with
Code:
item:getDescription():match(player:getName())
and add it to onUse script

if you want to do that for certain ids just do a table
Code:
local special_items = {2363, 2365}
...
if isInArray(special_items, item:getId()) and not item:getDescription():match("same text as item description") then
-- set desc and player name to block item
end

Thanks a lot!
 
I suggest this:
Code:
item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "[" .. player:getName() .. "]\n[untradeable]")

Code:
item:getDescription():match("[untradeable]")
 
I suggest this:
Code:
item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "[" .. player:getName() .. "]\n[untradeable]")

Code:
item:getDescription():match("[untradeable]")

You have to escape those [ ] tho.

Code:
item:getDescription():match("%[untradeable%]")
 
This gonna be so noobish from me but.. how i set it up? xD
The events.xml thing i understand to enable item-related events
but the other things?

Can please explain?
 
Back
Top