BrutalTibia
New Member
- Joined
- Nov 24, 2011
- Messages
- 7
- Reaction score
- 0
Hi!
Anybody know how to do this? Thanks =)
Anybody know how to do this? Thanks =)
function onAdvance(cid, skill, oldLevel, newLevel)
local config = {
[20] = {item = 2160, count = 5},
[50] = {item = 2160, count = 5},
[100] = {item = 2160, count = 5},
[110] = {item = 2160, count = 5},
[120] = {item = 2160, count = 5},
[130] = {item = 2160, count = 5},
[140] = {item = 2160, count = 5},
[150] = {item = 2160, count = 5},
[160] = {item = 2160, count = 5},
[170] = {item = 2160, count = 5},
[180] = {item = 2160, count = 5},
[190] = {item = 2160, count = 5},
[200] = {item = 2160, count = 5},
[210] = {item = 2160, count = 5},
[220] = {item = 2160, count = 5},
[230] = {item = 2160, count = 5},
[240] = {item = 2160, count = 5},
[250] = {item = 2160, count = 5},
[260] = {item = 2160, count = 5},
[270] = {item = 2160, count = 5},
[280] = {item = 2160, count = 5},
[290] = {item = 2160, count = 5},
[300] = {item = 2160, count = 5},
[320] = {item = 2160, count = 5},
[330] = {item = 2160, count = 5},
[340] = {item = 2160, count = 5},
[350] = {item = 2160, count = 5},
[360] = {item = 2160, count = 5},
[370] = {item = 2160, count = 5},
[380] = {item = 2160, count = 30},
[390] = {item = 2160, count = 40},
[400] = {item = 2160, count = 50},
}
if skill == 8 then
for level, info in pairs(config) do
if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
doPlayerAddItem(cid, info.item, info.count)
doPlayerSendTextMessage(cid, 27, "Parabéns Guerreiro você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'"
setPlayerStorageValue(cid, 30700, sat)
end
end
end
return TRUE
end
<event type="advance" name="reward" event="script" value="prize.lua"/>
local t = {
-- [storage], level, itemid, count
[15512] = {50, 2160, 5}
}
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == SKILL__LEVEL then
for storage, v in pairs(t) do
if newLevel >= v[1] and getPlayerStorageValue(cid, storage) < 1 then
doPlayerAddItem(cid, v[2], v[3])
setPlayerStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "CONGRATULATIONS! You've reached level " .. v[1] .. ".")
break
end
end
end
return true
end