Ir para conteúdo
  • Cadastre-se

Ajuda nesse script que eu fiz


Posts Recomendados

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

Link para o post
Compartilhar em outros sites

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

Link para o post
Compartilhar em outros sites

 

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

Link para o post
Compartilhar em outros sites
  • 1 month later...
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>
Link para o post
Compartilhar em outros sites

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

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo