GR

Npc Que Vende Itens Com Outro Dinheiro

Por grt217, 27 de fev. de 2009 em Archived

2
596
grt217G
27 de fevereiro de 2009 às 17:57

Olá Eu Gostaria de saber como eu faço um NPC Trade

que vende os Itens mais So com outros tipo de dinheiro Dinheiros ...

 

Se alguem puder me ajudar ou me Manda um

Tópico que seja relacionado sobre essa Dúvida eu agradeçido

 

 

 

Até...

 

Esperando Resposta

MUTAN0M
27 de fevereiro de 2009 às 23:14

Eai brother.

Montei ligerinho aqui, ve se funciona.

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

 

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

if msgcontains(msg, 'help') then

selfSay('Eu vendo {Crown armor} por 100 laranjas.', cid)

 

elseif msgcontains(msg, 'crown armor') then

if getPlayerItemCount(cid,2675) >= 100 then

selfSay('Voce vai mesmo me dar 100 laranjas pela crown armor?', cid)

talk_state = 1

else

selfSay('O que?? Mas voce nem tem as laranjas!', cid)

talk_state = 0

end

 

elseif msgcontains(msg, 'yes') and talk_state == 1 then

talk_state = 0

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

doPlayerAddItem(cid,2487,1)

selfSay('Obrigado, oba laranjas...', cid)

end

 

elseif msgcontains(msg, 'no') and (talk_state >= 1) then

selfSay('Que pena, adoro laranjas.', cid)

talk_state = 0

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Claro que voce nao vai querer que ele pegue laranjas e dê uma crown armor pro player, mas eu fiz só um exemplo usando faceis IDs e frases.

Edita conforme você quiser.

Boa sorte.

Abraços.