Skip to content

Auction System

Migrated from npwd_auction phone app to tablet-integrated auction system.

Architecture

React UI (apps/Auction/index.jsx)
    ↓ fetchNui('auction:*')
client/auction.lua (NUI callbacks)
    ↓ TriggerServerEvent
server/auction.lua (all logic)
    ↓ MySQL
Database (7 auction_* tables)

Features

  • Auth System: Register/login with username/password, session tokens (30-day expiry)
  • Wallet: Deposit/withdraw from bank, auction balance system
  • Browse Listings: Filter by category, search, sort, pagination
  • Bidding: Increment-based bidding with auto-refund on outbid
  • Buyout: Instant purchase at buyout price
  • Claim System: Manual claim after winning
  • Watchlist: Track auctions you're interested in
  • Create Listings: Items (ox_inventory escrow), Vehicles (garage transfer), Shops (ownership transfer)
  • Black Market: VPN-gated category (uses exports.wtf_group:IsVpnConnected())
  • Admin Panel: Manage listings, toggle featured, cancel/delete auctions
  • Tax System: 5% tax on successful sales, $5,000 listing fee

Database Tables

TablePurpose
auction_listingsAll auction listings (active, sold, ended, cancelled)
auction_bidsBid history per auction
auction_watchlistPlayer watchlist
auction_balancesPlayer auction balances
auction_accountsAuth accounts (username/password)
auction_sessionsSession tokens
auction_settingsKey-value settings

Config

lua
Config.Auction = {
    DefaultDuration = 86400,        -- 24 hours
    ListingFee = 5000,              -- $5,000 to create listing
    TaxRate = 0.05,                 -- 5% tax on sale
    MinStartingPrice = 100,
    DefaultBidIncrement = 100,
    MaxActiveAuctionsPerPlayer = 5,
    AllowBuyout = true,
    AuctionCheckInterval = 30,      -- seconds
    AdminGroups = { 'admin', 'superadmin' },
    Categories = { shops, items, vehicles, general, blackmarket },
    AuthSalt = 'aifazi_auction_2026',
    SessionExpiryDays = 30,
}

Exports

lua
-- Create a listing (returns listing ID)
exports.wtf_group:CreateAuctionListing(data)

-- Get a listing by ID
exports.wtf_group:GetAuctionListing(id)

-- Get player's auction balance
exports.wtf_group:GetAuctionBalance(source)

-- Get player's listings
exports.wtf_group:GetPlayerAuctions(source)

-- Check if player is auction admin
exports.wtf_group:IsAuctionAdmin(source)

Events

Client Events (from server)

EventDataDescription
wtf_group:client:auctionResponseaction, dataResponse to any auction request
wtf_group:client:auctionWatcherUpdateevent, dataReal-time update for watched auctions

Server Events (from client)

EventDataDescription
wtf_group:server:auctionRegisterusername, password, displayNameRegister new account
wtf_group:server:auctionLoginusername, passwordLogin
wtf_group:server:auctionValidateSessiontokenValidate session token
wtf_group:server:auctionLogouttokenLogout
wtf_group:server:auctionGetBalance-Get auction balance
wtf_group:server:auctionDepositamountDeposit from bank
wtf_group:server:auctionWithdrawamountWithdraw to bank
wtf_group:server:auctionGetListingscategory, search, sort, pageBrowse listings
wtf_group:server:auctionGetListingauction_idGet single listing detail
wtf_group:server:auctionPlaceBidauction_id, amountPlace a bid
wtf_group:server:auctionBuyoutauction_idBuyout auction
wtf_group:server:auctionClaimAuctionauction_idClaim won item
wuf_group:server:auctionCancelListingauction_idCancel own listing
wtf_group:server:auctionToggleWatchauction_idToggle watchlist
wtf_group:server:auctionCreateListingtype, title, price, etc.Create new listing
wtf_group:server:auctionGetInventoryItems-Get player inventory
wtf_group:server:auctionGetVehiclesForListing-Get player vehicles
wtf_group:server:auctionGetShopsForListing-Get player shops
wtf_group:server:auctionHasVPNAccess-Check VPN access

Black Market

The Black Market category requires VPN access. The server checks:

lua
exports.wtf_group:IsVpnConnected(source)

If the player is not connected to a VPN proxy, the black market listings are hidden and creation is blocked.

Migration from npwd_auction

To disable the old phone version:

  1. Comment out ensure 'npwd_auction' in server.cfg
  2. The auction_* tables are shared — no data migration needed
  3. The tablet version reads/writes the same tables

UI Features

  • Auth page with login/register
  • Browse with category filters, search, sort
  • Listing detail with bid history, watch toggle
  • My Auctions: listings, bids, won items, watchlist
  • Create listing: item/vehicle/shop selection
  • Wallet: deposit/withdraw
  • Toast notifications for actions
  • Guest mode for browsing without account

AIFAZI — FiveM Resources