Postado Janeiro 18, 2015 10 anos Gostaria de saber que alguém conseguira fazer esse script quando player upar mostrar no console quais spells ja foi utilizadas Editado Janeiro 19, 2015 10 anos por loreal (veja o histórico de edições) I like
Postado Janeiro 18, 2015 10 anos Não cheguei a testar creaturescripts/scripts/advancespells.lua if not SERVER_SPELLS then SERVER_SPELLS = {} local file = io.open("data/spells/spells.xml") local str = file:read("*all") file:close() for line in str:gmatch("<instant name=\"(.-)</instant>") do for voc in line:gmatch("<vocation id=\"(.-)\"") do for _, vocation in pairs(string.explode(voc, ";")) do if SERVER_SPELLS[tonumber(vocation)] then table.insert(SERVER_SPELLS[tonumber(vocation)], line:match("(.-)\"")) else SERVER_SPELLS[tonumber(vocation)] = {line:match("(.-)\"")} end end end end end function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL then local str = "" for _, name in pairs(SERVER_SPELLS[getPlayerVocation(cid)]) do local spell = getInstantSpellInfo(false, name) if spell.level > oldLevel and spell.level <= newLevel then str = str .. "\n [".. name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]" end end if str ~= "" then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have just advanced to level ".. newLevel .." and learned new spells!" .. str) end end return true end creaturescripts/creaturescripts.xml <event type="advance" name="AdvLevelSpells" event="script" value="advancespells.lua" /> No seu arquivo creaturescripts/scritps/login.lua adicione a seguinte linha ANTES DO ÚLTIMO return true: registerCreatureEvent(cid, "AdvLevelSpells") Exemplo: registerCreatureEvent(cid, "AdvLevelSpells") return true end Editado Janeiro 19, 2015 10 anos por MaXwEllDeN (veja o histórico de edições) -"Supra Omnes Lux Lucis" - Acima de todos brilha a Luz -
Postado Janeiro 18, 2015 10 anos Autor Não cheguei a testar creaturescripts/scripts/advancespells.lua if not SERVER_SPELLS then SERVER_SPELLS = {} local file = io.open("data/spells/spells.xml") local file = io.open("C:/spells.xml") local str = file:read("*all") file:close() for line in str:gmatch("<instant name=\"(.-)/>") do for voc in line:gmatch("<vocation id=\"(.-)\"") do for _, vocation in pairs(string.explode(voc, ";")) do if SERVER_SPELLS[tonumber(vocation)] then table.insert(SERVER_SPELLS[tonumber(vocation)], line:match("(.-)\"")) else SERVER_SPELLS[tonumber(vocation)] = {line:match("(.-)\"")} end end end end end function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__LEVEL then local str = "" for _, name in pairs(SERVER_SPELLS[getPlayerVocation(cid)]) do local spell = getInstantSpellInfo(false, name) if spell.level > oldLevel and spell.level <= newLevel then str = str .. "\n [".. name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]" end end if str ~= "" then doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have just advanced to level ".. newLevel .." and learned new spells!" .. str) end end return true end creaturescripts/creaturescripts.xml <event type="advance" name="AdvLevelSpells" event="script" value="advancespells.lua" /> No seu arquivo creaturescripts/scritps/login.lua adicione a seguinte linha ANTES DO ÚLTIMO return true: registerCreatureEvent(cid, "AdvLevelSpells") Exemplo: registerCreatureEvent(cid, "AdvLevelSpells") return true end [18/1/2015 9:37:11] [Error - Test Interface] [18/1/2015 9:37:11] data/creaturescripts/scripts/advancespells.lua [18/1/2015 9:37:11] Description: [18/1/2015 9:37:11] data/creaturescripts/scripts/advancespells.lua:6: attempt to index local 'file' (a nil value) [18/1/2015 9:37:11] [Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/advancespells.lua) I like
Postado Janeiro 18, 2015 10 anos [18/1/2015 9:37:11] [Error - Test Interface] [18/1/2015 9:37:11] data/creaturescripts/scripts/advancespells.lua [18/1/2015 9:37:11] Description: [18/1/2015 9:37:11] data/creaturescripts/scripts/advancespells.lua:6: attempt to index local 'file' (a nil value) [18/1/2015 9:37:11] [Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/advancespells.lua) Opa, perdão. Uma linha que acabei esquecendo de tirar enquanto testava o código. Pode copiar de novo no meu antigo post! -"Supra Omnes Lux Lucis" - Acima de todos brilha a Luz -
Postado Janeiro 19, 2015 10 anos Autor Opa, perdão. Uma linha que acabei esquecendo de tirar enquanto testava o código. Pode copiar de novo no meu antigo post! agra deu certo só que tem muita magia que n ta mostrando so mostra umas 3 dps n mostra mais , exp: n mostra que pode usar utamo vita,utani gran hur, magias de ml etc I like
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.