• 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

Active Member
Joined
Jul 5, 2012
Messages
190
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

Similar threads

  • Question Question
Replies
2
Views
145
Back
Top