Ir para conteúdo

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

Featured Replies

Postado

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"/>

 

Resolvido por Weslley Kiyo

Ir para solução
Postado
  • 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

 

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