natanal99
New Member
- Joined
- May 31, 2011
- Messages
- 67
- Reaction score
- 3
So my problem is simpe i have this script made by @Limos i think, and i want to limit it by account.
By now each player can do the quest each day, i want that each account can do the qeust for each day, is it possible?
By now each player can do the quest each day, i want that each account can do the qeust for each day, is it possible?
Code:
local config = {
storage = 24003,
exstorage = 24004,
days = {
["Monday"] = {
{itemid = 11198, count = {1}}
},
["Tuesday"] = {
{itemid = 11198, count = {1}}
},
["Wednesday"] = {
{itemid = 11198, count = {1}}
},
["Thursday"] = {
{itemid = 11198, count = {1}}
},
["Friday"] = {
{itemid = 11198, count = {1}}
},
["Saturday"] = {
{itemid = 11198, count = {2}}
},
["Sunday"] = {
{itemid = 11198, count = {2}}
}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = config.days[os.date("%A")]
if getPlayerStorageValue(cid, config.storage) == tonumber(os.date("%w")) and exhaustion.check(cid, config.exstorage) then
return doPlayerSendCancel(cid, "The chest is empty, come back tomorrow for a new reward.")
end
local c = math.random(#x)
local info, count = getItemInfo(x[c].itemid), x[c].count[2] and math.random(x[c].count[1], x[c].count[2]) or x[c].count[1]
if count > 1 then
text = count .. " " .. info.plural
else
text = info.article .. " " .. info.name
end
local itemx = doCreateItemEx(x[c].itemid, count)
if doPlayerAddItemEx(cid, itemx, false) ~= RETURNVALUE_NOERROR then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
text = "You have found a reward weighing " .. getItemWeight(itemx) .. " oz. It is too heavy or you have not enough space."
else
text = "You have received " .. text .. "."
setPlayerStorageValue(cid, config.storage, tonumber(os.date("%w")))
exhaustion.set(cid, config.exstorage, 24*60*60)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
return true
end