Postado Abril 13, 2013 12 anos Olá, estava sendo trabalhado, um sistema de alavanca que permite que você compre donates no jogo com alavanca. Leia o tópico antigo para obter informações sobre este script e como configurá-lo. É o mesmo sistema, mas agora você pode escolher "true" ou "false", se você quer que custe premium points ou um item.Update 2.0: Adicionado a função de comprar com os itens, leia a configuração no script. Aqui está o código - local t = { [1938] = {100,"arcane staff",2453}, [1939] = {100,"magic plate armor",2472}, } local config = { cost = 2160, --- Id do custo do item, se você usar o "true" useitem = true, --- Se em false, então, vai custar premium points, se em treue, então use o "cost item" amount = 10 --- Quanto ele vai custar, neste caso 10cc } function onUse(cid,item,fromPosition,itemEx,toPosition) local v = t[item.uid] local points = 0 local qry = db.getResult(string.format("SELECT premium_points FROM accounts WHERE id = %d", getPlayerAccountId(cid))) if qry:getID() ~= -1 then points = qry:getDataInt("premium_points") qry:free() end if config.useitem == true then if doPlayerRemoveItem(cid,config.cost,config.amount) then doPlayerAddItem(cid,v[3]) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have buy a " .. v[2] .. " for "..config.amount.." "..getItemNameById(config.cost).."!") else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need at least "..config.amount.." "..getItemNameById(config.cost).." to buy "..getItemNameById(v[3]).."!") end else if points > v[1] then doPlayerAddItem(cid,v[3]) db.executeQuery('UPDATE accounts SET premium_points=premium_points-'..v[1]..' WHERE id=' .. getPlayerAccountId(cid)) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have buy a " .. v[2] .. " for "..v[1].." points! Your current balance is "..getPremiumPoints(cid).." points!") else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need at least "..v[1].." points to buy a "..v[2].."! Your current balance is "..getPremiumPoints(cid).." points! ") end end if getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item") end return true end function getPremiumPoints(cid) local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') if(res:getID() == -1) then return 0 end local ret = res:getDataInt("premium_points") res:free() return tonumber(ret) end Link Do Tópico Antigo - [Action] Shop System InGameCréditos - _CorneX_ ►[Mega Topic] Seu Primeiro Open Tibia Server◄ ►Lista Dos Meus Trabalhos◄
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.