Postado Novembro 6, 2016 8 anos Autor 1 hora atrás, Vodkart disse: claro que dá, vc usa aquele sistema de premium_point que é pelo site ne sim. uso um sistema basico que ja vem nos Ots. de points no site e etc. problema q n manjo em Scripts :s
Postado Novembro 7, 2016 8 anos Solução quer pelo trade say né? aquele que vc fla tipo hi sword yes tem esse aqui que é por trade normal, mas tem que ter GP na bp lib function getAccountPoints(cid) local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') return res:getDataInt("premium_points") < 0 and 0 or res:getDataInt("premium_points") end function doAccountRemovePoints(cid, count) return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end Npc: 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,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,string.lower(msg) local shopWindow = {} local t = { [2195] = 1, [2493] = 25, [2361] = 30, [8851] = 20, [8925] = 30, [2640] = 50, [2494] = 100, [9932] = 50, [2472] = 70, [8931] = 100 } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getAccountPoints(cid) < t[item] then selfSay("You need "..t[item].." points to buy this item.", cid) else doAccountRemovePoints(cid, t[item]) doPlayerAddItem(cid, item) selfSay("Here your 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, 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()) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Novembro 9, 2016 8 anos Autor Em 07/11/2016 ás 21:38, Vodkart disse: quer pelo trade say né? aquele que vc fla tipo hi sword yes tem esse aqui que é por trade normal, mas tem que ter GP na bp lib function getAccountPoints(cid) local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') return res:getDataInt("premium_points") < 0 and 0 or res:getDataInt("premium_points") end function doAccountRemovePoints(cid, count) return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end Npc: 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,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,string.lower(msg) local shopWindow = {} local t = { [2195] = 1, [2493] = 25, [2361] = 30, [8851] = 20, [8925] = 30, [2640] = 50, [2494] = 100, [9932] = 50, [2472] = 70, [8931] = 100 } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getAccountPoints(cid) < t[item] then selfSay("You need "..t[item].." points to buy this item.", cid) else doAccountRemovePoints(cid, t[item]) doPlayerAddItem(cid, item) selfSay("Here your 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, 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()) é tipo isso mesmo que eu quero. mas poderia me explicar como é a instalação da Lib? tipo tenho q criar uma e por ela ou tenho q colocar ela dentro de outra seilá. e se possivel ensinar a editar o Npc. ja tou lhe dando Rep+ pelo script.
Postado Novembro 9, 2016 8 anos a lib vc vai na pasta LIB e coloca em 050-function.lua adc lá no finalzinho as funções. pra editar vc vem aqui: local t = { [2195] = 1, [2493] = 25, [2361] = 30, [8851] = 20, [8925] = 30, [2640] = 50, [2494] = 100, [9932] = 50, [2472] = 70, [8931] = 100 } [ID DO ITEM QUE SERÁ VENDIDO] = QUANTIDADE DE POINTS lembrando que tem que ter os gp's na BP, se vc quiser pelo trade-say eu tbm posso fazer [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.