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

wand sell items

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,638
Solutions
35
Reaction score
352
Hello
i need help in script that help me sell items by wand when use wand on x items its disappear and give me money like i sell with rashid
i use 8.60
tfs 0.4-dev
sorry for my english
Id of items.. same id in rashid script
 
yes bro its work fine Rep but i have 2 script one action and othere script movements look up for sellfir i want edit too for work with backpack
 
I know, but how do you want that sellfire script to work exactly with backpacks.
What did you had in mind exactly? Should it work with both items and items in a backpack, and should it work with all backpacks or specific ones and what should happen with the backpack?
 
when player throw backpack with items in flam sell items and backpack back to player again and if backpack have specil items its back with backpack
 
i tried to edite it but no work :S
Code:
local items = {
   [11350] = 10000,
   [2181] = 5000,
   [11296] = 50000,
   [11298] = 14000,
   [8885] = 100000,
   [2519] = 8000,
   [2392] = 4000,
   [8910] = 12000,
   [8871] = 8000,
   [2393] = 20000,
   [11295] = 10000,
   [11299] = 10000,
   [2528] = 10000,
   [2195] = 40000,
   [2516] = 4000,
   [2498] = 40000,
   [2492] = 45000,
   [2656] = 12000,
   [2514] = 60000,
   [2472] = 150000,
   [2520] = 50000,
   [2470] = 50000,
   [2503] = 50000,
   [7897] = 11000,
   [2466] = 20000,
   [8873] = 3000,
   [3968] = 1000
}

