Installation Guide
Execute the Below in your Database and its all Done!!
Step 1: SQL Tables for Data Storage:
We have created three SQL tables to store all the essential data related to black market transactions and dealer information:
Instructions
Open your database management tool (e.g., phpMyAdmin or HeidiSQL).
Select Your Database.
Run the following SQL code to create the required tables:
CREATE TABLE `blackmarket_dealer` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`citizenid` VARCHAR(50) NOT NULL COLLATE 'utf8mb3_general_ci',
`dealer_username` VARCHAR(20) NOT NULL COLLATE 'utf8mb3_general_ci',
`email` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`password_hash` VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci',
`money` DECIMAL(10,2) NULL DEFAULT '0.00',
`reputation` INT(11) NULL DEFAULT '0',
`last_login` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
`created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
`is_active` TINYINT(1) NULL DEFAULT '1',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `citizenid` (`citizenid`) USING BTREE,
UNIQUE INDEX `dealer_username` (`dealer_username`) USING BTREE,
UNIQUE INDEX `unique_dealer_user` (`dealer_username`, `citizenid`) USING BTREE,
INDEX `idx_citizenid` (`citizenid`) USING BTREE,
INDEX `idx_username` (`dealer_username`) USING BTREE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=7
;
CREATE TABLE `blackmarket_items` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`dealer_username` VARCHAR(50) NOT NULL COLLATE 'utf8mb3_general_ci',
`citizenid` VARCHAR(50) NOT NULL COLLATE 'utf8mb3_general_ci',
`item_name` VARCHAR(50) NOT NULL COLLATE 'utf8mb3_general_ci',
`price` INT(11) NOT NULL,
`count` INT(11) NOT NULL DEFAULT '1',
`type` VARCHAR(20) NOT NULL COLLATE 'utf8mb3_general_ci',
`image` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
`is_active` TINYINT(1) NULL DEFAULT '1',
PRIMARY KEY (`id`) USING BTREE,
INDEX `blackmarket_items_ibfk_1` (`dealer_username`) USING BTREE,
CONSTRAINT `blackmarket_items_ibfk_1` FOREIGN KEY (`dealer_username`) REFERENCES `blackmarket_dealer` (`dealer_username`) ON UPDATE RESTRICT ON DELETE CASCADE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=28
;
CREATE TABLE `blackmarket_transactions` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`dealer_username` VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci',
`item_name` VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci',
`price` INT(11) NOT NULL,
`quantity` INT(11) NOT NULL,
`buyer_citizenid` VARCHAR(255) NOT NULL COLLATE 'utf8mb3_general_ci',
`created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=348
;
Step 2: Player Metadata for Black Market:
This feature allows players to manage and track their last spin and black market reputation directly through their metadata.
qb-core/server/player.lua
PlayerData.metadata['lastspin'] = PlayerData.metadata['lastspin'] or 0
PlayerData.metadata['blackmarketrep'] = PlayerData.metadata['blackmarketrep'] or 0
Step 3: Configure the Config.lua
File
Config.lua
FileCustomize the Config.lua
file based on your preferences and requirements. Ensure the settings align with your server's intended functionality and features.
Last updated