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

Requesting Chest Script

Finduz

New Member
Joined
Nov 13, 2014
Messages
40
Reaction score
0
Hello,
I've been searching all over otland but I can't find anything like this.

I played on a server where there was a chest in the temple which would give you some cash every 2 hours.
And if you tried to click the chest before the 2 hours were up you would get a message that tells you how much longer you need to wait.

Does anyone know how to make a script like that?

I hope I put it clearly enough!
Thanks!
 
And if it was my server you were talking about here is the script i used. Its also the same one they linked you to so credits to the real owner.
Code:
local config = {
     exhausttime = 7200, -- time in seconds
     exhauststorage = 2301
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

     local rewarditems = {
         {id = 2160, count = math.random(1, 2)},
         {id = 2160, count = math.random(1, 5)},
         {id = 2160, count = math.random(1, 10)},
         {id = 2160, count = math.random(1, 15)}
     }

     if exhaustion.check(cid, config.exhauststorage) then
         local time = exhaustion.get(cid, config.exhauststorage)
         local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
         if time >= 3600 then
             text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
         elseif time >= 120 then
             text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
         else
             text = seconds.." "..(seconds > 1 and "seconds" or "second")
         end
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "It is empty. You need to wait "..text.." before you can get a reward again.")
         return true
     end

     local i = math.random(1, #rewarditems)
     local info = getItemInfo(rewarditems[i].id)
     if rewarditems[i].count > 1 then
         text = rewarditems[i].count .. " " .. info.plural
     else
         text = info.article .. " " .. info.name
     end

     local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count)
     if doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         text = "You have found a reward. It is too heavy or you have not enough space."
     else
         text = "You have found " .. text .. "."
         exhaustion.set(cid, config.exhauststorage, config.exhausttime)
     end
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
     return true
end
 
Now I get this error message in the launcher.
And I have nooo idea what to do about it, feel like I've tried everything!

[16/11/2014 18:38:30] [Error - Action Interface]
[16/11/2014 18:38:30] data/actions/scripts/quests/timechest.lua:eek:nUse
[16/11/2014 18:38:30] Description:
[16/11/2014 18:38:30] data/actions/scripts/quests/timechest.lua:38: attempt to compare number with nil
[16/11/2014 18:38:30] stack traceback:
[16/11/2014 18:38:30] data/actions/scripts/quests/timechest.lua:38: in function <data/actions/scripts/quests/timechest.lua:8>
 
Back
Top