QBCORE

Dependencies

Optional dependencies (if any ox_ resource is used)

Installation

  1. Place the ylean_loans folder into your server's resources directory.

  2. Import sql.sql into your MySQL database.

  3. Add job settings from job.txt into ...\qb-core\shared\jobs.lua

Config File

Configuration Requirements

  • name Must exactly match the job name defined in your main configuration file.

  • grades Each key ('0', '1', '2', etc.) must correspond to a grade defined in that same configuration. Any addition, removal, or renumbering of grades here must be applied to the main job config as well.

Boss Menu Access

Any player who holds the “financial” job at a rank where the isBoss variable is set to true has access to the boss menu.

1. Fixed Rate Mode (constant = true)

  • Behavior No matter what repayment term the player picks, the interest rate is always equal to value.

  • Configuration

Fixed Rate Mode

2. Variable Rate Mode (constant = false)

  • Behavior

    • For a 1-day loan, use the min rate.

    • For a loan at the maximum allowed deadline (defined by maximumDeadline), use the max rate.

    • For any term in between, interpolate linearly between min and max.

  • Linear interpolation formula

  • Configuration

Variable Rate Mode

Translation Guide

This section explains how to add or edit translations for ylean_loans, covering both the NUI (front-end) and server (back-end) locales, as well as the main NUI HTML file.

1. NUI (Front-End) Translations

  • Directory: ylean_loans/nui/locales/ Contains pre-translated JSON files, e.g. en.json, pl.json, etc.

  • Add or Edit a Language

    1. Create or modify your_lang.json in that folder.

    2. Open ylean_loans/nui/index.js. Find the line:

      and add or change the code to your filename (without .json):

2. Server (Back-End) Translations

  • Directory: ylean_loans/locales/ Contains Lua locale files, e.g. en.lua, pl.lua, etc.

  • Add or Edit a Language

    1. Create or modify yourLang.lua in that folder.

  1. Open config.lua. Find the Ylean.Locales table and add your filename (without .lua):

3. Main NUI HTML

  • File: ylean_loans/nui/index.html Contains static text (headings, placeholders) that may need translation beyond what your JSON files cover.

  • Edit for Your Language

    1. Open index.html.

    2. Translate any hard-coded strings

    3. Restart script


With these steps, you can fully localize ylean_loans in both the UI and server logic. Remember to keep your filenames (without extensions) consistent when referencing them in index.js and config.lua.

Changing the Displayed Currency

To switch the currency symbol shown throughout ylean_loans, update three places: the back-end Lua locales, the NUI JSON locales, and the NUI script.

  1. Back-End (Lua Locales)

    • Open the appropriate file in ylean_loans/locales/ (e.g. en.lua, pl.lua).

    • Locate any entries containing the currency symbol (for example a key like insufficientCreditScore = "Insufficient credit score for a $%d loan! Max allowed: $%d" or inline strings).

    • Replace "$" with your desired symbol (e.g. "€").

    • Save and restart the resource to apply changes.

  2. Front-End NUI (JSON Locales)

    • Open the corresponding JSON file in ylean_loans/nui/locales/ (e.g. en.json, pl.json).

    • Find any keys or values that include the currency symbol (for example "validate_repayment_range": "Repayment Amount must be between $").

    • Replace "$" with your desired symbol.

    • Save the file and reload the NUI to see the updated labels.

  3. Front-End NUI Script

    • Open ylean_loans/nui/index.js.

    • Find the line:

    • Change it to your new symbol, for example:

    • Save the file and reload the script (e.g., via ensure ylean_loans ).

After completing these three steps, all monetary values and labels in both the UI and server logic will use your new currency symbol.

Changing the Date Format

To adjust how dates are displayed in the NUI:

  1. Open ylean_loans/nui/index.js.

  2. Locate the line:

  3. Replace "en-US" with any valid ECMAScript Intl locale string—for example:

  4. Save the file and reload the script (e.g., via ensure ylean_loans ).

The UI will now format all dates according to your chosen locale.

Upcoming Repayment Notification Mechanism

The reminder system alerts borrowers as their payment deadline approaches:

  • Activation: Controlled by notifyAboutUpcomingRepayment.active in each loan’s configuration namespace (IndividualLoanRepayment or BusinessLoanRepayment).

  • Threshold: Defined by notifyAboutUpcomingRepayment.hours—reminders start when the time until the deadline is less than or equal to this value.

  • Frequency: Once the threshold is reached, borrowers receive a notification every hour until they either repay the loan or the deadline passes and the deduction or interest-accrual procedure is triggered.

