NEXT Scripts Docs
  • NEXT Scripts | FiveM Resource Studio
  • CHAR CREATOR
    • Info | CharCreator
    • Installation
    • Events
  • X MENU
    • Info | X Menu
    • Installation
      • Configuration
      • Job Lock & Multi Job
    • Utils
  • Binoculars
    • Info | Binoculars
Powered by GitBook
On this page
  • Change open key
  • Move while open & click on close
  • Configure the default menu
  • Submenus
  • Block the menu
  1. X MENU
  2. Installation

Configuration

Change open key

To change the key that opens the x menu you have to go to the config.lua in line 4 and change the key to what ever you want it to be. Be carefuel, you only can chnage it once.

Config.OpenKey = "X"

Note: The script's key can only be set during initial installation. Changing it later has no effect on players that already have been using it, becuase the key is saved in their game cache.

In Config.KeyDescription you can chnage the Description for the Keymapping shown in the GTA Settigs.

Move while open & click on close

In the config.lua you will notice at the very top you will notice these two options

Config.CloseMenuOnClick = false
Config.MoveWhileOpen = false

But what do they mean?

Config.CloseMenuOnClick = true

If true, the menu closes automaticly after you click a button, if false the menu is still open after clicking. If you only want the x menu to close on certian button, you can add this to the buttons config:

execute = function()

          
end

Config.MoveWhileOpen = true

If true, your controls are still enabled while the menu is open and you can still walk. If false your controls are getting blocked while the menu is open and you cant move.

Configure the default menu

In the 'Config.Buttons' section, you can set the buttons for the default menu that can be opened by all players if the job lock is inactive. An example is provided in the configuration, but I'll explain it here. You need to add seven elements, named button0 to button6. Button0 is the middle button, which typically serves as a display for the logo and has no function. I'll walk you through how to build one of these 'button elements'.

['button'] = {
        active = true,
        image = "imgs/image.png",
        hovertext = true,
        text = "TEXT",
        execute = function()
           
        end,
        submenu = {
            active = false
        }
    }

active

active = true | false

This value determines the button's active status. If set to false, the button will be inactive and not be clickable.

image

image = "pathtoimage/image.png"

Here you can configure what image is shown on the button. jp, png, svg are supported. Either put a path to a image in the /html/imgs folder or a direct link to the image. leave it blank for no image.

hovertext

hovertext = true | false

Whether you want to show a text while hovering the button or not

text

text = "string" -- max. 8 characters

Here you can set the text which is shwon on hover if hovertext = true

execute

execute = function()
           -- execute something if button is clicked
end

This function is executed if the button is klicked, you can put anything there

Submenus

The X Menu supports to set a unique submenu for every button.

submenu = {
    active = false
}

How to configure a Submenu?

Just set active = true in the submenu section. Now you have to add three Button elements, similar to them in the main menu to the submenu. The names always have to be button1, button2 and button3.

Heres a example:

Note that a submenu button can“t have a submenu itself. Trying todo this will cause errors.

['button1'] = {
    active = true,
    image = "imgs/image.png",
    hovertext = true,
    text = "text",
    execute = function()
        
    end,
    submenu = {
        active = true,
        ['button1'] = {
            active = true,
            image = "imgs/image.png",
            hovertext = true,
            text = "text",
            execute = function()
                
            end
        },
        ['button2'] = {
            active = true,
            image = "imgs/image.png",
            hovertext = true,
            text = "text",
            execute = function()
                
            end
        },
        ['button3'] = {
            active = true,
            image = "imgs/image.png",
            hovertext = true,
            text = "text",
            execute = function()
                
            end
        }
    } 
}

Block the menu

The menu can be blocked under certein circumstances.

While player is dead

If you want the x menu to be blocked while the player is dead. You can do this in config.lua line 135 - 138. Just set Config.BlockMenuIfDead = true and if not already done configure the events for the death & revive.

Config.BlockMenuIfDead = true
Config.OnDeathEvent = "esx:onPlayerDeath"
Config.ReviveEvent = "esx_ambulancejob:revive"
Config.PlayerSpawnedEvent = "playerSpawned"

While player is cuffed, etc.

You can lock the x menu under any circumstance, for example when the player is tied up. You only have to configure the function ShouldMenuBeLocked() , for example with an export of your cuff script, so that it returns true if the menu is to be blocked.

If not used this function has to return false so the x menu isent locked permanently

function ShouldMenuBeLocked()

    return false
end

while player is swinning or falling

You can lock the x menu in case the player is falling or swimming at the moment with thes two config options in line 140 & 141:

Config.LockWhileFalling = true
Config.LockWhileSwimming = true

exports

You also can lock and unlock the x menu from other scripts whith these exports:

exports['next-xmenu']:LockXMenu() -- Lock the X Menu
exports['next-xmenu']:UnlockXMenu() -- Unlock the X Menu
exports['next-xmenu']:CloseXMenu() -- Close the X Menu

PreviousInstallationNextJob Lock & Multi Job

Last updated 2 years ago