Skip to main content

Guide: cash you can lose, money in the bank

A popular setup: players carry cash in game. Whoever kills them takes all of it. Money is only safe once it is paid into the bank โ€” at an ATM in game. The shop is paid from the bank. This page builds that setup step by step with wallets and two small actions. Adapt names and amounts to your server.

What you need: the rights wallets.manage and settings.edit, and to write the two actions yourself automations.edit_code (or ask someone who has it).

1. Create the walletsโ€‹

Server Admin โ†’ Wallets:

  • Main account โ€” rename it to Bank. It is the safe money and exists on every server of your organization.
  • + Wallet โ†’ this server, key cash, name Cash:
    • Game-bound: on. Cash stands for what a player carries.
    • Players may pay in: on โ€” players may take money out of the bank as cash on the website.
    • Players may take out: off โ€” cash only reaches the bank at the ATM in game, never with a click on the website.

Want the bank to stay per server too? Create a second server wallet bank instead of renaming the main account.

2. Decide what pays from whereโ€‹

Server Admin โ†’ Settings โ†’ Wallets:

SettingValueWhy
Default walletempty (= Bank)everything not listed below stays safe in the bank
Shopempty (= Bank)players pay what they saved
Transfers between playersCashhanding money over is a cash deal โ€” it waits for the logs like everything that leaves cash on the website
BountiesBankโ€”
Casino, bookmaker, events, subscriptionsBankthese settle instantly and cannot use cash anyway

Rewards your own actions pay (kills, playtime, missions) go to whatever wallet the action names โ€” in step 4 that is cash.

3. Action: a kill takes the victim's cashโ€‹

Server Admin โ†’ Automations โ†’ + Automation โ†’ Own code.

  • Event: player_killed (fires once per kill, with killer and victim).
  • Configuration field: name cash, type Wallet Select, required.
  • Code:
local r = wallet.transfer(data.victim.username, config.cash, data.killer.username, config.cash, "all", "Looted from " .. data.victim.username)
if r.amount > 0 then
discord.send_to_player(data.killer.username, "You looted " .. r.amount .. " cash from " .. data.victim.username .. ".")
end

Then pick Cash in the field cash.

How this stays fair although kills reach dzbot minutes late: "all" takes what the victim held at the moment of the kill. Money that arrived after it stays with the victim. Money the victim tried to move to the bank on the website after dying is still waiting for the logs โ€” the kill comes first, and that move fails. Money they moved before dying is safe.

4. Action: the ATM in gameโ€‹

Players stand at the ATM and do an emote โ€” for example sit down. Everything they carry goes into the bank.

  • Event: player_performed_emote.
  • Configuration fields:
    • cash โ€” type Wallet Select, required (pick Cash)
    • bank โ€” type Wallet Select, required (pick Bank)
    • atm โ€” type Coordinate with radius (click the ATM on the map, radius e.g. 5 m)
    • emote โ€” type String, e.g. EmoteSitA
  • Code:
if data.emote ~= config.emote then return end
local dx = data.location.x - config.atm.x
local dz = data.location.z - config.atm.z
if (dx * dx + dz * dz) > (config.atm.radius or 5) ^ 2 then return end

local r = wallet.transfer(data.player.username, config.cash, data.player.username, config.bank, "all", "ATM")
if r.amount > 0 then
discord.send_to_player(data.player.username, "Paid " .. r.amount .. " into the bank. Bank: " .. r.to_balance .. ".")
end

Several ATMs? Make atm a list of coordinates, or draw them as zones and check data.zones instead of the distance. A real ATM object on the map can be placed with a mod of your organization.

5. Pay players in cashโ€‹

Rewards are what makes cash worth carrying. In any action that pays money, use wallet.change with the cash wallet instead of player.change_balance:

wallet.change(data.killer.username, config.cash, 250, "Kill reward")

Ready-made marketplace actions that pay with player.change_balance book on the server's default wallet โ€” the bank in this setup.

What players seeโ€‹

  • The top bar shows everything together; a click shows Bank and Cash separately.
  • On Transactions: both wallets, moving bank โ†’ cash, and money that waits for the logs.
  • Paying in at the ATM and losing cash to a killer show up in their history.

Test itโ€‹

On a test server or with a test player: give yourself cash under Players โ†’ player โ†’ Economy (pick the wallet), let someone kill you, and check both players' wallets and the automation's run log. Then do the emote at the ATM.