Ir para conteúdo

Featured Replies

Postado

Por qual fucking motivo isso não ta funcionando? Não ta dando erro nada, eu que fiz esse script pra dar item de acordo com sua vocação

 

Script


function onUse(cid, item, fromPos, item2, toPos)
 
if getPlayerStorageValue(cid, 7994) < 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Pack vocation Old Versions")
doPlayerSetStorageValue(cid, 7994, 1)
 
if (getPlayerVocation(cid) == 1) then
doPlayerAddItem(cid, 2287, 100) -- adori
doPlayerAddItem(cid, 2311, 80) -- hmm
doPlayerAddItem(cid, 2304, 40) -- gfb
doPlayerAddItem(cid, 2268, 20) -- sd
end
else if (getPlayerVocation(cid) == 2) then
doPlayerAddItem(cid, 2287, 15) -- adori
doPlayerAddItem(cid, 2271, 15) -- icicle
doPlayerAddItem(cid, 2274, 15) -- avalanche
doPlayerAddItem(cid, 2311, 30) -- hmm
doPlayerAddItem(cid, 2268, 1) -- sd
end
else if (getPlayerVocation(cid) == 3) then
doPlayerAddItem(cid, 2265, 15) -- ih
doPlayerAddItem(cid, 2273, 5) -- uh
doPlayerAddItem(cid, 2311, 20) -- hmm
doPlayerAddItem(cid, 2268, 1) -- sd
end
else if (getPlayerVocation(cid) == 4) then
doPlayerAddItem(cid, 2265, 30) -- ih
doPlayerAddItem(cid, 2273, 10) -- uh
end
end
 
 
 
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
end
 
return TRUE
end

 

Botei a actionid 7994 no bau e coloquei a tag

<action actionid="7994" script="islandpackvoc.lua" />

em actions

Postado

Você só precisa colocar 1 end para cada if, para um elseif não precisa de end. E você estava utilizando else if em vez de elseif

function onUse(cid, item, fromPos, item2, toPos)
	if getPlayerStorageValue(cid, 7994) < 1 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Pack vocation Old Versions")
		doPlayerSetStorageValue(cid, 7994, 1)

		if (getPlayerVocation(cid) == 1) then
			doPlayerAddItem(cid, 2287, 100) -- adori
			doPlayerAddItem(cid, 2311, 80) -- hmm
			doPlayerAddItem(cid, 2304, 40) -- gfb
			doPlayerAddItem(cid, 2268, 20) -- sd
		elseif (getPlayerVocation(cid) == 2) then
			doPlayerAddItem(cid, 2287, 15) -- adori
			doPlayerAddItem(cid, 2271, 15) -- icicle
			doPlayerAddItem(cid, 2274, 15) -- avalanche
			doPlayerAddItem(cid, 2311, 30) -- hmm
			doPlayerAddItem(cid, 2268, 1) -- sd
		elseif (getPlayerVocation(cid) == 3) then
			doPlayerAddItem(cid, 2265, 15) -- ih
			doPlayerAddItem(cid, 2273, 5) -- uh
			doPlayerAddItem(cid, 2311, 20) -- hmm
			doPlayerAddItem(cid, 2268, 1) -- sd
		elseif (getPlayerVocation(cid) == 4) then
			doPlayerAddItem(cid, 2265, 30) -- ih
			doPlayerAddItem(cid, 2273, 10) -- uh
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end

	return true
end

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Postado
  • Autor

 

Você só precisa colocar 1 end para cada if, para um elseif não precisa de end. E você estava utilizando else if em vez de elseif

function onUse(cid, item, fromPos, item2, toPos)
	if getPlayerStorageValue(cid, 7994) < 1 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Pack vocation Old Versions")
		doPlayerSetStorageValue(cid, 7994, 1)

		if (getPlayerVocation(cid) == 1) then
			doPlayerAddItem(cid, 2287, 100) -- adori
			doPlayerAddItem(cid, 2311, 80) -- hmm
			doPlayerAddItem(cid, 2304, 40) -- gfb
			doPlayerAddItem(cid, 2268, 20) -- sd
		elseif (getPlayerVocation(cid) == 2) then
			doPlayerAddItem(cid, 2287, 15) -- adori
			doPlayerAddItem(cid, 2271, 15) -- icicle
			doPlayerAddItem(cid, 2274, 15) -- avalanche
			doPlayerAddItem(cid, 2311, 30) -- hmm
			doPlayerAddItem(cid, 2268, 1) -- sd
		elseif (getPlayerVocation(cid) == 3) then
			doPlayerAddItem(cid, 2265, 15) -- ih
			doPlayerAddItem(cid, 2273, 5) -- uh
			doPlayerAddItem(cid, 2311, 20) -- hmm
			doPlayerAddItem(cid, 2268, 1) -- sd
		elseif (getPlayerVocation(cid) == 4) then
			doPlayerAddItem(cid, 2265, 30) -- ih
			doPlayerAddItem(cid, 2273, 10) -- uh
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end

	return true
end

 

brigadao n sabia disso

  • 1 month later...
Postado
  • Autor
Eu falo: hi, spells aparece as magias, mas qnd eu escolho uma
[Error - NpcScript Interface]
data/npc/scripts/spellseller.lua:onCreatureSay
Description:
data/npc/scripts/spellseller.lua:123: attempt to index global 't' <a nil value>
stack traceback
data/npc/scripts/spellseller.lua:123: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:423: in function 'onCreatureSay'
data/npc/scripts/spellseller.lua:81: in funcion <data/npc/scripts/spellseller.lua:81>
Postado

Passei o olho rapidamente e esse erro:

global 't' <a nil value>

Quer dizer que tem uma variável "t" sem valor no meio do script...

apague o t , e veja quais erros restam ...

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

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