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

Solved Create item that weight X

clouf

Member
Joined
Jul 5, 2012
Messages
162
Reaction score
23
I want to add to player item for example Backpack that weight is 100 oz.
Code i made:
Lua:
local item = doPlayerAddItem(player, 2000, 1)
item:setAttribute(ITEM_ATTRIBUTE_WEIGHT, 10000)

and i getting this error:

Less:
attempt to index local 'item' (a number value)

Using TFS 1.2
 
Solution
Lua:
local item = Game.createItem(2000, 1)
if item then
    item:setAttribute(ITEM_ATTRIBUTE_WEIGHT, 10000)
    --player:addItemEx(item[, canDropOnMap = false[, index = INDEX_WHEREEVER[, flags = 0]]])
    --use whatever options you need
    player:addItemEx(item)
end
Lua:
local item = Game.createItem(2000, 1)
if item then
    item:setAttribute(ITEM_ATTRIBUTE_WEIGHT, 10000)
    --player:addItemEx(item[, canDropOnMap = false[, index = INDEX_WHEREEVER[, flags = 0]]])
    --use whatever options you need
    player:addItemEx(item)
end
 
Solution
Back
Top