Installation Guide
Step 1: SQL Modifications
You must execute the SQL code to set up the necessary database tables.
Instructions
Open your database management tool (e.g., phpMyAdmin or HeidiSQL).
Select Your Database.
Run the following SQL query in your database to create the required table:
CREATE TABLE `moon_loans` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`license` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`citizenid` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`loanamount` INT(11) NOT NULL DEFAULT '0',
`loanperiod` INT(11) NOT NULL DEFAULT '0',
`moneydrawn` INT(1) NOT NULL DEFAULT '0',
`fullname` VARCHAR(100) NOT NULL DEFAULT '' COLLATE 'utf8mb3_general_ci',
`creditscore` INT(11) NOT NULL DEFAULT '0',
`numPaymentsMade` INT(11) NOT NULL DEFAULT '0',
`interestamount` INT(11) NULL DEFAULT '0',
`phone` INT(11) NULL DEFAULT NULL,
`approved_by` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
PRIMARY KEY (`id`) USING BTREE,
INDEX `citizenid` (`citizenid`) USING BTREE,
INDEX `license` (`license`) USING BTREE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1
;
CREATE TABLE moon_loans_requests (
id INT(11) NOT NULL AUTO_INCREMENT,
license VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
citizenid VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
loanamount INT(11) NOT NULL DEFAULT '0',
loanperiod INT(11) NOT NULL DEFAULT '0',
status INT(1) NOT NULL DEFAULT '0',
fullname VARCHAR(100) NOT NULL DEFAULT '' COLLATE 'utf8mb3_general_ci',
creditscore INT(11) NOT NULL DEFAULT '0',
phone INT(11) NULL DEFAULT NULL,
notes VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
PRIMARY KEY (id) USING BTREE,
INDEX citizenid (citizenid) USING BTREE,
INDEX license (license) USING BTREE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=3
;
CREATE TABLE `credit_score_history` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`citizenid` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`change_amount` INT(11) NOT NULL,
`reason` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_general_ci',
`created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`) USING BTREE,
INDEX `citizenid` (`citizenid`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0
;
Step 2: Update Player Metadata
PlayerData.metadata['creditscore'] = PlayerData.metadata['creditscore'] or 400creditscore = 400,playerData.metadata.creditscore = PlayerData.metadata.creditscore or 400No Changes Needed
Step 3: Banker Job Integration
If you want to integrate the banker job, set Config.ApproveSystem to true. Add the following job definition to qb-core/shared/jobs:
['banker'] = {
label = 'Pacific Bank',
defaultDuty = true,
offDutyPay = false,
grades = {
['0'] = {
name = 'Clerk',
payment = 50
},
['1'] = {
name = 'Asst. Manager',
payment = 50
},
['2'] = {
name = 'Manager',
isboss = true,
payment = 50
},
},
},['banker'] = {
label = 'Pacific Bank',
defaultDuty = true,
offDutyPay = false,
grades = {
[0] = {
name = 'Clerk',
payment = 50
},
[1] = {
name = 'Asst. Manager',
payment = 50
},
[2] = {
name = 'Manager',
isboss = true,
payment = 50
},
},
},INSERT INTO `jobs` (name, label) VALUES
('banker', 'Pacific Bank');
INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
('banker', 0, 'clerk', 'Clerk', 50, '{}', '{}'),
('banker', 1, 'assistant_manager', 'Asst. Manager', 50, '{}', '{}'),
('banker', 2, 'manager', 'Manager', 50, '{}', '{}');Step 4: Configure the Script
Adjust the settings in the Moon Loans config file to match your server’s economy and loan requirements.
Step 5: Commands
/getcreditscore [id]: Retrieve a player's credit score.
/setcreditscore [id] [amount]: Set a player's credit score.
/addcreditscore [id] [amount]: Add to a player's credit score.
/reducecreditscore [id] [amount]: Reduce a player's credit score.
Moon Loans is designed to provide a realistic and immersive loan system for your server. Customize the loan settings to fit your economy and enhance your players' roleplaying experience with credit management, loan applications, and banker jobs.
Last updated