Postado Julho 25, 2015 9 anos Não sei se vai funcionar, testa e vê se da algum erro: local c = { [{1,5}] = { [13] = {items = {{itemid = 2191, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2188, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8921, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2189, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2187, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8920, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8922, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{2,6}] = { [13] = {items = {{itemid = 2186, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2185, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8911, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2181, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2183, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8912, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8910, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{3,7}] = { [12] = {items = {{itemid = 2389, count = 5}}, storage = 40953}, [16] = {items = {{itemid = 2389, count = 10}}, storage = 40954}, [20] = {items = {{itemid = 3965, count = 10}}, storage = 40955}, [25] = {items = {{itemid = 7378, count = 10}}, storage = 40956}, [30] = {items = {{itemid = 2456, count = 1}, {itemid = 2544, count = 100}}, storage = 40957}, [35] = {items = {{itemid = 7364, count = 100}, {itemid = 2152, count = 75}}, storage = 40958}, [40] = {items = {{itemid = 7365, count = 100}, {itemid = 2160, count = 1}}, storage = 40959} }, [{4,8}] = { [15] = {items = {{itemid = 2409, count = 1}}, storage = 40953}, [30] = {items = {{itemid = 2392, count = 1}, {itemid = 2152, count = 75}}, storage = 40957}, [40] = {items = {{itemid = 2407, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} } } function onAdvance(player, skill, oldlevel, newlevel) if skill ~= SKILL__LEVEL then return true end for voc, x in pairs(c) do if isInArray(voc, player:getVocation()) then for level, z in pairs(x) do if newlevel >= level and player:getStorageValue(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) player:addItem(z.items[v].itemid, z.items[v].count) end player:sendTextMessage(MESSAGE_INFO_DESCR, "Parabens, voce alcancou o level "..level.." e obteve "..text..".") player:sendMagicEffect(player:getPosition(), CONST_ME_FIREWORK_YELLOW) player:setStorageValue(z.storage, 1) end end end end return true end Ajudei? De nada \o/ Att Rusherzin
Postado Julho 25, 2015 9 anos Autor Não sei se vai funcionar, testa e vê se da algum erro: local c = { [{1,5}] = { [13] = {items = {{itemid = 2191, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2188, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8921, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2189, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2187, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8920, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8922, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{2,6}] = { [13] = {items = {{itemid = 2186, count = 1}}, storage = 40953}, [19] = {items = {{itemid = 2185, count = 1}}, storage = 40954}, [22] = {items = {{itemid = 8911, count = 1}}, storage = 40955}, [26] = {items = {{itemid = 2181, count = 1}}, storage = 40956}, [33] = {items = {{itemid = 2183, count = 1}, {itemid = 2152, count = 25}}, storage = 40957}, [37] = {items = {{itemid = 8912, count = 1}, {itemid = 2152, count = 50}}, storage = 40958}, [42] = {items = {{itemid = 8910, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} }, [{3,7}] = { [12] = {items = {{itemid = 2389, count = 5}}, storage = 40953}, [16] = {items = {{itemid = 2389, count = 10}}, storage = 40954}, [20] = {items = {{itemid = 3965, count = 10}}, storage = 40955}, [25] = {items = {{itemid = 7378, count = 10}}, storage = 40956}, [30] = {items = {{itemid = 2456, count = 1}, {itemid = 2544, count = 100}}, storage = 40957}, [35] = {items = {{itemid = 7364, count = 100}, {itemid = 2152, count = 75}}, storage = 40958}, [40] = {items = {{itemid = 7365, count = 100}, {itemid = 2160, count = 1}}, storage = 40959} }, [{4,8}] = { [15] = {items = {{itemid = 2409, count = 1}}, storage = 40953}, [30] = {items = {{itemid = 2392, count = 1}, {itemid = 2152, count = 75}}, storage = 40957}, [40] = {items = {{itemid = 2407, count = 1}, {itemid = 2160, count = 1}}, storage = 40959} } } function onAdvance(player, skill, oldlevel, newlevel) if skill ~= SKILL__LEVEL then return true end for voc, x in pairs(c) do if isInArray(voc, player:getVocation()) then for level, z in pairs(x) do if newlevel >= level and player:getStorageValue(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) player:addItem(z.items[v].itemid, z.items[v].count) end player:sendTextMessage(MESSAGE_INFO_DESCR, "Parabens, voce alcancou o level "..level.." e obteve "..text..".") player:sendMagicEffect(player:getPosition(), CONST_ME_FIREWORK_YELLOW) player:setStorageValue(z.storage, 1) end end end end return true end não funcionou, porém não da erro quando inicio o servidor, nem quando pego lvl 13,19, etc
Postado Julho 25, 2015 9 anos Adicionou a tag no creaturescripts.xml e registrou o evento no login.lua? Ajudei? De nada \o/ Att Rusherzin
Postado Julho 25, 2015 9 anos Autor Adicionou a tag no creaturescripts.xml e registrou o evento no login.lua? positivo, como é para tfs 1.2 eu modifiquei e puis assim; <event type="advance" name="VocReward" script="vocreward.lua"/> antes tava assim <event type="advance" name="VocReward" event="script" value="vocreward.lua"/>
Postado Julho 25, 2015 9 anos E botou algo do tipo: player:registerEvent("VocReward") No login.lua? Ajudei? De nada \o/ Att Rusherzin
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.