lSenturion2
Active Member
- Joined
- Oct 2, 2019
- Messages
- 124
- Reaction score
- 29
I have this script and TFS 0.4
But it dont works, i put this on my creaturescripts.xml
and this on login.lua
Code:
local c = {
[{1,5}] = { -- sorcerer
[50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
[100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
[200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
},
[{2,6}] = { -- druid
[50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
[100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
[200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
},
[{3,7}] = { -- paladin
[50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
[100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
[200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
},
[{4,8}] = { -- knight
[50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
[100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
[200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
}
}
function onAdvance(cid, skill, oldlevel, newlevel)
if skill ~= SKILL__LEVEL then
return true
end
for voc, x in pairs(c) do
if isInArray(voc, getPlayerVocation(cid)) then
for level, z in pairs(x) do
if newlevel >= level and getPlayerStorageValue(cid, z.storage) ~= 1 then
local text = ""
for v = 1, #z.items do
count, info = z.items[v].count, getItemInfo(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)
doPlayerAddItem(cid, z.items[v].itemid, z.items[v].count)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you reached level "..level.." and received "..text..".")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
setPlayerStorageValue(cid, z.storage, 1)
end
end
end
end
return true
end
Code:
<event type="advance" name="RewardLevel" event="script" value="reward.lua"/>
Code:
registerCreatureEvent(cid, "RewardLevel")