• 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 [TFS 1.3] Spawn an Item with a description

AbraxasCal

New Member
Joined
Aug 24, 2020
Messages
9
Reaction score
1
TFS 1.3X
Hello, I've been trying to add a golden trophy to a player's inventory with a description. E.g
You see a golden trophy.
It has been achieved by Abraxas << (what I want to add)
It weighs 35.00 oz.


Lua:
local trophyId = 7369
local trophy = doPlayerAddItem(spectator, trophyId, 1)
trophyId:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'testing')

1598966280449.png

Thank you in advance! :)
 
Solution
you're trying to set the attribute to the trophyId, not trophy
and stop using the old functions in new tfs
Lua:
local trophyId = 7369
local trophy = spectator:addItem(trophyId, 1)
trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'It has been achieved by '.. spectator:getName())
Lua:
local desc = 'Awarded to %s',
local trophy = doPlayerAddItem(spectator, 7369, 1)
trophy:setAttribute("description", string.format(desc, spectator:getName()))
 
Last edited:
you're trying to set the attribute to the trophyId, not trophy
and stop using the old functions in new tfs
Lua:
local trophyId = 7369
local trophy = spectator:addItem(trophyId, 1)
trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'It has been achieved by '.. spectator:getName())
 
Solution
you're trying to set the attribute to the trophyId, not trophy
and stop using the old functions in new tfs
Lua:
local trophyId = 7369
local trophy = spectator:addItem(trophyId, 1)
trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'It has been achieved by '.. spectator:getName())
Lua:
local desc = 'Awarded to %s',
local trophy = doPlayerAddItem(spectator, 7369, 1)
trophy:setAttribute("description", string.format(desc, spectator:getName()))
Thank you guys for helping out so quickly! :)
 
Back
Top