Postado Setembro 9, 2017 7 anos Autor 6 minutos atrás, Dwarfer disse: Qual a ideia de adicionar os pontos ao player ele ter que converter para ir ao Npc que aceita o item convertido a partir dos pontos se o Npc já aceita os pontos? Os players podem vender os coins entre si, era esse o objetivo.
Postado Setembro 9, 2017 7 anos Autor 9 minutos atrás, Dwarfer disse: Os players podem vender o item que compram do Npc. Mais se o cara tiver dificuldades para achar o item que ele deseja vendendo? E mais facil os coins kkkkkkk rlx, obrigado
Postado Setembro 9, 2017 7 anos Não, tranquilo, é só que sempre ficam pedindo as mesmas coisas. Apesar de achar desnecessário (rsrs), pega aí: NPC Spoiler 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 shopWindow = {} local money = 6527 -- ID_da_moeda local t = { [2154] = {price = 15}, -- [ID_DO_ITEM_QUE_SERÁ_VENDIDO] = {price = preço} [2158] = {price = 25}, [2155] = {price = 70}, [2156] = {price = 100} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and not doPlayerRemoveItem(cid, money, t[item].price) then selfSay("You need "..t[item].price.." "..getItemNameById(money)..".", cid) else doPlayerAddItem(cid, item) selfSay("Here you go.", cid) end return true end if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then for var, ret in pairs(t) do table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)}) end openShopWindow(cid, shopWindow, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ACTION function onUse(cid, item, fromPosition, itemEx, toPosition) doPlayerAddEventPoints(cid, item.type) doRemoveItem(item.uid) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_STUN) return true end function doPlayerAddEventPoints(cid, amount) local current = getPlayerStorageValue(cid, 92431) setPlayerStorageValue(cid, 92431, current + amount) return true end <action itemid="ID_DO_ITEM" script="NOMEDOARQUIVO.lua" />
Postado Setembro 9, 2017 7 anos Autor 1 hora atrás, Dwarfer disse: Não, tranquilo, é só que sempre ficam pedindo as mesmas coisas. Apesar de achar desnecessário (rsrs), pega aí: NPC Ocultar conteúdo 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 shopWindow = {} local money = 6527 -- ID_da_moeda local t = { [2154] = {price = 15}, -- [ID_DO_ITEM_QUE_SERÁ_VENDIDO] = {price = preço} [2158] = {price = 25}, [2155] = {price = 70}, [2156] = {price = 100} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and not doPlayerRemoveItem(cid, money, t[item].price) then selfSay("You need "..t[item].price.." "..getItemNameById(money)..".", cid) else doPlayerAddItem(cid, item) selfSay("Here you go.", cid) end return true end if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then for var, ret in pairs(t) do table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)}) end openShopWindow(cid, shopWindow, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ACTION function onUse(cid, item, fromPosition, itemEx, toPosition) doPlayerAddEventPoints(cid, item.type) doRemoveItem(item.uid) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_STUN) return true end function doPlayerAddEventPoints(cid, amount) local current = getPlayerStorageValue(cid, 92431) setPlayerStorageValue(cid, 92431, current + amount) return true end <action itemid="ID_DO_ITEM" script="NOMEDOARQUIVO.lua" /> Você é um cara fora de série, sem mais, funcional!
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.