Postado Agosto 25, 2015 9 anos Adicionou a função doPlayerAddPoints corretamente? Eu tinha testado esse script e funciona normalmente o sell. Sobre a edição, tente assim: Mostrar conteúdo oculto local t = { [10310] = {price = 25, sellprice = 50}, [6512] = {price = 100, sellprice = 200}, [8926] = {price = 200, sellprice = 400}, [2390] = {price = 200, sellprice = 400}, [7450] = {price = 200, sellprice = 400}, [7424] = {price = 200, sellprice = 400}, [7438] = {price = 100, sellprice = 200}, [2352] = {price = 100, sellprice = 200}, [7440] = {price = 30, sellprice = 60}, [9693] = {price = 8, sellprice = 16} } 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 onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getPoints(cid) < t[item].price then selfSay("Você não tem "..t[item].price.." p points.", cid) else doPlayerAddItem(cid, item) doPlayerRemovePoints(cid, t[item].price) selfSay("Aqui está seu item.", cid) end return true end local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks) if getPoints(cid) >= 0 then doPlayerRemoveItem(cid, item, 1) doPlayerAddPoints(cid, t[item].sellprice) selfSay("Você vendeu o item por "..t[item].price.." p points.", 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 = ret.price, name = getItemNameById(var)}) end openShopWindow(cid, shopWindow, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Agosto 29, 2015 9 anos Vc consegue por tipo , pra vender o npc X100 Item por 1 Points? Por exemplo : Id 2160 Thousand Dollar, vender 100x Por 1 Points..?
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.