Ir para conteúdo

Featured Replies

Postado

Estou utilizando o sistema de bank por talkaction do LuanLuciano93, e gostaria de fazer 2 alterações para complementar esse sistema.

1. Gostaria que o player só pudesse usar os comandos do bank sistem, se estiver sem battle. Pode ser em qualquer local, mas precisa estar sem battle apenas.
2. Gostaria que na parte de transferência, o player que receber o dinheiro, receber uma mensagem na hora da transferência em LARANJA ou AZUL no default channel, falando que recebeu uma transferência de quantia X de X player.
Exemplo: You received 10000 gps transferred from Admin.

 

Estou utilizando TFS 1.3

 

Agradeço desde já.

Resolvido por So volto tarde

Ir para solução
  • Respostas 7
  • Visualizações 468
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • So volto tarde
    So volto tarde

  • Testei aqui, não está funcionando a parte de verificar battle. A parte do outro player receber a mensagem está funcionando 100%     [EDITED] Consegui amigo, só alterei a linha 2:

  • Anderson Sacani
    Anderson Sacani

    function onSay(player, words, param) if ((player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)) or (player:isPzLocked())) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSy

Postado
  • Solução
Mostrar conteúdo oculto

 

Postado
  • Autor
  Em 14/12/2022 em 06:12, So volto tarde disse:
Mostrar conteúdo oculto

 

 

Testei aqui, não está funcionando a parte de verificar battle.
A parte do outro player receber a mensagem está funcionando 100%

 

 

[EDITED]

Consegui amigo, só alterei a linha 2:

if (player:isPzLocked()) then

 

para:

if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) or player:isPzLocked() then

 

 

Muito obrigado man

  Em 14/12/2022 em 06:12, So volto tarde disse:
Mostrar conteúdo oculto

 

só mais uma dúvida man, tem como o player que recebeu a transfer na mensagem dele, adicionar o balance atual do bank dele? 

Seria como "[BankSystem]: player %s transferred %sgps yo your bank account. Your current balance is: xxxxxxx gps"

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

