Ir para conteúdo

Featured Replies

Postado

Tenho esse script, ele coleta golds, queria que o gold coletado nao fosse para bp e sim para o banco, alguem poderia fazer essa modificaçao pf ? 
 

Agradeço desde de ja *-*



 

Citar

terra = {1285}
 levels = {
[-1] = 2148


local config = {
storage = 19333,
chance = 50, --- chance de achar um item ou não
k = 50, --- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
experience = 19334
}


function onUse(cid, item, fromPosition, itemEx, toPosition)


local drops = {}


function getDrops(cid)
for i= -1,getPlayerStorageValue(cid, config.storage) do
if levels[i] then
table.insert(drops, levels[i])
end
end
return true
end


if isInArray(terra, itemEx.itemid) then
getDrops(cid)
doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience)+1)
local experience = getPlayerStorageValue(cid, config.experience)
if experience >= (8+(getPlayerStorageValue(cid, config.storage)^2))/config.k then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
doPlayerSendTextMessage(cid, 27, "Parabens, voce subiu de nivel! Seu nivel atual e "..getPlayerStorageValue(cid, config.storage) ..".")
if getPlayerStorageValue(cid, config.storage) == 1000 then
doPlayerAddItem(cid, 9971, 100, true) 
end
end
if config.chance >= math.random(1,150) then
if #drops >= 1 then
local item = drops[math.random(1,#drops)]
doPlayerSendTextMessage(cid, 27, "Voce encontrou um gold")
doSendAnimatedText(toPosition, "gold", 210)
doPlayerAddItem(cid, item, 1, true)
end
doSendMagicEffect(toPosition, 3)
else
doSendAnimatedText(toPosition, "batebate", 180)
doSendMagicEffect(toPosition, 2)
return true
end
elseif itemEx.itemid == item.itemid then
doPlayerSendTextMessage(cid, 27, "Voce esta atualmente no nivel "..getPlayerStorageValue(cid, config.storage)..".")
else
return false
end
return true
end

 

Editado por Doidodepeda (veja o histórico de edições)

Postado
  • Diretor de Projetos

Para modificar o script para que o gold coletado seja depositado no banco em vez de ir para a Backpack (bp), você precisará fazer algumas alterações no código. Aqui está a versão modificada do script:
 

terra = {1285}
levels = {
  [-1] = 2148
}

local config = {
  storage = 19333,
  chance = 50, -- chance de achar um item ou não
  k = 50, -- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
  experience = 19334
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  local drops = {}

  function getDrops(cid)
    for i = -1, getPlayerStorageValue(cid, config.storage) do
      if levels[i] then
        table.insert(drops, levels[i])
      end
    end
    return true
  end

  if isInArray(terra, itemEx.itemid) then
    getDrops(cid)
    doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience) + 1)
    local experience = getPlayerStorageValue(cid, config.experience)
    if experience >= (8 + (getPlayerStorageValue(cid, config.storage) ^ 2)) / config.k then
      doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) + 1)
      doPlayerSendTextMessage(cid, 27, "Parabens, voce subiu de nivel! Seu nivel atual e " .. getPlayerStorageValue(cid, config.storage) .. ".")
      if getPlayerStorageValue(cid, config.storage) == 1000 then
        doPlayerAddItem(cid, 9971, 100, true)
      end
    end
    if config.chance >= math.random(1, 150) then
      if #drops >= 1 then
        local item = drops[math.random(1, #drops)]
        doPlayerSendTextMessage(cid, 27, "Voce encontrou um gold")
        doSendAnimatedText(toPosition, "gold", 210)
        doPlayerAddMoney(cid, item) -- Modificação: Adiciona o dinheiro ao banco do jogador
      end
      doSendMagicEffect(toPosition, 3)
    else
      doSendAnimatedText(toPosition, "batebate", 180)
      doSendMagicEffect(toPosition, 2)
      return true
    end
  elseif itemEx.itemid == item.itemid then
    doPlayerSendTextMessage(cid, 27, "Voce esta atualmente no nivel " .. getPlayerStorageValue(cid, config.storage) .. ".")
  else
    return false
  end
  return true
end

 

Postado
  • Autor
29 minutos atrás, Underewar disse:

Para modificar o script para que o gold coletado seja depositado no banco em vez de ir para a Backpack (bp), você precisará fazer algumas alterações no código. Aqui está a versão modificada do script:
 


terra = {1285}
levels = {
  [-1] = 2148
}

local config = {
  storage = 19333,
  chance = 50, -- chance de achar um item ou não
  k = 50, -- constante de level.. quanto maior, mais fácil é upar. (a fórmula é level ao quadrado dividido pela constante)
  experience = 19334
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  local drops = {}

  function getDrops(cid)
    for i = -1, getPlayerStorageValue(cid, config.storage) do
      if levels[i] then
        table.insert(drops, levels[i])
      end
    end
    return true
  end

  if isInArray(terra, itemEx.itemid) then
    getDrops(cid)
    doPlayerSetStorageValue(cid, config.experience, getPlayerStorageValue(cid, config.experience) + 1)
    local experience = getPlayerStorageValue(cid, config.experience)
    if experience >= (8 + (getPlayerStorageValue(cid, config.storage) ^ 2)) / config.k then
      doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage) + 1)
      doPlayerSendTextMessage(cid, 27, "Parabens, voce subiu de nivel! Seu nivel atual e " .. getPlayerStorageValue(cid, config.storage) .. ".")
      if getPlayerStorageValue(cid, config.storage) == 1000 then
        doPlayerAddItem(cid, 9971, 100, true)
      end
    end
    if config.chance >= math.random(1, 150) then
      if #drops >= 1 then
        local item = drops[math.random(1, #drops)]
        doPlayerSendTextMessage(cid, 27, "Voce encontrou um gold")
        doSendAnimatedText(toPosition, "gold", 210)
        doPlayerAddMoney(cid, item) -- Modificação: Adiciona o dinheiro ao banco do jogador
      end
      doSendMagicEffect(toPosition, 3)
    else
      doSendAnimatedText(toPosition, "batebate", 180)
      doSendMagicEffect(toPosition, 2)
      return true
    end
  elseif itemEx.itemid == item.itemid then
    doPlayerSendTextMessage(cid, 27, "Voce esta atualmente no nivel " .. getPlayerStorageValue(cid, config.storage) .. ".")
  else
    return false
  end
  return true
end

 

Infelizmente o gold nao esta indo para o banco, ainda continua indo para a bp do personagem.

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo