Ir para conteúdo
  • 0

Npc retira item


godjean

Pergunta

Tipo acabei de cria um npc tudo certo ele tira os itens e poem o item que eu quero mas ha um porem ele não ta pedindo todos os items por exemplo eu tiro um item e falo yes ele troca do mesmo jeito :S

 

ae o script do npc

elseif(msgcontains(msg, 'elemental necklace') or msgcontains(msg, 'Elemental Necklace')) then
selfSay('You change a mysterious, dragon breath, scorpion, platinum, fluids and vampire tooth,change all for a Elemental necklace?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
		if doPlayerRemoveItem(cid,2201,1) == 0 then
			elseif doPlayerRemoveItem(cid,2198,1) == 0 then
			elseif doPlayerRemoveItem(cid,2170,1) == 0 then
			elseif doPlayerRemoveItem(cid,2171,1) == 0 then
			elseif doPlayerRemoveItem(cid,2172,1) == 0 then
			elseif doPlayerRemoveItem(cid,2161,1) == 0 then
elseif doPlayerAddItem(cid,2197,1) == 0 then
 selfSay('change the amulet\'s for one elemental necklace sucessfull.')
else
 selfSay('change the amulet\'s for one elemental necklace sucessfull.')
end

E tambem outro script tipo se vc não tiver o dinheiro ele retira o item poem outro e retira o outro e vc fica com nada:@

elseif(msgcontains(msg, 'energyze elemental necklace') or msgcontains(msg, 'Energyze Elemental Necklace')) then
selfSay('I can energyze your elemental necklace for 50k, would you like to energyza?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then 
if(doPlayerRemoveItem(cid, 2197, 1) == true) then 
if(doPlayerRemoveMoney(cid, 50000) == true) then 
selfSay('Thanks!', cid)
doPlayerAddItem(cid, 11962, 1)
talkState[talkUser] = 0
else 
selfSay('You do not have enough diamonds.', cid)
talkState[talkUser] = 0 
end
end

Editado por GodJean
Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Passa o script do npc intero ai, e me explica direito que eu te ajudo.

 

Testa esse

 

elseif(msgcontains(msg, 'energyze elemental necklace') or msgcontains(msg, 'Energyze Elemental Necklace')) then
selfSay('I can energyze your elemental necklace for 50k, would you like to energyza?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if doPlayerRemoveItem(cid, 2197, 1) == true and doPlayerRemoveMoney(cid, 50000) == true then

selfSay('Thanks!', cid)
doPlayerAddItem(cid, 11962, 1)
talkState[talkUser] = 0
else
selfSay('You do not have enough diamonds.', cid)
talkState[talkUser] = 0
end

 

 

elseif(msgcontains(msg, 'elemental necklace') or msgcontains(msg, 'Elemental Necklace')) then
selfSay('You change a mysterious, dragon breath, scorpion, platinum, fluids and vampire tooth,change all for a Elemental necklace?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
  if doPlayerRemoveItem(cid,2201,1) and doPlayerRemoveItem(cid,2198,1) and doPlayerRemoveItem(cid,2170,1) and doPlayerRemoveItem(cid,2171,1) and doPlayerRemoveItem(cid,2172,1) and doPlayerRemoveItem(cid,2161,1) then

 doPlayerAddItem(cid,2197,1)
 selfSay('change the amulet\'s for one elemental necklace sucessfull.')
else
 selfSay('change the amulet\'s for one elemental necklace sucessfull.')
end

Editado por dragonfight
Link para o comentário
Compartilhar em outros sites

  • 0

Esse é o script todo (ta meio bagunçado)

 

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 

-- Conversa Jogador/NPC 
if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then
selfSay('I can make an item element or amulets energyze your item element, I just need all "paste", "charm" or "spells" amulet, can also bless a mortal and reset a little god! To see what types of necklaces I say energyze "energyze amulets".', cid)
elseif(msgcontains(msg, 'energyze amulets') or msgcontains(msg, 'Energyze Amulets')) then
selfSay('I can tell your amulet energyze just say "energyze elemental necklace" "energyze elemental spirit amulet" "energyze elemental magic amulet.', cid)
--talkState[talkUser] = 1
elseif(msgcontains(msg, 'bless') or msgcontains(msg, 'Bless')) then
selfSay('want to buy bless?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'energyze elemental necklace') or msgcontains(msg, 'Energyze Elemental Necklace')) then
selfSay('I can energyze your elemental necklace for 50k, would you like to energyza?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'elemental necklace') or msgcontains(msg, 'Elemental Necklace')) then
selfSay('You change a mysterious, dragon breath, scorpion, platinum, fluids and vampire tooth,change all for a Elemental necklace?', cid)
talkState[talkUser] = 4 
elseif(msgcontains(msg, 'energyze spirit elemental amulet') or msgcontains(msg, 'Energyze Spirit Elemental Amulet')) then
selfSay('I can energyze your spirit elemental amulet for 100k, would you like to energyza?', cid)
talkState[talkUser] = 5
elseif(msgcontains(msg, 'spirit elemental amulet') or msgcontains(msg, 'Spirit Elemental Amulet')) then
selfSay('You change a need a Ialamar, frozzen, sickness, Samantha, Mastafar, priest and eletric, change for a Spirit Elemental amulet?', cid)
talkState[talkUser] = 6
elseif(msgcontains(msg, 'energyze magic elemental amulet') or msgcontains(msg, 'Energyze Magic Elemental Amulet')) then
selfSay('I can energyze your magic elemental amulet for 150k, would you like to energyza?', cid)
talkState[talkUser] = 7 
elseif(msgcontains(msg, 'magic elemental amulet') or msgcontains(msg, 'Magic Elemental Amulet')) then
selfSay('You change a Merlian, relic of the hell, Broonier, Thordain, dark wyzard, angel and gaya,change all for Elemental magic amulet?', cid)
talkState[talkUser] = 8 
elseif(msgcontains(msg, 'poem scroll') or msgcontains(msg, 'Poem Scroll')) then
selfSay('Our beautiful that parchment ... Our ancient scriptures that it is very important for my pesquisa.You trade him for an Arcane Wand?', cid)
talkState[talkUser] = 9 

-- Confirmação da Compra 
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then 
if getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5) then
selfSay('You have already got one or more blessings!', cid)
else
if(doPlayerRemoveMoney(cid, 500000) == true) then
selfSay('You received the blessing of Isolde.', cid)
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
talkState[talkUser] = 0
else
selfSay('Sorry, but you do not have enough money.', cid)
talkState[talkUser] = 0 
end
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then 
if(doPlayerRemoveItem(cid, 2197, 1) == true) then 
if(doPlayerRemoveMoney(cid, 50000) == true) then 
selfSay('Thanks!', cid)
doPlayerAddItem(cid, 11962, 1)
talkState[talkUser] = 0
else 
selfSay('You do not have enough diamonds.', cid)
talkState[talkUser] = 0 
end
end
--------------------------------------------------------------------------------
--elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then 
--if (doPlayerRemoveItem(cid,2198,1)== true) then 
--if (doPlayerRemoveItem(cid,2170,1)== true) then 
--if (doPlayerRemoveItem(cid,2171,1)== true) then 
--if (doPlayerRemoveItem(cid,2172,1)== true) then 
--if (doPlayerRemoveItem(cid,2161,1)== true) then 
--if (doPlayerRemoveItem(cid,2201,1)== true) then
--		    if doPlayerRemoveItem(cid,2201,1) == 0 then
--			    elseif doPlayerRemoveItem(cid,2198,1) == 0 then
--			    elseif doPlayerRemoveItem(cid,2170,1) == 0 then
--			    elseif doPlayerRemoveItem(cid,2171,1) == 0 then
--			    elseif doPlayerRemoveItem(cid,2172,1) == 0 then
--			    elseif doPlayerRemoveItem(cid,2161,1) == 0 then
--selfSay('Thanks!', cid)
--doPlayerAddItem(cid, 2197, 1)
--talkState[talkUser] = 0
--else 
--selfSay('You do not have enough diamonds.', cid)
--talkState[talkUser] = 0 
--end
--end
--end
--end
--end
--end
--------------------------------------------------------------------------------
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then 
	    if doPlayerRemoveItem(cid,2201,1) == 0 then
		    elseif doPlayerRemoveItem(cid,2198,1) == 0 then
		    elseif doPlayerRemoveItem(cid,2170,1) == 0 then
		    elseif doPlayerRemoveItem(cid,2171,1) == 0 then
		    elseif doPlayerRemoveItem(cid,2172,1) == 0 then
		    elseif doPlayerRemoveItem(cid,2161,1) == 0 then
   elseif doPlayerAddItem(cid,2197,1) == 0 then
 selfSay('change the amulet\'s for one elemental necklace sucessfull.')
   else
 selfSay('change the amulet\'s for one elemental necklace sucessfull.')
   end
end
return TRUE
end

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

Link para o comentário
Compartilhar em outros sites

  • 0
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

-- Conversa Jogador/NPC
if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then
   selfSay('I can make an item element or amulets energyze your item element, I just need all "paste", "charm" or "spells" amulet, can also bless a mortal and reset a little god! To see what types of necklaces I say energyze "energyze amulets".', cid)
elseif(msgcontains(msg, 'energyze amulets') or msgcontains(msg, 'Energyze Amulets')) then
   selfSay('I can tell your amulet energyze just say "energyze elemental necklace" "energyze elemental spirit amulet" "energyze elemental magic amulet.', cid)
--talkState[talkUser] = 1
elseif(msgcontains(msg, 'bless') or msgcontains(msg, 'Bless')) then
   selfSay('want to buy bless?', cid)
   talkState[talkUser] = 2
elseif(msgcontains(msg, 'energyze elemental necklace') or msgcontains(msg, 'Energyze Elemental Necklace')) then
   selfSay('I can energyze your elemental necklace for 50k, would you like to energyza?', cid)
   talkState[talkUser] = 3
elseif(msgcontains(msg, 'elemental necklace') or msgcontains(msg, 'Elemental Necklace')) then
   selfSay('You change a mysterious, dragon breath, scorpion, platinum, fluids and vampire tooth,change all for a Elemental necklace?', cid)
   talkState[talkUser] = 4
elseif(msgcontains(msg, 'energyze spirit elemental amulet') or msgcontains(msg, 'Energyze Spirit Elemental Amulet')) then
   selfSay('I can energyze your spirit elemental amulet for 100k, would you like to energyza?', cid)
   talkState[talkUser] = 5
elseif(msgcontains(msg, 'spirit elemental amulet') or msgcontains(msg, 'Spirit Elemental Amulet')) then
   selfSay('You change a need a Ialamar, frozzen, sickness, Samantha, Mastafar, priest and eletric, change for a Spirit Elemental amulet?', cid)
   talkState[talkUser] = 6
elseif(msgcontains(msg, 'energyze magic elemental amulet') or msgcontains(msg, 'Energyze Magic Elemental Amulet')) then
   selfSay('I can energyze your magic elemental amulet for 150k, would you like to energyza?', cid)
   talkState[talkUser] = 7
elseif(msgcontains(msg, 'magic elemental amulet') or msgcontains(msg, 'Magic Elemental Amulet')) then
   selfSay('You change a Merlian, relic of the hell, Broonier, Thordain, dark wyzard, angel and gaya,change all for Elemental magic amulet?', cid)
   talkState[talkUser] = 8
elseif(msgcontains(msg, 'poem scroll') or msgcontains(msg, 'Poem Scroll')) then
   selfSay('Our beautiful that parchment ... Our ancient scriptures that it is very important for my pesquisa.You trade him for an Arcane Wand?', cid)
   talkState[talkUser] = 9

-- Confirmação da Compra
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
   if getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5) then
       selfSay('You have already got one or more blessings!', cid)
   else
       if(doPlayerRemoveMoney(cid, 500000) == true) then
           selfSay('You received the blessing of Isolde.', cid)
           doPlayerAddBlessing(cid, 1)
           doPlayerAddBlessing(cid, 2)
           doPlayerAddBlessing(cid, 3)
           doPlayerAddBlessing(cid, 4)
           doPlayerAddBlessing(cid, 5)
           talkState[talkUser] = 0
       else
           selfSay('Sorry, but you do not have enough money.', cid)
           talkState[talkUser] = 0
       end
   end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
   if getPlayerItemCount(cid, 2197) > 0 and getPlayerMoney(cid) >= 50000 then
       doPlayerRemoveItem(cid, 2197, 1)
       doPlayerRemoveMoney(cid, 50000)
       selfSay('Thanks!', cid)
       doPlayerAddItem(cid, 11962, 1)
       talkState[talkUser] = 0
   else
       selfSay('You do not have enough diamonds.', cid)
       talkState[talkUser] = 0
   end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
   if getPlayerItemCount(cid, 2201) > 0 and getPlayerItemCount(cid, 2198) > 0 and getPlayerItemCount(cid, 2170) > 0 and getPlayerItemCount(cid, 2171) > 0 and getPlayerItemCount(cid, 2172) > 0 and getPlayerItemCount(cid, 2161) > 0 then -- verifica se o player possui todos os items
       doPlayerRemoveItem(cid,2201,1) -- remove item
    doPlayerRemoveItem(cid,2198,1) -- remove item
    doPlayerRemoveItem(cid,2170,1) -- remove item
       doPlayerRemoveItem(cid,2171,1) -- remove item
       doPlayerRemoveItem(cid,2172,1) -- remove item
    doPlayerRemoveItem(cid,2161,1) -- remove item

    doPlayerAddItem(cid,2197,1) -- adiciona item
    selfSay('change the amulet\'s for one elemental necklace sucessfull.') -- msg de sucesso
   else
    selfSay('change the amulet\'s for one elemental necklace failed.') -- msg de falha
   end
end
return TRUE
end

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

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...