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

Solved [TFS 1.0] Actions/ gooey.lua

samuelav3

Member
Joined
Aug 18, 2014
Messages
95
Reaction score
5
I need help, this item when you click-on backpack disappears
but when I click-on the floor it no disappears

gooey.lua

Code:
local config = {
   [35] = {15546, 1},
   [31] = {15492, 1},
   [32] = {9971, 1},
   [33] = {7591, 2},
   [34] = {7590, 2},
   [30] = {2152, 2},
   [36] = {15487, 10},
   [37] = {5022, 1},
   [38] = {2144, 2},
}
function onUse(cid, item)
   local chance_growing = {}
   for chance, _ in pairs(config) do
      table.insert(chance_growing, chance)
   end
   table.sort(chance_growing, function(a, b) return a > b end)
   local chance = 0
   for _, v in pairs(chance_growing) do
      if math.random(100) < v then
         chance = v
         break
      end
   end
   local item = config[chance]
   if item then
      doPlayerAddItem(cid, item[1])
      doPlayerRemoveItem(cid, 15572,1)
      doSendMagicEffect(getThingPos(cid), 13)
   doRemoveItem(item.uid, 1)
   else

   end

   return true
end
 
What is the ID of the item you click use on and what should disappear that is not disappearing?
There is this
Code:
doPlayerRemoveItem(cid, 15572,1)
And this
Code:
doRemoveItem(item.uid, 1)
If ID 15572 is the item you click use on, remove the line with doPlayerRemoveItem.
The last line can be used to remove the item you click use on.
Although item is defined for the config table, so change the variable for that.
Code:
    local itemx = config[chance]
    if itemx then
         doPlayerAddItem(cid, itemx[1])
 
Back
Top