Ir para conteúdo

Featured Replies

Postado

Ola galera boa noite , entao eu tenho um script de um npc de missao so que ele so remove um iten do player eu queria que ele removesse 5 itens com certas quantidade para ganhar um unico iten.

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

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

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'quest')) then

selfSay('To start this quest tell {mission}', cid) --This is just an example, In this script added 4 mission for you 

end

	if(msgcontains(msg, 'mission')) then

    	if(getPlayerStorageValue(cid,700) < 1) then

        	selfSay('Sua primeira missão será a de obter 100 Penas ,120 Sushi ,150 Largatixa ,100 Coraçao ,115 Marijuana  Para Ganhar um {Demonhunter Doll}.', cid)

        	talkState[talkUser] = 1

    	elseif (getPlayerStorageValue(cid,701) < 1) then

            	selfSay('Your next mission will be to get 150 {strands of medusa hair}.', cid)

            	talkState[talkUser] = 1

    	elseif (getPlayerStorageValue(cid,702) < 0) then

            	selfSay('Your next mission will be to get 300 {red dragon scales}.', cid)

            	talkState[talkUser] = 1
				
	   elseif (getPlayerStorageValue(cid,703) < 0) then

            	selfSay('Your next mission will be to get 300 {red dragon scales}.', cid)

            	talkState[talkUser] = 1	

    	elseif (getPlayerStorageValue(cid,704) < 0) then

            	selfSay('Your next mission will be to get 400 {green dragon scales}.', cid)

            	talkState[talkUser] = 1





    	elseif (getPlayerStorageValue(cid,703) == 1) then --zmieniac w zaleznosci od ostatniego storage!!

            	selfSay('You have done all missions.', cid)

            	talkState[talkUser] = 1





    	end

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

    	elseif(msgcontains(msg, 'Demonhunter Doll') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,700) < 1)) then

    	if(doPlayerRemoveItem(cid, 12597, 100) == TRUE) then

        	setPlayerStorageValue(cid,700,1)

        	doPlayerAddItem(cid,8821, 1) -- Recompensa

        	selfSay('Thank you.', cid)

        	talkState[talkUser] = 0

    	else

        	selfSay('Voçe nao tem todo os itens para ganhar um {Demonhunter Doll}.', cid)

    	end

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

    	elseif(msgcontains(msg, 'strands of medusa hair') and talkState[talkUser] == 1  and (getPlayerStorageValue(cid,701) < 1) and (getPlayerStorageValue(cid,700) == 1)) then

    	if(doPlayerRemoveItem(cid, 12597, 150) == TRUE) then

        	setPlayerStorageValue(cid,701,1)

        	doPlayerAddItem(cid,8821, 1) -- Recompensa

        	selfSay('Thank you.', cid)

        	talkState[talkUser] = 0

    	else

        	selfSay('To end mission you need have 150 {strands of medusa hair}.', cid)

    	end

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

    	elseif(msgcontains(msg, 'red dragon scales') and talkState[talkUser] == 1  and (getPlayerStorageValue(cid,702) < 1) and (getPlayerStorageValue(cid,701) == 1)) then

    	if(doPlayerRemoveItem(cid, 5882, 300) == TRUE) then

        	setPlayerStorageValue(cid,702,1)

        	doPlayerAddPercentLevel(cid, 6)

        	selfSay('Thank you.', cid)

        	talkState[talkUser] = 0

    	else

        	selfSay('To end mission you need have 300 {red dragon scales}.', cid)

    	end

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

    	elseif(msgcontains(msg, 'green dragon scales') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,703) < 1) and (getPlayerStorageValue(cid,702) == 1)) then

    	if(doPlayerRemoveItem(cid, 5920, 400) == TRUE) then

        	setPlayerStorageValue(cid,703,1)

        	doPlayerAddPercentLevel(cid, 5)

        	selfSay('Thank you.', cid)

        	talkState[talkUser] = 0

    	else

        	selfSay('To end mission you need have 400 {green dragon scales}.', cid)

    	end

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


	end

end    

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Postado
  • Autor

Boa noite irmao , nesse script ai em cima tem so pra remover um item do player , eu queria que ele removesse 5 itens nessa parte tipo 

o npc pediria para o player  os seguinte itens com quantidade.

    idIten/Quantidade

ex: 2160- 100

     2157- 10

     5881- 20

     5880- 150

     5882- 200

Assim so que ai em baixo so remove do player o iten 12597 , queria por mas itens ai.

    	elseif(msgcontains(msg, 'Demonhunter Doll') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,700) < 1)) then

    	if(doPlayerRemoveItem(cid, 12597, 100) == TRUE) then

        	setPlayerStorageValue(cid,700,1)

        	doPlayerAddItem(cid,8821, 1) -- Recompensa

        	selfSay('Thank you.', cid)

        	talkState[talkUser] = 0

    	else

        	selfSay('Voçe nao tem todo os itens para ganhar um {Demonhunter Doll}.', cid)

    	end
