diff --git a/config.lua b/config.lua index 9be7233..ca666f4 100644 --- a/config.lua +++ b/config.lua @@ -26,13 +26,13 @@ Config = {} Config.VersionChecker = 0 --This is how you open the menu either via a command or button ---Button = 0 [Default] | Command = 1 -Config.OpenMenu = 0 +--Default = true | +Config.EnableButton = true --This is the button that will open the menu (If chosen at Config.OpenMenu) ---Default = 244 [M] | To change the button check out https://docs.fivem.net/game-references/controls/ +--Default = M | To change the button check out https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/ --Controller Support for this resource is DISABLED! -Config.MenuButton = 244 +Config.MenuButton = 'M' --This is the command that will open the menu (If chosen at Config.OpenMenu) Config.Command = 'semmenu' diff --git a/menu.lua b/menu.lua index 6e7ebe1..3a5806c 100644 --- a/menu.lua +++ b/menu.lua @@ -1072,28 +1072,22 @@ Citizen.CreateThread(function() _MenuPool:ControlDisablingEnabled(false) _MenuPool:MouseControlsEnabled(false) - if IsControlJustPressed(1, Config.MenuButton) and GetLastInputMethod(2) then - if not menuOpen then - Menu() - MainMenu:Visible(true) - else - _MenuPool:CloseAllMenus() - end - end end end) - +if Config.EnableButton then + RegisterKeyMapping(Config.Command, 'Open Interaction Menu', 'keyboard', Config.MenuButton) +end RegisterCommand(Config.Command, function(source, args, rawCommands) - if Config.OpenMenu == 1 then + if not menuOpen then Menu() MainMenu:Visible(true) + else + _MenuPool:CloseAllMenus() end end) Citizen.CreateThread(function() - if Config.OpenMenu == 1 then - TriggerEvent('chat:addSuggestion', '/' .. Config.Command, 'Used to open SEM_InteractionMenu') - end + TriggerEvent('chat:addSuggestion', '/' .. Config.Command, 'Used to open SEM_InteractionMenu') end) \ No newline at end of file