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

tfs1.0 player:getSlotItem(slotId)

Zyntax

*WannaBe Scripter*
Joined
Jan 27, 2010
Messages
533
Reaction score
40
Location
Lua & XML Section
quick question.

Why is it possible to do this
Code:
local i = Item(getPlayerSlotItem(cid, 4).uid)
print(i:getName()) 
print(i:getId())
but not this
Code:
local p = Player(cid)
local i = Item(p:getSlotItem(4).uid)
print(i:getName())
If i try to use the 2nd method i end up with a [nil] value
Where's the difference in using player: methods and item: methods?
What's the point in using them if I can't "combine" them?
Could someone explain that to me?
 
Code:
    local player = Player(cid)
    local slotItem = player:getSlotItem(CONST_SLOT_ARMOR)
    if slotItem ~= nil then
        local item = Item(slotItem:getUniqueId())
        print(item:getId())
        print(item:getName())
    end
 
item:getUniqueId()

thanks ninja, i totally missed that :)
Everythings clear now.

EDIT: is it possible to

slot = player:getSlotItem(slotID):getUniqueId()
?

3rdEdit: best solution
local k = Item(p:getSlotItem(4):getUniqueId())
print(k:getName())
 
Last edited:
Back
Top