Postado
local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

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

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

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

local tab = {
	item = {2157, 10}, -- ID do item, quantidade
	item2 = {2157, 10}, -- ID do item, quantidade
	item3 = {2157, 10}, -- ID do item, quantidade
	item4 = {2157, 10}, -- ID do item, quantidade
	item5 = {2157, 10} -- ID do item, quantidade
	}
if(msgcontains(msg, 'quest')) then
selfSay('To start this quest tell {mission}', cid) --This is just an example, In this script added 4 mission for you 
end

	if(msgcontains(msg, 'mission')) then
    	if(getPlayerStorageValue(cid,700) < 1) then
        	selfSay('Sua primeira missão será a de obter 100 Penas ,120 Sushi ,150 Largatixa ,100 Coraçao ,115 Marijuana  Para Ganhar um {Demonhunter Doll}.', cid)
        	talkState[talkUser] = 1
    	elseif (getPlayerStorageValue(cid,701) < 1) then
            	selfSay('Your next mission will be to get 150 {strands of medusa hair}.', cid)
            	talkState[talkUser] = 1
    	elseif (getPlayerStorageValue(cid,702) < 0) then
            	selfSay('Your next mission will be to get 300 {red dragon scales}.', cid)
            	talkState[talkUser] = 1
		elseif (getPlayerStorageValue(cid,703) < 0) then
            	selfSay('Your next mission will be to get 300 {red dragon scales}.', cid)
            	talkState[talkUser] = 1	
    	elseif (getPlayerStorageValue(cid,704) < 0) then
            	selfSay('Your next mission will be to get 400 {green dragon scales}.', cid)
            	talkState[talkUser] = 1
    	elseif (getPlayerStorageValue(cid,703) == 1) then --zmieniac w zaleznosci od ostatniego storage!!
            	selfSay('You have done all missions.', cid)
            	talkState[talkUser] = 1
    	end

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

    	elseif(msgcontains(msg, 'Demonhunter Doll') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,700) < 1)) then
		if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and
			getPlayerItemCount(cid, tab.item2[1]) >= tab.item2[2] and 
			getPlayerItemCount(cid, tab.item3[1]) >= tab.item3[2] and
			getPlayerItemCount(cid, tab.item4[1]) >= tab.item4[2] and
			getPlayerItemCount(cid, tab.item5[1]) >= tab.item5[2]) then
			doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
			doPlayerRemoveItem(cid, tab.item2[1], tab.item2[2])
			doPlayerRemoveItem(cid, tab.item3[1], tab.item3[2])
			doPlayerRemoveItem(cid, tab.item4[1], tab.item4[2])
			doPlayerRemoveItem(cid, tab.item5[1], tab.item5[2])
        	setPlayerStorageValue(cid,700,1)
        	doPlayerAddItem(cid,8821, 1) -- Recompensa
        	selfSay('Thank you.', cid)
        	talkState[talkUser] = 0
    	else
        	selfSay('Voçe nao tem todos os itens para ganhar um {Demonhunter Doll}.', cid)
    	end
    	---------------------------------------
    	elseif(msgcontains(msg, 'strands of medusa hair') and talkState[talkUser] == 1  and (getPlayerStorageValue(cid,701) < 1) and (getPlayerStorageValue(cid,700) == 1)) then
    	if(doPlayerRemoveItem(cid, 12597, 150) == TRUE) then
        	setPlayerStorageValue(cid,701,1)
        	doPlayerAddItem(cid,8821, 1) -- Recompensa
        	selfSay('Thank you.', cid)
        	talkState[talkUser] = 0
    	else
        	selfSay('To end mission you need have 150 {strands of medusa hair}.', cid)
    	end
    	---------------------------------------
    	elseif(msgcontains(msg, 'red dragon scales') and talkState[talkUser] == 1  and (getPlayerStorageValue(cid,702) < 1) and (getPlayerStorageValue(cid,701) == 1)) then
    	if(doPlayerRemoveItem(cid, 5882, 300) == TRUE) then
        	setPlayerStorageValue(cid,702,1)
        	doPlayerAddPercentLevel(cid, 6)
        	selfSay('Thank you.', cid)
        	talkState[talkUser] = 0
    	else
        	selfSay('To end mission you need have 300 {red dragon scales}.', cid)
    	end
    	---------------------------------------
    	elseif(msgcontains(msg, 'green dragon scales') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,703) < 1) and (getPlayerStorageValue(cid,702) == 1)) then
    	if(doPlayerRemoveItem(cid, 5920, 400) == TRUE) then
        	setPlayerStorageValue(cid,703,1)
        	doPlayerAddPercentLevel(cid, 5)
        	selfSay('Thank you.', cid)
        	talkState[talkUser] = 0
    	else
        	selfSay('To end mission you need have 400 {green dragon scales}.', cid)
    	end
    	------------------------------------------
	end
end    

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

@churupetinha

 

Assim?

Editado por Kemmlly (veja o histórico de edições)

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