Wazzap
Killing Elite
Data/Actions/Scripts/levelchest.lua
Data/Actions/actions.xml
8733 - change this to UniqueID yours
Thx
local config = {
rewards = { -- rewards (nagrody)
[1] = {level = 15,[1] = {itemid = 2460, count = 1},[2] = {itemid = 2160, count = 2}},
},
storageid = 4679 -- using storage (uzywany storage)
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local str = ""
closestid = getPlayerStorageValue(cid,config.storageid) + 1
if closestid == 0 then closestid = 1 end
if closestid <= #config.rewards then
if getPlayerLevel(cid) >= config.rewards[closestid].level then
str = str .. "You opened the level chest for level " .. config.rewards[closestid].level .. " and you have gained "
for i = 1, #config.rewards[closestid] do
doPlayerAddItem(cid,config.rewards[closestid].itemid,config.rewards[closestid].count)
if config.rewards[closestid].count > 1 then before = "" .. config.rewards[closestid].count .. "" name = "" .. getItemPluralNameById(config.rewards[closestid].itemid) .. ""
else before = "" .. getItemArticleById(config.rewards[closestid].itemid) .. "" name = "" .. getItemNameById(config.rewards[closestid].itemid) .. "" end
str = str .. "" .. before .. " " .. name .. ""
if i < #config.rewards[closestid] then str = str .. ", " end
end
str = str .. "."
effect = math.random(28,30)
doSendMagicEffect(getPlayerPosition(cid),effect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT,str)
setPlayerStorageValue(cid,config.storageid,closestid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have to be at least level " .. config.rewards[closestid].level .. " to get your rewards now.")
return true
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT,"You have already get all your rewards.")
return true
end
return true
end
Data/Actions/actions.xml
<action uniqueid="8733" event="script" value="levelchest.lua"/>
8733 - change this to UniqueID yours
Thx