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

TFS 1.X+ Reward Chest + Daily reward error.

luhfe

New Member
Joined
Apr 26, 2018
Messages
48
Reaction score
2
Every time use the Chest return that error in server console :
cNBcfP.png

The script has work at all but i want remove that, every time a player without reward to take use that return this error...


Lua:
function onUse(player, item)
if RewardChest() < 1 then
    player:updateRewardChest()
    else
    end
    return false
end
Actions/Scripts/RewardChest.lua

--------------------------------------------------

Another ask is if some1 have a script to Daily Reward with chance and level, WITHOUT Storage system.
I try use the Limos script but dont work to me !


Lua:
-- Time Chest by Limos
local config = {
   exhausttime = 7200, -- time in seconds
   exhauststorage = 2301,
   level = 150 -- minimum level to open the chest
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
     local rewarditems = {
         {id = 2492, chance = 5, count = 1}, -- start with the lowest chances
         {id = 2498, chance = 10, count = 1},
         {id = 2488, chance = 15, count = 1},
         {id = 2152, chance = 70, count = math.random(1, 50)}
     }
     if getPlayerLevel(cid) < config.level then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendCancel(cid, "You need to be level "..config.level.." to open the chest.")
         return true
     end
     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 chance = math.random(1,100)
     for i = 1, #rewarditems, 1 do
         if chance < rewarditems[i].chance then
             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 to 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
         else
             chance = chance - rewarditems[i].chance
         end
     end
end
 
Back
Top