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:
Run the following command in the server console to set up the database:
/SetupBossMenuDatabaseAlternatively, manually import the
import.sqlfile included with the script into your MySQL database.Verify that the required tables (e.g.,
bossmenu_society) now exist in the database.
ERR2 | Invalid type of transaction
Cause: The
typeparameter passed to thebhd_bossmenu:societyMoneyLogevent does not match one of the expected values:"outcome"or"income". If the event is called with unsupportedtypevalue 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
typeand 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:
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.
Verify that the
typeparameter is one of the following:"income""outcome"
Correct Example (Server-Side):
TriggerEvent("bhd_bossmenu:societyMoneyLog", "Salary deduction", "police", "outcome", 3000)Incorrect Example (Client-Side):
TriggerServerEvent("bhd_bossmenu:societyMoneyLog", "Salary deduction", "police", "payment", 3000) -- This will not work.
Add debug logs to identify invalid
typevalues or client-side misuse:print("Received type: ", type, " | Source: ", source)
ERR3 | No employee data found for source
Cause: The
bhd_bossmenu:promoteEmployeecallback attempts to retrieve employee data after promoting or updating the job grade, but the functionGetEmployeeDatareturnednil(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") endExplanation:
GetEmployeeDatafetches the updated job details for the employee based on their identifier.If the function fails (returns
nil), the script logs the errorERR3and exits the callback.
ERR4 | Trying to open menu, but jobs are not loaded
Cause: The
bhd_bossmenu:opencallback checks if theJobGradesFormattedtable is loaded. If it isnilor 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") endExplanation: The script relies on
JobGradesFormattedto 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:
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;
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.
Ensure Proper Script Start Order:
Make sure the
bhd_bossmenuresource 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.
Last updated