To configure:

  1. Enable or disable reminders with the active flag.

  2. Set the hours value to determine how far in advance hourly reminders begin.

Immediate Deduction Mode

In this mode, once the repayment deadline passes, the system automatically deducts the full outstanding balance from the borrower’s bank account. This applies to both individual and business loans, subject to the following configuration:

  • Enable/Disable: Controlled by the immediateDeduction flag in each loan’s settings.

  • Credit Score Penalty (individual loans only): If enabled, a fixed number of credit score points (creditScoreLostInCaseOfDelay) is deducted when the funds are collected.

  • Notification: Upon deduction, a log entry and optional webhook notification (e.g., Discord) inform administrators and the borrower of the action.

All related configuration options are defined within the Ylean.IndividualLoanRepayment and Ylean.BusinessLoanRepayment namespaces.

Configuration Steps:

  1. Set immediateDeduction = true to activate this mode.

  2. (Individual loans) Define creditScoreLostInCaseOfDelay to apply penalties for delayed repayment.

Interest Accrual Mode

This mode gradually increases the loan amount by a daily interest rate, providing a grace period before enforcing a full deduction:

  • Interest Accrual: The outstanding principal is multiplied by (1 + interestRate) once per day, compounding until collection.

  • Grace Period: A configurable number of days (daysBeforeDeduction) gives borrowers time to repay without immediate loss of funds.

  • Final Collection: After the grace period, the total accumulated balance (principal plus accrued interest) is deducted in full. Individual loans may also incur a credit score penalty at this point.

All related configuration options are defined within the Ylean.IndividualLoanRepayment and Ylean.BusinessLoanRepayment namespaces.

Configuration Steps:

  1. Set immediateDeduction = false to use interest accrual.

  2. Define interestRate (daily rate) and daysBeforeDeduction (grace period).

  3. (Individual loans) Optionally configure creditScoreLostInCaseOfDelay for score penalties upon final collection.

Comparison of Modes

Feature
Immediate Deduction
Interest Accrual

Activation

immediateDeduction = true

immediateDeduction = false

Interest before deduction

None

Accrued daily until the threshold

Status change

Immediately upon delay

After daysBeforeDeduction days overdue

Funds deducted

Full principal

Accumulated principal + interest

Credit score impact

Individual loans only

Individual loans only

Discord Webhook Logging

Key loan events can be logged to Discord via webhooks, with each action configurable individually under the YleanDC.Logs namespace in discord_logs_cfg.lua file.

Global Settings (YleanDC):

  • ServerName (string): Name of the server displayed in the embed footer.

  • DefaultEmbedColor (integer): Default color code used for embeds when an event-specific color is not provided.

Per-Event Configuration: Each event under YleanDC.Logs supports:

  • Enabled (boolean): Turn logging on or off.

  • WebhookURL (string): Discord webhook endpoint for that event.

  • BotName (string) and BotAvatar (string URL): Identity of the webhook bot.

  • Embed (object): Customization of the embed’s Title, Color, and Thumbnail.

Configured Events:

Event
Description

LoanIndividualNoApproval

Player applied for an individual loan that does not require approval

LoanIndividualApproval

Player applied for an individual loan that requires approval

PartialLoanRepayment

Player made a partial repayment on a loan

FullLoanRepayment

Player fully repaid a loan

SubmitBusinessLoan

Employee submitted a business loan

AcceptBusinessLoan

Player accepted a business loan

RejectBusinessLoan

Player rejected a business loan

OverdueLoanIndividual

Player failed to repay an individual loan on time

OverdueLoanBusiness

Player failed to repay a business loan on time

EmployeeLoanIndividual

Employee granted an individual loan

EmployeeRejectLoanIndividual

Employee rejected an individual loan

EmployeeClockOut

Employee clocked out (ended duty)

EmployeeClockIn

Employee clocked in (started duty)

BossFireEmployee

Boss fired an employee

BossChangeJobGrade

Boss changed an employee's job grade

BossHireEmployee

Boss hired a new employee

CompanyBankDeposit

Deposit made into the company bank account

CompanyBankWithdrawal

Withdrawal made from the company bank account

Last updated