Postado
function onSay(player, words, param)
    if ((player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)) or (player:isPzLocked())) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: you must be not with pzlock.")
        return false
    end

    local split = param:split(",")
    local balance = player:getBankBalance()
    if split[1] == nil then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
            "[BankSystem]: the commands are:\n !bank balance.\n !bank deposit, XXXX.\n!bank depositall.\n!bank transfer, amount, toPlayer.")
        return
    end
    --------------------------- Balance ---------------------------
    if split[1] == 'balance' then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Your account balance is " .. balance .. ".")
        --------------------------- Deposit ---------------------------
    elseif split[1] == 'deposit' then
        local amount = tonumber(split[2])
        if not amount then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to add.")
            return false
        end
        local amount = math.abs(amount)
        if amount > 0 and amount <= player:getMoney() then
            player:deposit(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You added " ..
                amount ..
                " to your account, You can withdraw your money anytime you want to.\nYour account balance is " ..
                player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.")
        end
        --------------------------- Depositall ---------------------------
    elseif split[1] == 'depositall' then
        local amount = player:getMoney()
        local amount = math.abs(amount)
        if amount > 0 and amount == player:getMoney() then
            player:deposit(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You added " ..
                amount ..
                " to your account, You can withdraw your money anytime you want to.\nYour account balance is " ..
                player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.")
        end
        --------------------------- Withdraw ---------------------------
    elseif split[1] == 'withdraw' then
        local amount = tonumber(split[2])
        if not amount then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You need to put the amount of money to withdraw.")
            return false
        end
        local amount = math.abs(amount)
        if amount > 0 and amount <= player:getBankBalance() then
            player:withdraw(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: Here you are " ..
                amount ..
                " of your account, You can deposit your money anytime you want.\nYour account balance is " ..
                player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You do not have enough money on your bank account.")
        end
        --------------------------- Withdrawall ---------------------------
    elseif split[1] == 'withdrawall' then
        local amount = player:getBankBalance()
        local amount = math.abs(amount)
        if amount > 0 and amount <= player:getBankBalance() then
            player:withdraw(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: Here you are all your money on your account, You can deposit your money anytime you want.\nYour account balance is "
                .. player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You do not have enough money on your bank account.")
        end
        --------------------------- Transfer ---------------------------
    elseif split[1] == 'transfer' then
        local data = param
        local s = data:split(", ")
        if s[2] == nil then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money")
            return false
        else
            if not tonumber(s[2]) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount in numbers only.")
                return
            end
        end
        if s[3] == nill then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the player name")
            return false
        end
        local a = tonumber(s[2])
        local amount = math.abs(a)
        local getPlayer = Player(s[3])
        if getPlayer then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.")
            player:transferMoneyTo(s[3], amount)
            getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                string.format("[BankSystem]: player %s transferred %sgps yo your bank account.", player:getName(), s[2]))
            addEvent(function()
                if getPlayer:isPlayer() then
                    getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                        string.format("[BankSystem]: Your account balance is now: %d.", getPlayer:getBankBalance()))
                end
            end, 1500)
        else
            if not playerExists(s[3]) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "[BankSystem]: A player with name: " .. s[3] .. " does not exists.")
                return false
            end
            if playerExists(s[3]) and player:transferMoneyTo(s[3], amount) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.")

            end
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Invalid param.")
    end
    return false
end

 

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

Postado
  • Autor
  Em 15/12/2022 em 20:32, Anderson Sacani disse:

function onSay(player, words, param)
    if ((player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT)) or (player:isPzLocked())) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: you must be not with pzlock.")
        return false
    end

    local split = param:split(",")
    local balance = player:getBankBalance()
    if split[1] == nil then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
            "[BankSystem]: the commands are:\n !bank balance.\n !bank deposit, XXXX.\n!bank depositall.\n!bank transfer, amount, toPlayer.")
        return
    end
    --------------------------- Balance ---------------------------
    if split[1] == 'balance' then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Your account balance is " .. balance .. ".")
        --------------------------- Deposit ---------------------------
    elseif split[1] == 'deposit' then
        local amount = tonumber(split[2])
        if not amount then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to add.")
            return false
        end
        local amount = math.abs(amount)
        if amount > 0 and amount <= player:getMoney() then
            player:deposit(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You added " ..
                amount ..
                " to your account, You can withdraw your money anytime you want to.\nYour account balance is " ..
                player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.")
        end
        --------------------------- Depositall ---------------------------
    elseif split[1] == 'depositall' then
        local amount = player:getMoney()
        local amount = math.abs(amount)
        if amount > 0 and amount == player:getMoney() then
            player:deposit(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You added " ..
                amount ..
                " to your account, You can withdraw your money anytime you want to.\nYour account balance is " ..
                player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.")
        end
        --------------------------- Withdraw ---------------------------
    elseif split[1] == 'withdraw' then
        local amount = tonumber(split[2])
        if not amount then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You need to put the amount of money to withdraw.")
            return false
        end
        local amount = math.abs(amount)
        if amount > 0 and amount <= player:getBankBalance() then
            player:withdraw(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: Here you are " ..
                amount ..
                " of your account, You can deposit your money anytime you want.\nYour account balance is " ..
                player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You do not have enough money on your bank account.")
        end
        --------------------------- Withdrawall ---------------------------
    elseif split[1] == 'withdrawall' then
        local amount = player:getBankBalance()
        local amount = math.abs(amount)
        if amount > 0 and amount <= player:getBankBalance() then
            player:withdraw(amount)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: Here you are all your money on your account, You can deposit your money anytime you want.\nYour account balance is "
                .. player:getBankBalance() .. ".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You do not have enough money on your bank account.")
        end
        --------------------------- Transfer ---------------------------
    elseif split[1] == 'transfer' then
        local data = param
        local s = data:split(", ")
        if s[2] == nil then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money")
            return false
        else
            if not tonumber(s[2]) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount in numbers only.")
                return
            end
        end
        if s[3] == nill then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the player name")
            return false
        end
        local a = tonumber(s[2])
        local amount = math.abs(a)
        local getPlayer = Player(s[3])
        if getPlayer then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.")
            player:transferMoneyTo(s[3], amount)
            getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                string.format("[BankSystem]: player %s transferred %sgps yo your bank account.", player:getName(), s[2]))
            addEvent(function()
                if getPlayer:isPlayer() then
                    getPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                        string.format("[BankSystem]: Your account balance is now: %d.", getPlayer:getBankBalance()))
                end
            end, 1500)
        else
            if not playerExists(s[3]) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "[BankSystem]: A player with name: " .. s[3] .. " does not exists.")
                return false
            end
            if playerExists(s[3]) and player:transferMoneyTo(s[3], amount) then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.")

            end
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Invalid param.")
    end
    return false
end

 

 

Funcionou, mas é possível colocar na mesma frase as mensagens que o player recebeu a transfer e o novo balance dele? Igual eu coloquei aqui..

 

  Em 14/12/2022 em 18:10, DiigooMix disse:

Seria como "[BankSystem]: player %s transferred %sgps to your bank account. Your current balance is: xxxxxxx gps"

 

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo