• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request] Multiple chests giving CC (crystal coin)

Oldschool'er

Tibia since 1998'
Joined
Dec 14, 2010
Messages
2,198
Reaction score
149
Location
United States
Hello and im looking for a script so you can get crystal coins from multiple chests, like 1 chest you need level 100 to open and you get 10cc, then 200 you get 20cc. can someone upload a script for me?
 
Code:
local t = {
   [10000] = {100, 2160, 10},
   [10001] = {150, 2160, 20},
   [10002] = {200, 2160, 30}
}

local storage = 84848
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local v = t[item.actionid]
   if (getPlayerLevel(cid) < v[1]) then
     return doPlayerSendCancel(cid, "You must be at least level "..v[1].."."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
   
   if (getPlayerStorageValue(cid, storage + v[1]) > 0) then
     return doPlayerSendCancel(cid, "You have already taken your reward."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
   
     doPlayerAddItem(cid, v[2], v[3])
     doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. v[3] .. " " .. getItemDescriptionsById(v[2]).plural .. "!")
     setPlayerStorageValue(cid, storage + v[1], 1)
   return true
end
 
Code:
local t = {
   [10000] = {100, 2160, 10},
   [10001] = {150, 2160, 20},
   [10002] = {200, 2160, 30}
}

local storage = 84848
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local v = t[item.actionid]
   if (getPlayerLevel(cid) < v[1]) then
     return doPlayerSendCancel(cid, "You must be at least level "..v[1].."."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
  
   if (getPlayerStorageValue(cid, storage + v[1]) > 0) then
     return doPlayerSendCancel(cid, "You have already taken your reward."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
   end
  
     doPlayerAddItem(cid, v[2], v[3])
     doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. v[3] .. " " .. getItemDescriptionsById(v[2]).plural .. "!")
     setPlayerStorageValue(cid, storage + v[1], 1)
   return true
end

thanks man your my savior!
 
Back
Top