local slots = {
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
}
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local n = 0
for _, targetPlayer in ipairs(Game.getPlayers()) do
local depot = targetPlayer:getDepotChest()
for _, slot in pairs(slots) do
if targetPlayer:getSlotItem(slot) then
local item = targetPlayer:getSlotItem(slot)
item:moveTo(depot)
end
end...
Abaa has logged in.add this to the bottom of your global.lua
Code:itemSlots = { 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 } function sendAllItems(player) local n = 0 local depot = player:getDepotChest() for _, slot in pairs(slots) do if player:getSlotItem(slot) then local item = player:getSlotItem(slot) item:moveTo(depot) n = n + 1 end end if n > 0 then player:sendTextMessage(MESSAGE_INFO_DESCR, "All items have been sent to your depot.") player:getPosition():sendMagicEffect(11) else player:sendCancelMessage("You do not have any items to transfer to your depot.") end return false end
add this to your data/creaturescripts/login.lua
Code:sendAllItems(player)
my bad updated my original post.Abaa has logged in.
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/login.luanLogin
data/global.lua:159: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: at 0x013f2b89e0
[C]: in function 'pairs'
data/global.lua:159: in function 'sendAllItems'
data/creaturescripts/scripts/others/login.lua:190: in function <data/cre
aturescripts/scripts/others/login.lua:93>
Abaa has logged out.