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...
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)
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
Thanks for script @AledIt's possible, you mean all items in all slots?
Is it an action? a talk action? creature script?
here is a talk action that will remove all items on your person and put them in your depot (TFS 1.x)
Lua: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) 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
local depot = player:getDepotChest(Depot number)
I tested it and it worked for me, that parameter was presumably for when there were separate depots for each town
you can change to use in creature ?I tested it and it worked for me, that parameter was presumably for when there were separate depots for each town
/depot and send all player in serverthe script above sends all YOUR items to YOUR depot, you want a script such as this:
'/depot XXX' that sends all of player XXX items to his depot?
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
n = n + 1
targetPlayer:sendTextMessage(MESSAGE_INFO_DESCR, "All items have been sent to your depot.")
targetPlayer:getPosition():sendMagicEffect(11)
end
print("> " .. n .. " players had their items transfered to their depots.")
return false
end
Stop reply to call attention, post a new threadAlex
Reply quickly I need my bucket
i haven't laughed so hard in a whileHi YOu Can Help Me Iam Need Add Items In Map Editor 8.10 Please
Alex
Reply quickly I need my bucket
Hi YOu Can Help Me Iam Need Add Items In Map Editor 8.10 Please
Alex
Reply quickly I need my bucket
This is a talk action?how i add it in server startup
but is possible add in startup server ?This is a talk action?
I'm very confused as to what you are trying to do.but is possible add in startup server ?
Just so i understand you correctly... You are saying you want to send ALL players items to the depot on server start? huh?If server start execute script and send itens from player dp
Just so i understand you correctly... You are saying you want to send ALL players items to the depot on server start? huh?
add this to the bottom of your global.lua
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(itemSlots) 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
sendAllItems(player)