🗃️SQL Installation

The script features automatic installation of SQL tables and columns, so performing these steps is not necessary unless you encounter issues with the automatic installation or require special instructions for your MySQL database.

It is recommended that manual SQL installation be carried out by a developer. If you are not a developer, we recommend opening a support ticket on our Discord server for assistance.

Once you extract the script from its compressed .ZIP file and open the folder, you will find a folder called [SQL], there you will find the code you will need to configure the script database.

  1. Review 'items.md': Open the 'items.md' file inside the [SQL] folder to understand the formats required for adding items in the inventory script.

  2. Prepare MySQL: Open your MySQL Database Management System and access your corresponding database.

  3. Add the line 'USE `esxlegacy_[id];`': Before pasting the SQL code block from the 'job.sql' file, make sure you are using the correct database. If your database has an 'esxlegacy_' prefix followed by some identifier, make sure you use that prefix followed by your identifier. For example, if your identifier is '123', the line should be USE `esxlegacy_123`;;.

  4. Paste the SQL code block: Copy the SQL code block from the 'job.sql' file and paste it into the MySQL Database Management System, ensuring the entire block is correctly selected.

  5. Execute the code: Execute the code. This will create the necessary tables and perform data insertions in your database.

  6. Verification: After executing the code, verify that the actions have been performed correctly. You can review the created tables and inserted data to ensure everything is in order.

Following these instructions, you should be able to effectively utilize the [SQL] folder of your FiveM script to perform the necessary actions in your MySQL database.

job.sql

INSERT IGNORE INTO  `addon_account` (name, label, shared) VALUES
  ('society_japanese','Japanese',1)
;

INSERT IGNORE INTO  `jobs` (name, label) VALUES
  ('japanese','Japanese')
;

INSERT IGNORE INTO  `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
  ('japanese',0,'employee','Employee',10,'{}','{}'),
  ('japanese',1,'assistant','Assistant',25,'{}','{}'),
  ('japanese',2,'boss','Boss',40,'{}','{}')
;

SQL Instructions Explained

SQL Command Summary

The INSERT IGNORE INTO statement is used to add a new row into the addon_account table. Here's a breakdown of the command:

  • Table Name: addon_account - the table where the new row will be added.

  • Columns: The command specifies three columns to be populated:

    • name - a unique identifier for the account, here set as 'society_japanese'.

    • label - a human-readable name for the account, set as 'Japanese'.

    • shared - a flag indicating whether the account is shared (1 for true).

  • VALUES: The values being inserted correspond to the columns mentioned above, i.e., ('society_japanese','Japanese',1) indicates that the new account will have the identifier society_japanese, the label Japanese, and it is marked as shared.

The IGNORE part of the command tells MySQL to skip this insert if a row with the same primary key or unique index already exists, preventing duplication errors.

Last updated