• 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
 
can someone tell me the main script that works? its not working for me and i have this...

im also using 0.3.6

Code:
local items = {
   [2181] = 5000,
   [8885] = 25000,
   [2519] = 8000,
   [2392] = 4000,
   [8910] = 12000,
   [8871] = 8000,
   [2393] = 20000,
   [2528] = 10000,
   [2195] = 7000,
   [2516] = 3000,
   [2498] = 15000,
   [2492] = 10000,
   [2656] = 12000,
   [2514] = 15000,
   [2472] = 30000,
   [2520] = 8000,
   [2470] = 15000,
   [2503] = 50000,
   [7897] = 11000,
   [2466] = 10000,
   [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
 
Back
Top