• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Create item that weight X

clouf

Active Member
Joined
Jul 5, 2012
Messages
191
Reaction score
34
Location
Poland
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
F
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