Ir para conteúdo
  • Cadastre-se

(Resolvido)Ajuda com code de baú personalizado (action, por vocation)


Ir para solução Resolvido por Weslley Kiyo,

Posts Recomendados

O que há de errado com este código?

 

Simplesmente não consigo pega-lo com nenhum char..

 

Exceto knight (detalhe que tentei com o char GOD, que é knight, rs)

 

Anyways, realiza-se a function toda, 'congratulations', a storage pra se o player for pegar de novo dar 'empty'...

 

Mas não add item algum...

 

Se alguém puder ajudar agradeço.

 

------------------------------------------

 

 

.LUA

 

local cfg = {

	kina= {2430}, 
	pala = {2173}, 
	sorc = {2189},
	drui = {8857}, 

}

function onUse(cid, item)

	if getPlayerStorageValue(cid, 38493) ~= 1 then
		if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
			doPlayerAddItem(cid, cfg.kina[1], 1)
			doPlayerAddItem(cid, cfg.kina[2], 1)
			doPlayerSendTextMessage(cid, 25, "Congratulations!!")
			doPlayerSetStorageValue(cid, 38493, 1)
		elseif getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then
			doPlayerAddItem(cid, cfg.sorc, 1)
			doPlayerSendTextMessage(cid, 25, "Congratulations!!")
			doPlayerSetStorageValue(cid, 38493, 1)
		elseif getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then
			doPlayerAddItem(cid, cfg.drui, 1)
			doPlayerSendTextMessage(cid, 25, "Congratulations!!")
			doPlayerSetStorageValue(cid, 38493, 1)
		elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
			doPlayerAddItem(cid, cfg.pala, 1)
			doPlayerSendTextMessage(cid, 25, "Congratulations!!")
			doPlayerSetStorageValue(cid, 38493, 1)
                end
	else
		doPlayerSendCancel(cid, "It's empty.")
	end

	return true
end

 

 

.XML

 

<action actionid="5511" event="script" value="simples.lua"/>

 

Link para o post
Compartilhar em outros sites
  • Solução
local cfg = {
	knight = {2430}, 
	paladin = {2173}, 
	sorcerer = {2189},
	druid = {8857}, 
}

function onUse(cid, item)

	if getPlayerStorageValue(cid, 38493) < 1 then
		if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
			if doPlayerAddItem(cid, cfg.knight[1], 1) then
				doPlayerSendTextMessage(cid, 25, "Congratulations!!")
				doPlayerSetStorageValue(cid, 38493, 1)
			else
				doPlayerSendTextMessage(cid,25,"ERROR! Please contact the administrator.")
			end
		elseif getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then
			if doPlayerAddItem(cid, cfg.sorcerer[1], 1) then
				doPlayerSendTextMessage(cid, 25, "Congratulations!!")
				doPlayerSetStorageValue(cid, 38493, 1)
			else
				doPlayerSendTextMessage(cid,25,"ERROR! Please contact the administrator.")
			end
		elseif getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then
			if doPlayerAddItem(cid, cfg.druid[1], 1) then
				doPlayerSendTextMessage(cid, 25, "Congratulations!!")
				doPlayerSetStorageValue(cid, 38493, 1)
			else
				doPlayerSendTextMessage(cid,25,"ERROR! Please contact the administrator.")
			end
		elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
			if doPlayerAddItem(cid, cfg.paladin[1], 1) then
				doPlayerSendTextMessage(cid, 25, "Congratulations!!")
				doPlayerSetStorageValue(cid, 38493, 1)
			else
				doPlayerSendTextMessage(cid,25,"ERROR! Please contact the administrator.")
			end
		end
	elseif getPlayerStorageValue(cid, 38493) >= 1 then
		doPlayerSendCancel(cid, "It's empty.")
	end
	return true
end

 

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