Installation

NRG SimCard for LBphone

Required Scripts ⚙️

Before starting the installation process, ensure the following dependencies are installed:

  • es_extended

  • ox_lib

  • ox_inventory

  • lb-phone

  • oxmysql

  • ox_target

Installation Steps 🛠️

  1. Move NRGSimCustom to LB-Phone Script 📂

    • In the lb-phone script, navigate to client > custom.

    • Move the NRGSimCustom folder directly to lb-phone > client > custom .

  2. Check Config.Item.Unique in lb-phone/config/config.lua 🔧

    • Open lb-phone/config/config.lua.

    • Locate the following line Config.Item.Unique and Config.DatabaseChecker.AutoFix

    • If it is set to true, change it to false:

    Config.Item.Unique = false 
    Config.DatabaseChecker.Enabled = false -- not necessary*
    Config.DatabaseChecker.AutoFix = false -- not necessary*

    [DatabaseChecker alternative]

  3. Add items to ox_inventory Script 📝

    • Open the ox_inventory > data > items.lua

    • Add the following code for the new items:

    ["phone"] = {
         label = "Phone",  -- Translate this label to your desired language
         weight = 190,
         stack = false,
         consume = 0,
         client = {
             export = "nrg_simcard.simPhoneOpen",
             add = function()
                 TriggerEvent("nrg_simcard:itemAddedPhone")
             end
         },
         buttons = {
             {
                 label = 'SIM Cards',  -- Translate this label
                 action = function(slot)
                     TriggerEvent('nrg_simcard:SimCards', slot)
                 end
             },
             {
                 label = 'Turn On/Off',  -- Translate this label
                 action = function(slot)
                     TriggerEvent('nrg_simcard:TurnPhoneON', slot)
                 end
             },
         }
     },
    ["custom_number"] = {
         label = "BON - Custom number",  -- Translate this label
         weight = 100,
         stack = true,
         description = "Receive a Custom number at the SIM shop",  -- Translate description
     },
    ["sim_card"] = {
         label = "SIM Card",  -- Translate this label
         weight = 190,
         stack = false,
         consume = 0,
         client = {
             add = function()
                 TriggerEvent("nrg_simcard:itemAddedSIM")
             end
         },
     },
    • Item Duplication Check: Before adding the above code, check if the item name already exists in the ox_inventory configuration. If they exist replace them.

  4. Add Script to Resources 📁 After editing the ox_inventory, you need to ensure that the script is properly added to your server.

    • Place the nrg_simcard folder inside your resources directory.

    • In your server.cfg or resources.cfg file, add the following line to ensure the script is loaded:

    ensure nrg_simcard
  5. Database Setup 🗄️ When you run the script for the first time, a new database called nrg_simcard will be automatically created in your MySQL database.

  6. ⚠️ The script must be uploaded to a clean database with LB phone without any data ⚠️


*if you want to leave the option:

Config.DatabaseChecker.AutoFix = true

Go to lb-phone/server/misc/databaseChecker/databaseChecker.lua

Find and remove or comment:

    if tables.phone_backups.phone_number.keyType ~= "PRI" then
        MySQL.rawExecute.await([[
            ALTER TABLE phone_backups
            DROP PRIMARY KEY,
            ADD PRIMARY KEY (`id`, `phone_number`)
        ]])

        updateChanges = true
    end

This guide will ensure a smooth installation of the NRG SimCard script. Follow the steps carefully to avoid errors and conflicts. If you encounter any issues or need further assistance, feel free to reach out!

Last updated