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 msg = string.lower(msg)
local moeda,str = 6527,""
local t = {
["boots of haste"] = {15, 2195},
["demon helmet"] = {25, 2493},
["frozen starlight"] = {30, 2361},
["royal crossbow"] = {20, 8851},
["solar axe"] = {30, 8925},
["soft boots"] = {50, 2640},
["demon armor"] = {100, 2494},
["firewalker boots"] = {50, 9932},
["magic plate armor"] = {70, 2472},
["flame blade"] = {100, 8931}
}
if isInArray({"trade","special items","special item","items","special"}, msg) then
str = str .. "Eu vendo estes items: "
for name, pos in pairs(t) do
str = str.." {"..name.."} = "..pos[1].." Moedas /"
end
str = str .. "."
npcHandler:say(str, cid)
elseif t[msg] then
if doPlayerRemoveItem(cid,moeda,t[msg][1]) then
doPlayerAddItem(cid,t[msg][2],1)
npcHandler:say("Aqui está seu ".. getItemNameById(t[msg][2]) .."!", cid)
else
npcHandler:say("você não tem "..t[msg][1].." ".. getItemNameById(moeda), cid)
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
["boots of haste"] = {15, 2195},
["item name"] = {QUANTAS MOEDAS, ID DO ITEM QUE SERÁ VENDIDO}




info
Grupo: Artesão
Registrado: 10/11/11
Posts: 118
Reputação: +2
Olá amigos, eu preciso de ajuda com um NPC que vende items especiais, y remover ID 6527 como paga, por exemplo player dar 100 (item ID 6527) jogador compra um item special,
não importando se a função onsay
player: hi
npc: Olá player name eu vender itens especiais, para itens especiais fala special items.
player: special items
npc: eu vender Exp boost, special sword, special axe y special wand, você quer comprar?
player: Exp boost
npc: você tem 100 item ID para comprar Exp boost?
player: yes
npc: graças aqui é o seu Exp boost
Eu quero trabalhar para o NPC, muito obrigado por sua ajuda