function onAddItem(moveItem, tileItem, position, cid)

     local x = items[moveItem.itemid]
     if x then
         if getThingfromPos(position).actionid == 8001 then
             doRemoveItem(moveItem.uid, 1)
             doPlayerAddMoney(cid, x)
             local info = getItemInfo(moveItem.itemid)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold "..info.article.." "..info.name.." for "..x.." gold.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
     elseif isContainer(moveItem.uid) then
         local m, size, t = 0, getContainerSize(moveItem.uid), {}
         if size == 0 then
             return doPlayerSendCancel(cid, "This container is empty.")
         end
         for s = 0, size do
             local citem = getContainerItem(moveItem.uid, s)
             local cx = items[citem.itemid]
             if cx then
                 table.insert(t, citem)
             end
         end
         for r = 1, #t do
             doRemoveItem(t[r].uid, 1)
             m = m + items[t[r].itemid]
         end
         if m > 0 then
             doPlayerAddMoney(cid, m)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold your items for "..m.." gold.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
         else
             doPlayerSendCancel(cid, "There is nothing in this container that is sellable.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         end        
     else
         doPlayerSendCancel(cid, "You can't sell this item.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     end
     return true
end
 
You need to add the bp ids to movements.xml.
Also remove this
Code:
else
     doPlayerSendCancel(cid, "You can't sell this item.")
     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
Else you always get that message when adding/moving those items.

And close this if statement
Code:
if getThingfromPos(position).actionid == 8001 then
And add it again under the isContainer if statement.
 
aHxyqnxLR.png

give me this error and all backpacks
Code:
[Containers]

[2854]Backpack
[3253]Backpack of Holding
[2853]Bag
[2855]Basket
[5949]Beach Backpack
[5950]Beach Bag
[2869]Blue Backpack
[2861]Blue Bag
[2469]Box
[2473]Box (Brown)
[8860]Brocade Backpack
[8861]Brocade Bag
[xxxx]Buggy Backpack
[2872]Camouflage Backpack
[2864]Camouflage Bag
[2472]Chest
[2471]Crate
[9605]Crown Backpack
[14248]Deepling Backpack
[9601]Demon Backpack
[10326]Dragon Backpack
[10324]Expedition Backpack
[10325]Expedition Bag
[7342]Fur Backpack
[7343]Fur Bag
[2871]Golden Backpack
[2863]Golden Bag
[2865]Green Backpack
[2857]Green Bag
[2870]Grey Backpack
[2862]Grey Bag
[10202]Heart Backpack
[6104]Jewel Case
[5801]Jewelled Backpack
[5801]Key Ring [Doesn't exist anymore on RL tibia, Jewelled Backpack has same ID.]
[xxxx]Lizard Backpack
[10327]Minotaur Backpack
[9604]Moon Backpack
[3244]Old and Used Backpack(Sam's old backpack)
[3503]Parcel
[xxxx]Pile of Bones
[5926]Pirate Backpack
[5927]Pirate Bag
[2856]Present
[2868]Purple Backpack
[2860]Purple Bag
[2867]Red Backpack
[2859]Red Bag
[10346]Santa Backpack
[3504]Stamped Parcel
[2866]Yellow Backpack
[2858]Yellow Bag
 
Last edited:
Code:
local items = {
   [11350] = 10000,
   [2181] = 5000,
   [11296] = 50000,
   [11298] = 14000,
   [8885] = 100000,
   [2519] = 8000,
   [2392] = 4000,
   [8910] = 12000,
   [8871] = 8000,
   [2393] = 20000,
   [11295] = 10000,
   [11299] = 10000,
   [2528] = 10000,
   [2195] = 40000,
   [2516] = 4000,
   [2498] = 40000,
   [2492] = 45000,
   [2656] = 12000,
   [2514] = 60000,
   [2472] = 150000,
   [2520] = 50000,
   [2470] = 50000,
   [2503] = 50000,
   [7897] = 11000,
   [2466] = 20000,
   [8873] = 3000,
   [3968] = 1000
}

function onAddItem(moveItem, tileItem, position, cid)

     local x = items[moveItem.itemid]
     if x then
        if getThingfromPos(position).actionid == 8001 then
             doRemoveItem(moveItem.uid, 1)
             doPlayerAddMoney(cid, x)
             local info = getItemInfo(moveItem.itemid)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold "..info.article.." "..info.name.." for "..x.." gold.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
     elseif isContainer(moveItem.uid) then
         local m, size, t = 0, getContainerSize(moveItem.uid), {}
         if getThingfromPos(position).actionid == 8001 then
         if size == 0 then
             return doPlayerSendCancel(cid, "This container is empty.")
         end
         for s = 0, size do
             local citem = getContainerItem(moveItem.uid, s)
             local cx = items[citem.itemid]
             if cx then
                 table.insert(t, citem)
             end
         end
         for r = 1, #t do
             doRemoveItem(t[r].uid, 1)
             m = m + items[t[r].itemid]
         end
         if m > 0 then
             doPlayerAddMoney(cid, m)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold your items for "..m.." gold.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
         else
             doPlayerSendCancel(cid, "There is nothing in this container that is sellable.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         end        
     end
     return true
end
 
still no work :S
Code:
local items = {
   [11350] = 10000,
   [2181] = 5000,
   [11296] = 50000,
   [11298] = 14000,
   [8885] = 100000,
   [2519] = 8000,
   [2392] = 4000,
   [8910] = 12000,
   [8871] = 8000,
   [2393] = 20000,
   [11295] = 10000,
   [11299] = 10000,
   [2528] = 10000,
   [2195] = 40000,
   [2516] = 4000,
   [2498] = 40000,
   [2492] = 45000,
   [2656] = 12000,
   [2514] = 60000,
   [2472] = 150000,
   [2520] = 50000,
   [2470] = 50000,
   [2503] = 50000,
   [7897] = 11000,
   [2466] = 20000,
   [8873] = 3000,
   [3968] = 1000
}

function onAddItem(moveItem, tileItem, position, cid)

  local x = items[itemEx.itemid]
     if x then
     if getThingfromPos(position).actionid == 8001 then
         doRemoveItem(itemEx.uid, 1)
         doPlayerAddMoney(cid, x)
         local info = getItemInfo(itemEx.itemid)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold "..info.article.." "..info.name.." for "..x.." gold.")
         doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
         end
     elseif isContainer(itemEx.uid) then
     if getThingfromPos(position).actionid == 8001 then
         local m, size, t = 0, getContainerSize(itemEx.uid), {}
         if size == 0 then
             return doPlayerSendCancel(cid, "This container is empty.")
         end
         for s = 0, size do
             local citem = getContainerItem(itemEx.uid, s)
             local cx = items[citem.itemid]
             if cx then
                 table.insert(t, citem)
             end
         end
         for r = 1, #t do
             doRemoveItem(t[r].uid, 1)
             m = m + items[t[r].itemid]
         end
         if m > 0 then
             doPlayerAddMoney(cid, m)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold your items for "..m.." gold.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
         end        
     return true
end
 
Last edited:
Code:
local items = {
   [11350] = 10000,
   [2181] = 5000,
   [11296] = 50000,
   [11298] = 14000,
   [8885] = 100000,
   [2519] = 8000,
   [2392] = 4000,
   [8910] = 12000,
   [8871] = 8000,
   [2393] = 20000,
   [11295] = 10000,
   [11299] = 10000,
   [2528] = 10000,
   [2195] = 40000,
   [2516] = 4000,
   [2498] = 40000,
   [2492] = 45000,
   [2656] = 12000,
   [2514] = 60000,
   [2472] = 150000,
   [2520] = 50000,
   [2470] = 50000,
   [2503] = 50000,
   [7897] = 11000,
   [2466] = 20000,
   [8873] = 3000,
   [3968] = 1000
}

function onAddItem(moveItem, tileItem, position, cid)

     if getThingfromPos(position).actionid == 8001 then
         local x = items[moveItem.itemid]
         if x then
             doRemoveItem(moveItem.uid, 1)
             doPlayerAddMoney(cid, x)
             local info = getItemInfo(moveItem.itemid)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold "..info.article.." "..info.name.." for "..x.." gold.")
             doSendMagicEffect(position, CONST_ME_FIREAREA)
         elseif isContainer(moveItem.uid) then
             local m, size, t, xt = 0, getContainerSize(moveItem.uid), {}, {}
             if size == 0 then
                 doPlayerSendCancel(cid, "This container is empty.")
                 doRemoveItem(moveItem.uid, 1)
                 doPlayerAddItem(cid, moveItem.itemid, 1)
                 doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
                 return true
             end
             for s = 0, size do
                 local citem = getContainerItem(moveItem.uid, s)
                 local cx = items[citem.itemid]
                 if cx then
                     table.insert(t, citem)
                 else
                     table.insert(xt, citem)
                 end
             end
             if #t > 0 then
                 for r = 1, #t do
                     m = m + items[t[r].itemid]
                 end
             end            
             if m > 0 then
                 doPlayerAddMoney(cid, m)
                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold your items for "..m.." gold.")
                 doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
             else
                 doPlayerSendCancel(cid, "There is nothing in this container that is sellable.")
                 doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
             end    
             doRemoveItem(moveItem.uid)
             doSendMagicEffect(position, CONST_ME_FIREAREA)
             local bp = doPlayerAddItem(cid, moveItem.itemid, 1)
             if #xt > 0 then
                 for b = 1, #xt do
                     if xt[b].itemid > 0 then
                         doAddContainerItem(bp, xt[b].itemid, xt[b].type)
                     end
                 end
             end
         else
             doPlayerSendCancel(cid, "You can't sell this item.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         end
     end
     return true
end
Add bp ids in movements.xml.
 
Last edited:
Code:
local items = {
   [11350] = 10000,
   [2181] = 5000,
   [11296] = 50000,
   [11298] = 14000,
   [8885] = 100000,
   [2519] = 8000,
   [2392] = 4000,
   [8910] = 12000,
   [8871] = 8000,
   [2393] = 20000,
   [11295] = 10000,
   [11299] = 10000,
   [2528] = 10000,
   [2195] = 40000,
   [2516] = 4000,
   [2498] = 40000,
   [2492] = 45000,
   [2656] = 12000,
   [2514] = 60000,
   [2472] = 150000,
   [2520] = 50000,
   [2470] = 50000,
   [2503] = 50000,
   [7897] = 11000,
   [2466] = 20000,
   [8873] = 3000,
   [3968] = 1000
}

function onAddItem(moveItem, tileItem, position, cid)

     if getThingfromPos(position).actionid == 8001 then
         local x = items[moveItem.itemid]
         if x then
             doRemoveItem(moveItem.uid, 1)
             doPlayerAddMoney(cid, x)
             local info = getItemInfo(moveItem.itemid)
             doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold "..info.article.." "..info.name.." for "..x.." gold.")
             doSendMagicEffect(position, CONST_ME_FIREAREA)
         elseif isContainer(moveItem.uid) then
             local m, size, t, xt = 0, getContainerSize(moveItem.uid), {}, {}
             if size == 0 then
                 doPlayerSendCancel(cid, "This container is empty.")
                 doRemoveItem(moveItem.uid, 1)
                 doPlayerAddItem(cid, moveItem.itemid, 1)
                 doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
                 return true
             end
             for s = 0, size do
                 local citem = getContainerItem(moveItem.uid, s)
                 local cx = items[citem.itemid]
                 if cx then
                     table.insert(t, citem)
                 else
                     table.insert(xt, citem)
                 end
             end
             if #t > 0 then
                 for r = 1, #t do
                     m = m + items[t[r].itemid]
                 end
             end           
             if m > 0 then
                 doPlayerAddMoney(cid, m)
                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You sold your items for "..m.." gold.")
                 doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
             else
                 doPlayerSendCancel(cid, "There is nothing in this container that is sellable.")
                 doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
             end   
             doRemoveItem(moveItem.uid)
             doSendMagicEffect(position, CONST_ME_FIREAREA)
             local bp = doPlayerAddItem(cid, moveItem.itemid, 1)
             if #xt > 0 then
                 for b = 1, #xt do
                     if xt[b].itemid > 0 then
                         doAddContainerItem(bp, xt[b].itemid, xt[b].type)
                     end
                 end
             end
         else
             doPlayerSendCancel(cid, "You can't sell this item.")
             doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         end
     end
     return true
end
Add bp ids in movements.xml.
sometimes I remember <3 limos4ever helping
 
Pumb
its work fine for me too but i need small edite when player throw items not for sala back to him again .
example player can't sell its x when he throw items x in flam the items back to his bp with msg this its not for sale.
 
Add this
Code:
doPlayerAddItem(cid, moveItem.itemid, 1)
doRemoveItem(moveItem.uid, 1)
Above this
Code:
doPlayerSendCancel(cid, "You can't sell this item.")
 
don't work like i need :S i need throw x its in flam and this items not set in script the items back to player and say this items not for sala

its work now if i throw items in backpack .
 
Back
Top