Postado Julho 19, 2014 10 anos Opa galera blz? , Estava, preucurano muito no forum, um npc que aceita outra moeda, mais nenhum funcinou, então resolvi criar esse topico, então vamo la, Funciona Assim, o npc vai aceitar Moeda VIP, envez de goold é talz. alguem tem uma para me disponiblizar? :/ @UP
Postado Julho 19, 2014 10 anos 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 MoedaVip = 2160 -- Id da MoedaVip local shopWindow = {} local t = { [2457] = {price = 200}, -- [id do item] e em price qnto honor points vai custar [2458] = {price = 200}, [2459] = {price = 200}, [8931] = {price = 200}, [2422] = {price = 200} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and doPlayerRemoveItem(cid, MoedaVip, t[item].price) then doPlayerAddItem(cid, item, 1, false) selfSay("Aqui esta o Item", cid) else selfSay("Voce nao tem "..t[item].price.." gold vip suficiente", 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()) Editado Julho 19, 2014 10 anos por Emersonssss (veja o histórico de edições) Skype : emersonaaron Se Te ajudei não me REP+ isso não muda nada! kkkkkkkkkkkk
Postado Julho 20, 2014 10 anos Autor Cara não funcionou o npc , ta aceitano Gold é não a moeda viP, ja configurei, tirei 0 2160, é botei 9971 mais mesmo assim não foi @UP @UP @UP @UP @up @UP
Postado Fevereiro 11, 2016 9 anos tenho esse aque no meu server brother. e funfa ! 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 itemid = 2157 -- Novos points ( default é scarab coin ) local shopWindow = {} local t = { [8850] = {price = 400}, -- [ID do item] e o preço que ele irá custar em points. [8929] = {price = 400}, [8932] = {price = 400}, [8926] = {price = 400}, [2424] = {price = 400}, [11296] = {price = 200}, [11295] = {price = 200}, [11298] = {price = 200}, [11297] = {price = 200}, [2527] = {price = 200}, [2108] = {price = 900}, [9019] = {price = 900}, [3955] = {price = 900} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getPlayerItemCount(cid, itemid) < t[item].price then selfSay("you do not have "..t[item].price.." Nugget Coins.", cid) else doPlayerAddItem(cid, item) doPlayerRemoveItem(cid, itemid, (t[item].price)) selfSay("Here you item", 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()) Npc: <?xml version="1.0"?> <npc name="# Seller Super Rox @" script="data/npc/scripts/newcoin.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="53" head="87" body="0" legs="87" feet="0" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I {trade} items for Nugget Coins!"/> </parameters> </npc>
Postado Fevereiro 26, 2016 9 anos Em 11/02/2016 18:34:44, mkmmkm disse: tenho esse aque no meu server brother. e funfa ! 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 itemid = 2157 -- Novos points ( default é scarab coin ) local shopWindow = {} local t = { [8850] = {price = 400}, -- [ID do item] e o preço que ele irá custar em points. [8929] = {price = 400}, [8932] = {price = 400}, [8926] = {price = 400}, [2424] = {price = 400}, [11296] = {price = 200}, [11295] = {price = 200}, [11298] = {price = 200}, [11297] = {price = 200}, [2527] = {price = 200}, [2108] = {price = 900}, [9019] = {price = 900}, [3955] = {price = 900} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getPlayerItemCount(cid, itemid) < t[item].price then selfSay("you do not have "..t[item].price.." Nugget Coins.", cid) else doPlayerAddItem(cid, item) doPlayerRemoveItem(cid, itemid, (t[item].price)) selfSay("Here you item", 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()) Npc: <?xml version="1.0"?> <npc name="# Seller Super Rox @" script="data/npc/scripts/newcoin.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="53" head="87" body="0" legs="87" feet="0" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I {trade} items for Nugget Coins!"/> </parameters> </npc> Manow... será que esse ai pega no poketibia basecyan 8.54??
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.