Ir para conteúdo

Featured Replies

  • Respostas 9
  • Visualizações 657
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__MAGLEVEL then local spells = {} for index = 0, getPlayerInstantSpellCount(cid) - 1 do local spell = getPlayerInstantSpe

Postado

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 por MaXwEllDeN (veja o histórico de edições)

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Postado
  • 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

 

[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 -

5VGnDyBz.png

Postado
  • 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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo