Untitled
By: a guest | Mar 18th, 2010 | Syntax:
None | Size: 0.88 KB | Hits: 69 | Expires: Never
data/creaturescripts/scripts/login.lua
registerCreatureEvent(cid, "Reward")
data/creaturescripts/creaturescripts.xml
<event type="advance" name="Reward" event="script" value="reward.lua"/>
data/creaturescripts/scripts/reward.lua
function onAdvance(cid, skill, oldLevel, newLevel)
local cfg = {
[1000] = { -- Storage
50, -- Level
2160, -- ID
5 -- Count
},
[1001] = { -- Storage
100, -- Level
2160, -- ID
10 -- Count
}
}
if(skill == SKILL__LEVEL) then
for s, x in pairs(cfg) do
if(newLevel >= x[1]) then
if(getPlayerStorageValue(cid, s) < 1) then
doPlayerAddItem(cid, x[2], x[3])
setPlayerStorageValue(cid, s, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "CONGRATULATIONS, You've reached level " .. x[1] .. "! Here is your reward.")
break
end
end
end
end
return true
end