Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Gostaria de saber que alguém conseguira fazer esse script quando player upar mostrar no console quais spells ja foi utilizadas

Editado por loreal (veja o histórico de edições)

I like

Link para o post
Compartilhar em outros sites
  • Respostas 9
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

function onAdvance(cid, skill, oldLevel, newLevel) if skill == SKILL__MAGLEVEL then local spells = {} for index = 0, getPlayerInstantSpellCount(cid) - 1 do local spell = getPlayerInstantSpellInfo(cid, index) doCreatureSay(cid, spell.mlevel) if spell.mlevel > oldLevel and spell.mlevel <= newLevel then table.insert(spells, " [".. spell.name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]") end end if #spells > 0 then doPlayerSendTextMessage(cid

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

Link para o post
Compartilhar em outros sites
  Em 18/01/2015 em 09:37, MaXwEllDeN disse:

 

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

Link para o post
Compartilhar em outros sites
  Em 18/01/2015 em 11:37, loreal disse:

 

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

 

Mostrar mais  

 

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

Link para o post
Compartilhar em outros sites
  Em 18/01/2015 em 20:01, MaXwEllDeN disse:

Opa, perdão. Uma linha que acabei esquecendo de tirar enquanto testava o código. Pode copiar de novo no meu antigo post!

Expand   Mostrar mais  

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

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96844
    Tópicos
    519600
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo