BHD Scripts
  • 📚Documentation
  • Scripts
    • 🖥️BHD Bossmenu
      • Dependencies
      • Instalation
      • Configuration
        • Society Money Log
      • Errors
    • 🚗BHD Garage
      • Dependencies
      • Instalation
      • Configuration
      • Server Configuration
      • Commands
      • Errors
      • Developer Options
        • Exports
          • Client Exports
          • Server Exports
            • Vehicle Object
        • Events
        • Editable Files
          • Client
          • Server
            • editable_server.lua
            • functions.lua
        • Vehicle Images
    • 📜BHD MOT
      • Dependencies
      • Instalation
      • Configuration
    • 🐾BHD Animal Tracker
      • Dependencies
      • Instalation
      • Configuration
Powered by GitBook
On this page
  1. Scripts
  2. BHD Bossmenu

Errors

ERR1 | Database is not inserted, run command /SetupBossMenuDatabase
  • Cause: The required database tables for the BHD Bossmenu script have not been created, or the database setup has not been completed.

  • Solution:

    1. Run the following command in the server console to set up the database:

      /SetupBossMenuDatabase
    2. Alternatively, manually import the import.sql file included with the script into your MySQL database.

    3. Verify that the required tables (e.g., bossmenu_society) now exist in the database.

ERR2 | Invalid type of transaction
  • Cause: The type parameter passed to the bhd_bossmenu:societyMoneyLog event does not match one of the expected values: "outcome" or "income". If the event is called with unsupported type value is passed, the error will be triggered.

  • Relevant Code:

    RegisterNetEvent("bhd_bossmenu:societyMoneyLog", function (message, jobName, type, salary)
        if type ~= "outcome" and type ~= "income" then
            print("[ERROR] | ERR2 | Invalid type of transaction")
            return
        end
    
        MySQL.insert.await('INSERT INTO societybanking_logs (message, job, type, amount) VALUES (?, ?, ?, ?)', 
                           {message, jobName, type, salary})
    end)
  • Explanation: The script checks the value of type and ensures it matches one of the following valid values:

    • "income" (for recording incoming transactions).

    • "outcome" (for recording outgoing transactions).

    Additionally, this event is registered on the server-side, so it must be triggered from a server-side script using the correct parameters.

  • Solution:

    1. Ensure the event is triggered only server-side. Example:

      TriggerEvent("bhd_bossmenu:societyMoneyLog", "Salary payout", "police", "income", 5000)

      ⚠️ Do not trigger this event from the client-side, as it will not work.

    2. Verify that the type parameter is one of the following:

      • "income"

      • "outcome"

    3. Correct Example (Server-Side):

      TriggerEvent("bhd_bossmenu:societyMoneyLog", "Salary deduction", "police", "outcome", 3000)
    4. Incorrect Example (Client-Side):

      TriggerServerEvent("bhd_bossmenu:societyMoneyLog", "Salary deduction", "police", "payment", 3000)
      -- This will not work.
  1. Add debug logs to identify invalid type values or client-side misuse:

    print("Received type: ", type, " | Source: ", source)
ERR3 | No employee data found for source
  • Cause: The bhd_bossmenu:promoteEmployee callback attempts to retrieve employee data after promoting or updating the job grade, but the function GetEmployeeData returned nil (no data found). This can happen if:

    • The employee's job data does not exist in the database.

    • There is an issue fetching the data, such as a missing or incorrectly configured database entry.

  • Relevant Code:

    local jobName = Bridge.GetJob(source).name
    local toReturn = GetEmployeeData(jobName, identifier)
    
    if not toReturn then
        print("[ERROR] | ERR3 | No employee data found for source: "..source)
        return true, false, locale("error_getting_employee_details")
    end
  • Explanation:

    • GetEmployeeData fetches the updated job details for the employee based on their identifier.

    • If the function fails (returns nil), the script logs the error ERR3 and exits the callback.

ERR4 | Trying to open menu, but jobs are not loaded

  • Cause: The bhd_bossmenu:open callback checks if the JobGradesFormatted table is loaded. If it is nil or not initialized, this error is triggered. This typically occurs if the script hasn’t yet loaded job data from the database.

  • Relevant Code:

    if not JobGradesFormatted then
        print("[ERROR] | ERR4 | Trying to open menu, but jobs are not loaded")
        return false, false, locale("try_again_later")
    end
  • Explanation: The script relies on JobGradesFormatted to store job grades and other relevant data. If this table is empty, the menu cannot function because job data hasn’t fully loaded yet.


Solution:

  1. Check the Job Data in the Database:

    • Ensure that all jobs and their grades are properly set up in the database.

    • Run the following SQL query to verify the job table content:

      SELECT * FROM jobs;
  2. Wait a Few Seconds Before Retrying:

    • Job data loading may take a moment when the server or script is restarted. Waiting a few seconds and then attempting to open the menu again usually resolves the issue.

  3. Ensure Proper Script Start Order:

    • Make sure the bhd_bossmenu resource starts after the database connection and job framework initialization (e.g., ESX or QBCore):

      ensure mysql-async
      ensure es_extended
      ensure bhd_bossmenu

Quick Retry Tip:

If you encounter this error, wait 5-10 seconds and try to open the menu again. This delay allows the script to finish loading job data from the database.


Final Notes:

To minimize this issue:

  • Ensure the database contains all necessary job and job grade data.

  • Verify the resource loading order in your server.cfg.

  • Implement additional debug logs to confirm when job data is fully loaded.

PreviousSociety Money LogNextBHD Garage

Last updated 6 months ago

🖥️