Hello, this scripts works as all reward is in the same chest.
Etc, if you claim nr 1 reward on level 20, it say "You have claimed your reward, come back when you are level 50 for next reward"
(I want to bring an big thanks to summ also)
Etc, if you claim nr 1 reward on level 20, it say "You have claimed your reward, come back when you are level 50 for next reward"
(I want to bring an big thanks to summ also)
LUA:
local config = {
{lvl = 20, rewards = {2160, 10}, storage = 5182},
{lvl = 50, rewards = {2160, 25}, storage = 5183},
{lvl = 100, rewards = {2160, 50}, storage = 5184},
}
function onUse(cid,item,fromPosition,itemEx,toPosition)
local level = getPlayerLevel(cid)
for i = 1, #config do
if getPlayerStorageValue(cid, config[i].storage) < 1 then
if level < config[i].lvl then
doPlayerSendCancel(cid, "You need to be level " .. config[i].lvl .. " to receive this reward.")
else
doPlayerAddItem(cid, config[i].rewards[1], config[i].rewards[2])
doPlayerSetStorageValue(cid, config[i].storage, 1)
if config[i + 1] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have get the reward for level " .. config[i].lvl .. "! Come back when you are level " .. config[i + 1].lvl .. " to claim next reward! ")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have get the reward for level " .. config[i].lvl .. "! This was the last reward..")
end
return true
end
break
end
if i == #config then
doPlayerSendCancel(cid, "You already claimed all rewards.")
end
end
return true
end
Last edited: