OrigenNetwork
Docs

Installation · origen_tradingcards

1. Database

No manual SQL is required. The resource creates all necessary tables automatically when it starts for the first time via oxmysql.

The following tables are created:

sql
CREATE TABLE IF NOT EXISTS origen_albumcards_albums (
    id    INT AUTO_INCREMENT PRIMARY KEY,
    name  VARCHAR(255) UNIQUE,
    label VARCHAR(255),
    image TEXT
);
 
CREATE TABLE IF NOT EXISTS origen_albumcards_cards (
    id          INT AUTO_INCREMENT PRIMARY KEY,
    number      INT UNIQUE,
    name        VARCHAR(255),
    description TEXT,
    image       TEXT,
    rarity      VARCHAR(50),
    album_id    INT,
    FOREIGN KEY (album_id) REFERENCES origen_albumcards_albums(id) ON DELETE SET NULL
);
 
CREATE TABLE IF NOT EXISTS origen_albumcards_player (
    identifier VARCHAR(60),
    card_id    INT,
    quantity   INT DEFAULT 1,
    PRIMARY KEY (identifier, card_id)
);
 
CREATE TABLE IF NOT EXISTS origen_albumcards_shops (
    id        INT AUTO_INCREMENT PRIMARY KEY,
    name      VARCHAR(255),
    coords    TEXT,
    npc_model VARCHAR(50),
    items     TEXT
);

If you are upgrading from an older version that used a card_number column, the resource performs an automatic migration to the new card_id system on startup. No manual action is needed.


2. Items

Add the following items to your inventory. Each item uses the client.export field to hook into the resource.

ox_inventory

Add to your ox_inventory/data/items.lua:

lua
['album'] = {
    label       = 'Card Album',
    weight      = 500,
    stack       = false,
    description = 'An album to store your card collection.',
    close       = true,
    client      = { export = 'origen_tradingcards.album' },
},
['albumpack'] = {
    label       = 'Card Pack',
    weight      = 100,
    stack       = true,
    description = 'Contains collectible cards. Open it to see what you get.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumpack' },
},
['albumcardcommon'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'A common collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardunrare'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'An uncommon collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardrare'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'A rare collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardepic'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'An epic collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardlegendary'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'A legendary collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},

QBCore / QBX

Add to your shared items table:

lua
['album']             = { name = 'album',             label = 'Card Album',      weight = 500, type = 'item', image = 'album.png',             unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'An album to store your card collection.' },
['albumpack']         = { name = 'albumpack',         label = 'Card Pack',       weight = 100, type = 'item', image = 'albumpack.png',         unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Contains collectible cards.' },
['albumcardcommon']   = { name = 'albumcardcommon',   label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardcommon.png',   unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'A common collection card.' },
['albumcardunrare']   = { name = 'albumcardunrare',   label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardunrare.png',   unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'An uncommon collection card.' },
['albumcardrare']     = { name = 'albumcardrare',     label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardrare.png',     unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'A rare collection card.' },
['albumcardepic']     = { name = 'albumcardepic',     label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardepic.png',     unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'An epic collection card.' },
['albumcardlegendary'] = { name = 'albumcardlegendary', label = 'Collectible Card', weight = 0, type = 'item', image = 'albumcardlegendary.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A legendary collection card.' },

Item images

Copy the images from items/img/ into your inventory's image folder:

FileItem
album.pngalbum
albumpack.pngalbumpack
albumcardcommon.pngalbumcardcommon
albumcardunrare.pngalbumcardunrare
albumcardrare.pngalbumcardrare
albumcardepic.pngalbumcardepic
albumcardlegendary.pngalbumcardlegendary

3. server.cfg

text
ensure oxmysql
ensure origen_tradingcards

oxmysql must be started before origen_tradingcards so the tables are created on first boot.