Ir para conteúdo

Featured Replies

Postado
  • Autor

 

A sim, faltou uma função, tenta agora:

 

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say("You have already received the promotion.", cid)
		return true
	end

	if msgcontains(msg:lower(), "promotion") then
		npcHandler:say("You are sure?", cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), "yes") and npcHandler.topic[cid] == 1 then
		if player:getStorageValue(STORAGEVALUE_PROMOTION) == 1 then
		    if player:getVipDays() >= 1 then
		       	if player:removeMoney(money) then
		       		npcHandler:say("You just received a new promotion.", cid)
		       		player:setVocation(player:getVocation():getPromotion():getId())
		       		player:setStorageValue(STORAGEVALUE_PROMOTION, 2)
		       		player:setStorageValue(storage, 1)
		       		npcHandler.topic[cid] = 0
		       	else
		       		npcHandler:say("You don't have money.", cid)
		       		npcHandler.topic[cid] = 0
		       	end
		    else
		       	npcHandler:say("You don't have any vip days.", cid)
		       	npcHandler.topic[cid] = 0
		    end
		else
		   	npcHandler:say("You don't have the first promotion.", cid)
		   	npcHandler.topic[cid] = 0
		end
    elseif msgcontains(msg:lower(), "no") and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Recebe a promotion, porem continua a mesma coisa, continua como "elder druid"..

1545517_5.png

  • Respostas 42
  • Visualizações 2.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcH

  • local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcH

  • Tenta isso: local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parse

Postado

Eu acho que como o andre... quer vai precisar salvar uma storage para verificar se o player tem vip e a segunda promotion, ai se o player não tiver vip a storage muda a vocação do player! apenas acho, não sei muito de scripts

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Postado

Não queria fazer tabela, mas...

 

Tenta assim então:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

local promotions = {
--[id da vocação atual] = id da vocação ganha,
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
}



local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	local player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say("You have already received the promotion.", cid)
		return true
	end

	if msgcontains(msg:lower(), "promotion") then
		npcHandler:say("You are sure?", cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), "yes") and npcHandler.topic[cid] == 1 then
		if player:getStorageValue(STORAGEVALUE_PROMOTION) == 1 then
		    if player:getVipDays() >= 1 then
		       	if player:removeMoney(money) then
		       		npcHandler:say("You just received a new promotion.", cid)
		       		player:setVocation(promotions[player:getVocation():getId()])
		       		player:setStorageValue(STORAGEVALUE_PROMOTION, 2)
		       		player:setStorageValue(storage, 1)
		       		npcHandler.topic[cid] = 0
		       	else
		       		npcHandler:say("You don't have money.", cid)
		       		npcHandler.topic[cid] = 0
		       	end
		    else
		       	npcHandler:say("You don't have any vip days.", cid)
		       	npcHandler.topic[cid] = 0
		    end
		else
		   	npcHandler:say("You don't have the first promotion.", cid)
		   	npcHandler.topic[cid] = 0
		end
    elseif msgcontains(msg:lower(), "no") and npcHandler.topic[cid] == 1 then
    	npcHandler:say('Bye!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Configuração:

 

local promotions = {
--[id da vocação atual] = id da vocação ganha,
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
}

Onde tem [ ] fica o id da vocação atual que o player tem, e onde tem = 1, é o id da vocação promovida, vê se agora resolve...

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Postado
  • Autor

Eu acho que como o andre... quer vai precisar salvar uma storage para verificar se o player tem vip e a segunda promotion, ai se o player não tiver vip a storage muda a vocação do player! apenas acho, não sei muito de scripts

Sim e bem isso.. so vai ter a promotion se for vip, caso acabe a vip volta pra promotion normal..

1545517_5.png

Postado

Sim e bem isso.. so vai ter a promotion se for vip, caso acabe a vip volta pra promotion normal..

Testa lá...

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

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.6k

Informação Importante

Confirmação de Termo