Hello, nite nite.
Does anyone know the command line to remove the equipments that are in the backpack slots, armor slot, etc?
player:removeItem(itemId, count[, subType = -1[, ignoreEquipped = false]])
player:removeItem(2681, 1, -1, false)
Sorry for my ignorance but will this remove all equipped items? I'm using TFs 1.3 if I'm not mistaken
Ty for reply !
-------------------
and i dont want remove item by ID, i want remove item on equipped slot ! ty
local slots = {CONST_SLOT_FIRST, CONST_SLOT_HEAD, CONST_SLOT_NECKLACE, CONST_SLOT_BACKPACK, CONST_SLOT_ARMOR, CONST_SLOT_RIGHT, CONST_SLOT_LEFT, CONST_SLOT_LEGS, CONST_SLOT_FEET, CONST_SLOT_RING, CONST_SLOT_AMMO}
local player = Player(cid)
for i = 1, #slots do
local item = player:getSlotItem(slots[i])
player:removeItem(item, 1)
end
for slot = 1, 10 do
local item = player:getSlotItem(slot)
if item then
item:remove()
end
end
local Slott = {[1] = CONST_SLOT_LEFT, [2] = CONST_SLOT_RIGHT, [3] = CONST_SLOT_RING, [4] = CONST_SLOT_HEAD, [5] = CONST_SLOT_NECKLACE, [6] = CONST_SLOT_BACKPACK}
for Slott = 1, 10 do
local item = player:getSlotItem(slott)
if item then
item:remove()
end
end
LUA:local Slott = {[1] = CONST_SLOT_LEFT, [2] = CONST_SLOT_RIGHT, [3] = CONST_SLOT_RING, [4] = CONST_SLOT_HEAD, [5] = CONST_SLOT_NECKLACE, [6] = CONST_SLOT_BACKPACK} for Slott = 1, 10 do local item = player:getSlotItem(slot) if item then item:remove() end end
'=' Expected near 'for' :'(
enum slots_t : uint8_t {
CONST_SLOT_WHEREEVER = 0,
CONST_SLOT_HEAD = 1,
CONST_SLOT_NECKLACE = 2,
CONST_SLOT_BACKPACK = 3,
CONST_SLOT_ARMOR = 4,
CONST_SLOT_RIGHT = 5,
CONST_SLOT_LEFT = 6,
CONST_SLOT_LEGS = 7,
CONST_SLOT_FEET = 8,
CONST_SLOT_RING = 9,
CONST_SLOT_AMMO = 10,
CONST_SLOT_FIRST = CONST_SLOT_HEAD,
CONST_SLOT_LAST = CONST_SLOT_AMMO,
};
local slots = {1, 2, 3, 5, 6, 9}
for _, slot in pairs(slots) do
local item = player:getSlotItem(slot)
if item then
item:remove()
end
end
local Slott = {CONST_SLOT_FIRST, CONST_SLOT_HEAD, CONST_SLOT_NECKLACE, CONST_SLOT_BACKPACK, CONST_SLOT_ARMOR, CONST_SLOT_RIGHT, CONST_SLOT_LEFT, CONST_SLOT_LEGS, CONST_SLOT_FEET, CONST_SLOT_RING, CONST_SLOT_AMMO}
local item = player:getSlotItem(Slott)
item:remove()
local slots = {1, 2, 3, 5, 6, 7, 8, 9, 10}
for _, slot in pairs(slots) do
local item = player:getSlotItem(slot)
if item then
item:remove()
end
end
LUA:local Slott = {CONST_SLOT_FIRST, CONST_SLOT_HEAD, CONST_SLOT_NECKLACE, CONST_SLOT_BACKPACK, CONST_SLOT_ARMOR, CONST_SLOT_RIGHT, CONST_SLOT_LEFT, CONST_SLOT_LEGS, CONST_SLOT_FEET, CONST_SLOT_RING, CONST_SLOT_AMMO} local item = player:getSlotItem(Slott) item:remove()
![]()
-- all slots to look for
local slots = {1, 2, 3, 5, 6, 9}
-- cycle through the slots table and store the slot id in slot
for _, slot in pairs(slots) do
-- get the player's slot item and store it in item
local item = player:getSlotItem(slot)
-- if the item exists meaning its not nil then continue
if item then
-- if it exists then remove the item
item:remove()
end
end
You always need to check for a value before you use it. This is a fail safe mechanism so whatever scripts you write don't throw errors.
Example with comments
LUA:-- all slots to look for local slots = {1, 2, 3, 5, 6, 9} -- cycle through the slots table and store the slot id in slot for _, slot in pairs(slots) do -- get the player's slot item and store it in item local item = player:getSlotItem(slot) -- if the item exists meaning its not nil then continue if item then -- if it exists then remove the item item:remove() end end
local slots = {1, 2, 3, 5, 6, 7, 8, 9, 10}
for _, slot in pairs(slots) do
local item = player:getSlotItem(slot)
if item then
item:remove()
end
end
because you don't have 4 in the arrayYou cod works man, ty ... but you know why dont delete the armor slot ??"
LUA:local slots = {1, 2, 3, 5, 6, 7, 8, 9, 10} for _, slot in pairs(slots) do local item = player:getSlotItem(slot) if item then item:remove() end end
Ty man, need pay more attention x.xbecause you don't have 4 in the array