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:
CREATETABLE `blackmarket_dealer` (`id`INT(11) NOT NULL AUTO_INCREMENT,`citizenid`VARCHAR(50) NOT NULLCOLLATE'utf8mb3_general_ci',`dealer_username`VARCHAR(20) NOT NULLCOLLATE'utf8mb3_general_ci',`email`VARCHAR(255) NULLDEFAULTNULLCOLLATE'utf8mb3_general_ci',`password_hash`VARCHAR(255) NOT NULLCOLLATE'utf8mb3_general_ci',`money`DECIMAL(10,2) NULLDEFAULT'0.00',`reputation`INT(11) NULLDEFAULT'0',`last_login`TIMESTAMPNOT NULLDEFAULTcurrent_timestamp(),`created_at`TIMESTAMPNOT NULLDEFAULTcurrent_timestamp(),`is_active`TINYINT(1) NULLDEFAULT'1',PRIMARY KEY (`id`) USING BTREE,UNIQUEINDEX`citizenid` (`citizenid`) USING BTREE,UNIQUEINDEX`dealer_username` (`dealer_username`) USING BTREE,UNIQUEINDEX`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=InnoDBAUTO_INCREMENT=7;CREATETABLE `blackmarket_items` (`id`INT(11) NOT NULL AUTO_INCREMENT,`dealer_username`VARCHAR(50) NOT NULLCOLLATE'utf8mb3_general_ci',`citizenid`VARCHAR(50) NOT NULLCOLLATE'utf8mb3_general_ci',`item_name`VARCHAR(50) NOT NULLCOLLATE'utf8mb3_general_ci',`price`INT(11) NOT NULL,`count`INT(11) NOT NULLDEFAULT'1',`type`VARCHAR(20) NOT NULLCOLLATE'utf8mb3_general_ci',`image`VARCHAR(255) NULLDEFAULTNULLCOLLATE'utf8mb3_general_ci',`created_at`TIMESTAMPNOT NULLDEFAULTcurrent_timestamp(),`is_active`TINYINT(1) NULLDEFAULT'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`) ONUPDATE RESTRICT ON DELETE CASCADE)COLLATE='utf8mb3_general_ci'ENGINE=InnoDBAUTO_INCREMENT=28;CREATETABLE `blackmarket_transactions` (`id`INT(11) NOT NULL AUTO_INCREMENT,`dealer_username`VARCHAR(255) NOT NULLCOLLATE'utf8mb3_general_ci',`item_name`VARCHAR(255) NOT NULLCOLLATE'utf8mb3_general_ci',`price`INT(11) NOT NULL,`quantity`INT(11) NOT NULL,`buyer_citizenid`VARCHAR(255) NOT NULLCOLLATE'utf8mb3_general_ci',`created_at`TIMESTAMPNOT NULLDEFAULTcurrent_timestamp(),PRIMARY KEY (`id`) USING BTREE)COLLATE='utf8mb3_general_ci'ENGINE=InnoDBAUTO_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
qbx_core/server/player.lua
playerData.metadata.blackmarketrep = playerData.metadata.blackmarketrep or 0
playerData.metadata.lastspin = playerData.metadata.lastspin or 0
No Changes Needed to Be Done for ESX Framework
Step 3: Configure the Config.lua File
Customize the Config.lua file based on your preferences and requirements. Ensure the settings align with your server's intended functionality and features.