Configure as frases, o item, o preço como quiser:
vendeItem.lua
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cidlocal t = {item = 2154, -- item que vai ser dado ao playermoney = 10000 -- preço (gold coins)} if(msgcontains(msg, 'item') or msgcontains(msg, 'ITEM')) then -- configure para o que quiser selfSay('Do you want to buy item for this price?', cid) -- configure aqui talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(doPlayerRemoveMoney(cid, t.money)) then local item_desc = doPlayerAddItem(cid, t.item, 1) doItemSetAttribute(item_desc, "description", "This item belongs to " .. getPlayerName(cid) ..".") selfSay('Here you are.', cid) else selfSay('Sorry, you don\'t have enough gold.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then talkState[talkUser] = 0 selfSay('Ok then.', cid) end return trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())






info
Grupo: Visconde
Registrado: 15/03/16
Posts: 327
Reputação: +12
Gênero: Masculino
Eae Galera blz ? Eu queria perguntar a vocês se é possivel criar um NPC que venda item e quando o player comprar, ele adicionar o o nome do player no ifnal do nome do item, tipo site, será que tem como ? desde já, orbigado!