Real Wallet / Developers

Server exports

A card that is in a wallet is in the wallet's stash, not in the player's inventory, so exports.ox_inventory:Search(source, 'count', 'id_card') does not see it. These exports look in the player's pockets and in every wallet they carry.

HasCard

Lua
local has, card = exports['ryan-wallet']:HasCard(source, names, match)
Argument
source The player.
names An item name ('id_card') or a list of them ({ 'visa', 'mastercard' }).
match Optional. Metadata the card must have; every key must be equal, e.g. { citizenid = '...' }.

Returns true, card for the first card found (pockets first), or false.

card = { name, metadata, inv, slot, inWallet }:

Field
name The item name.
metadata The item's metadata, as your ID script stored it.
inv Where it is: the player's id (pockets) or the wallet's stash id (ryanwallet:<id>).
slot Its slot in that inventory.
inWallet true when it is inside a wallet.
Lua
-- an ATM: the player's own bank card, in a pocket or a wallet
local Player = exports.qbx_core:GetPlayer(source)
local ok = exports['ryan-wallet']:HasCard(source, { 'visa', 'mastercard' }, { citizenid = Player.PlayerData.citizenid })
if not ok then return false end

SearchCards

Lua
local cards = exports['ryan-wallet']:SearchCards(source, names)

Every such card the player carries, as a list { card, card, ... } (the same fields as HasCard), pockets first, then each wallet. Empty when there is none.

Lua
for _, c in ipairs(exports['ryan-wallet']:SearchCards(source, { 'id_card', 'driver_license' })) do
    print(c.name, c.metadata.firstname, c.inWallet and 'in a wallet' or 'in a pocket')
end

Both exports are read-only. They also find cards in a wallet whose finish is turned off, and they never give a new wallet an id.

GetWalletStash

Lua
local stashId = exports['ryan-wallet']:GetWalletStash(source, slot)

The stash id of the wallet in that slot of the player's inventory (ryanwallet:<id>), or nil when there is no (turned-on) wallet there. A wallet that was never used gets its id here. Use it to look inside a wallet from your own server scripts:

Lua
local stashId = exports['ryan-wallet']:GetWalletStash(source, 3)
if stashId then
    local cash = exports.ox_inventory:GetItemCount(stashId, 'money')
end

Players can not open this stash in the inventory screen. Change what is in it only if you know what you are doing: the wallet's cash limit and card rules are checked by its own actions, not by ox_inventory.

IsWallet

Lua
local yes = exports['ryan-wallet']:IsWallet(itemName)   -- true / false

Whether an item name is a wallet that is turned on.

getUpdateInfo

Lua
local info = exports['ryan-wallet']:getUpdateInfo()
-- { checked = true, current = '1.0.0', latest = '1.0.0', outdated = false, critical = false }

The update checker's last result, for admin menus. checked = false until the first check has answered (or when the update check is off).

Still stuck? Open a ticket in the Ryan Studios Discord and we'll help you out.