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
| Table | Purpose |
|---|---|
auction_listings | All auction listings (active, sold, ended, cancelled) |
auction_bids | Bid history per auction |
auction_watchlist | Player watchlist |
auction_balances | Player auction balances |
auction_accounts | Auth accounts (username/password) |
auction_sessions | Session tokens |
auction_settings | Key-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)
| Event | Data | Description |
|---|---|---|
wtf_group:client:auctionResponse | action, data | Response to any auction request |
wtf_group:client:auctionWatcherUpdate | event, data | Real-time update for watched auctions |
Server Events (from client)
| Event | Data | Description |
|---|---|---|
wtf_group:server:auctionRegister | username, password, displayName | Register new account |
wtf_group:server:auctionLogin | username, password | Login |
wtf_group:server:auctionValidateSession | token | Validate session token |
wtf_group:server:auctionLogout | token | Logout |
wtf_group:server:auctionGetBalance | - | Get auction balance |
wtf_group:server:auctionDeposit | amount | Deposit from bank |
wtf_group:server:auctionWithdraw | amount | Withdraw to bank |
wtf_group:server:auctionGetListings | category, search, sort, page | Browse listings |
wtf_group:server:auctionGetListing | auction_id | Get single listing detail |
wtf_group:server:auctionPlaceBid | auction_id, amount | Place a bid |
wtf_group:server:auctionBuyout | auction_id | Buyout auction |
wtf_group:server:auctionClaimAuction | auction_id | Claim won item |
wuf_group:server:auctionCancelListing | auction_id | Cancel own listing |
wtf_group:server:auctionToggleWatch | auction_id | Toggle watchlist |
wtf_group:server:auctionCreateListing | type, 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:
- Comment out
ensure 'npwd_auction'inserver.cfg - The
auction_*tables are shared — no data migration needed - 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