Home › Documentation › Installation · origen_tradingcards
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:
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.
Add the following items to your inventory. Each item uses the client.export field to hook into the resource.
Add to your ox_inventory/data/items.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' },
},Add to your shared items table:
['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.' },Copy the images from items/img/ into your inventory's image folder:
| File | Item |
|---|---|
album.png | album |
albumpack.png | albumpack |
albumcardcommon.png | albumcardcommon |
albumcardunrare.png | albumcardunrare |
albumcardrare.png | albumcardrare |
albumcardepic.png | albumcardepic |
albumcardlegendary.png | albumcardlegendary |
ensure oxmysql
ensure origen_tradingcardsoxmysql must be started before origen_tradingcards so the tables are created on first boot.