Real Wallet / Features

Storage, stealing & security

Where a wallet keeps its contents

Each wallet item gets an id in its metadata (walletId) the first time it is used (or looked at by /walletcheck or GetWalletStash). Its cards and cash live in an ox_inventory stash named after that id, ryanwallet:<id>, which Real Wallet registers. ox_inventory saves it in your database like any other stash.

  • There is nothing to add to ox_inventory's containers, stashes or client code.
  • A wallet holds 8 items (Config.Storage.slots): its cards and its cash.
  • The stash goes wherever the item goes.

Stealing and dropping

Because the contents follow the item, a wallet that changes hands keeps everything in it:

  • Rob a player and take their wallet: you have their cards and cash.
  • Drop a wallet on the ground: whoever picks it up gets what is inside.
  • Their cards still name them. A stolen ID shown to someone shows the owner's name and photo, not the thief's (for a card that carries an owner id or a name in its metadata).

One wallet per player

With Config.OnePerPlayer = true (the default), a player who already carries a wallet can not get a second one from a shop or a storage:

  • Buying a second wallet in a shop, or moving one into their pockets from a stash, trunk or glovebox, is refused: "You already carry a wallet." A shop sells one wallet at a time.
  • Taking a wallet off another player or picking one up off the ground is always allowed. That is how a wallet is stolen.
  • Swapping one wallet for another in the inventory is allowed.
  • Wallets given by a script or an admin (AddItem, /giveitem) are not limited, and wallets that are turned off in config.lua do not count.

The stash is locked

A wallet's stash is only ever worked by the wallet itself, never in the inventory screen:

  • Players can not open it, not even with its id (which anyone who ever held the wallet could read in its metadata). The stash is registered so that ox_inventory refuses any player who asks to open it, and an openInventory hook blocks it a second time.
  • Every card and cash move goes through the wallet's own checks: the cash limit, cards only, one action at a time.

This holds for admins too: even an admin tool that opens inventories with ox_inventory's security checks turned off is refused. To look inside a wallet from a server script, use GetWalletStash and ox_inventory's server exports.

What the server checks

Nothing a client sends is trusted:

  • Every action names the wallet's slot in the player's inventory and the card's slot inside the wallet. Both are checked before anything moves, and the wallet must still be in that slot when the move happens.
  • The cash limit is checked on every put-in.
  • Only items listed in Config.Cards go into a wallet's card slots.
  • The player a card is shown or handed to must really be next to the holder (within Config.HandRange plus 1 m) and in the same routing bucket.
  • Actions are rate-limited per player (one every 0.6 s, a shown card every 2 s).
  • A wallet's storage is loaded by one action at a time, so two actions at once can not duplicate cash or cards.
  • The props other players see are checked by the server and again by every client: only the wallet, card and cash props of this resource can be put on another player's screen.
  • Any move that fails half way puts the item back where it came from. If even that fails, the server console says so in red with the item and the player, so nothing ever vanishes silently.
Still stuck? Open a ticket in the Ryan Studios Discord and we'll help you out.