beenii
Well-Known Member
- Joined
- Jul 26, 2010
- Messages
- 586
- Solutions
- 1
- Reaction score
- 58
Code:
local storage = 25000
local level_reward = {
[100] = {items = {{itemid = 2191, count = 1}, {itemid = 7618, count = 20}}},
[150] = {items = {{itemid = 8921, count = 1}, {itemid = 7620, count = 50}}},
[250] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
[300] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
[350] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
[400] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
[450] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}},
[500] = {items = {{itemid = 2187, count = 1}, {itemid = 7620, count = 50}}}
}
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
if player:getStorageValue(storage) == tonumber(os.date("%w")) then
return player:sendCancelMessage("The chest is empty, come back tomorrow for a new reward.")
end
for lvl, x in pairs(level_reward) do
for lvl, z in pairs(x) do
local text = ""
for v = 1, #z.items do
count, info = z.items[v].count, getItemDescriptions(z.items[v].itemid)
local ret = ", "
if v == 1 then
ret = ""
elseif v == #z.items then
ret = " and "
end
text = text .. ret
text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name)
player:addItem(z.items[v].itemid, z.items[v].count)
end
player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations, you reached level "..level.." and received "..text..".")
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
player:setStorageValue(storage, tonumber(os.date("%w")))
end
end
end
have this error: