diff --git a/fxmanifest.lua b/fxmanifest.lua index 4fe2e2c..ba60257 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -15,7 +15,7 @@ description 'A library of shared functions to utilise in other resources.' --[[ Manifest ]]-- dependencies { - '/server:5104', + '/server:5848', '/onesync', } diff --git a/imports/addKeybind/client.lua b/imports/addKeybind/client.lua index 484eee0..ea6c61d 100644 --- a/imports/addKeybind/client.lua +++ b/imports/addKeybind/client.lua @@ -1,3 +1,5 @@ +if cache.game == 'redm' then return end + ---@class KeybindProps ---@field name string ---@field description string diff --git a/imports/getCore/es_extended/client.lua b/imports/getCore/es_extended/client.lua index 7134759..790e039 100644 --- a/imports/getCore/es_extended/client.lua +++ b/imports/getCore/es_extended/client.lua @@ -1,3 +1,4 @@ +if cache.game == 'redm' then return end if not lib.player then lib.player() end return function(resource) diff --git a/imports/getCore/es_extended/server.lua b/imports/getCore/es_extended/server.lua index 7d01c72..55e9250 100644 --- a/imports/getCore/es_extended/server.lua +++ b/imports/getCore/es_extended/server.lua @@ -1,3 +1,4 @@ +if cache.game == 'redm' then return end if not lib.player then lib.player() end return function(resource) diff --git a/imports/getCore/qb-core/client.lua b/imports/getCore/qb-core/client.lua index 97bdbc3..c5be652 100644 --- a/imports/getCore/qb-core/client.lua +++ b/imports/getCore/qb-core/client.lua @@ -1,3 +1,4 @@ +if cache.game == 'redm' then return end if not lib.player then lib.player() end return function(resource) diff --git a/imports/getCore/qb-core/server.lua b/imports/getCore/qb-core/server.lua index 96b38d0..999b50c 100644 --- a/imports/getCore/qb-core/server.lua +++ b/imports/getCore/qb-core/server.lua @@ -1,3 +1,4 @@ +if cache.game == 'redm' then return end if not lib.player then lib.player() end return function(resource) diff --git a/imports/getCore/shared.lua b/imports/getCore/shared.lua index 8435b5c..bf7a21b 100644 --- a/imports/getCore/shared.lua +++ b/imports/getCore/shared.lua @@ -1,3 +1,4 @@ +if cache.game == 'redm' then return end --[[ This module was experimental and won't be worked on or used further. May be removed in the future. diff --git a/init.lua b/init.lua index 95bafdb..2d0e18a 100644 --- a/init.lua +++ b/init.lua @@ -144,7 +144,7 @@ end -- Cache ----------------------------------------------------------------------------------------------- -cache = { resource = GetCurrentResourceName() } +cache = { game = GetGameName(), resource = GetCurrentResourceName() } if context == 'client' then setmetatable(cache, { diff --git a/resource/cache/client.lua b/resource/cache/client.lua index af8f66e..d1e1465 100644 --- a/resource/cache/client.lua +++ b/resource/cache/client.lua @@ -13,6 +13,8 @@ end local GetVehiclePedIsIn = GetVehiclePedIsIn local GetPedInVehicleSeat = GetPedInVehicleSeat local GetVehicleMaxNumberOfPassengers = GetVehicleMaxNumberOfPassengers +local GetMount = GetMount +local IsPedOnMount = IsPedOnMount local GetCurrentPedWeapon = GetCurrentPedWeapon CreateThread(function() @@ -38,6 +40,12 @@ CreateThread(function() cache:set('seat', false) end + if cache.game == 'redm' then + local mount = GetMount(ped) + local onMount = IsPedOnMount(ped) + cache:set('mount', onMount and mount or false) + end + local hasWeapon, currentWeapon = GetCurrentPedWeapon(ped, true) cache:set('weapon', hasWeapon and currentWeapon or false) diff --git a/resource/interface/client/menu.lua b/resource/interface/client/menu.lua index a6df23b..9f4f79b 100644 --- a/resource/interface/client/menu.lua +++ b/resource/interface/client/menu.lua @@ -50,12 +50,13 @@ function lib.showMenu(id, startIndex) end if not openMenu then + local control = cache.game == 'fivem' and 140 or 0xE30CD707 CreateThread(function() while openMenu do if openMenu.disableInput == nil or openMenu.disableInput then DisablePlayerFiring(cache.playerId, true) HudWeaponWheelIgnoreSelection() - DisableControlAction(0, 140, true) + DisableControlAction(0, control, true) end Wait(0) diff --git a/resource/interface/client/progress.lua b/resource/interface/client/progress.lua index cd1d787..fdb681d 100644 --- a/resource/interface/client/progress.lua +++ b/resource/interface/client/progress.lua @@ -74,32 +74,48 @@ local function startProgress(data) end local disable = data.disable + local isFivem = cache.game == 'fivem' + local controls = { + ['INPUT_LOOK_LR'] = isFivem and 1 or 0xA987235F, + ['INPUT_LOOK_UD'] = isFivem and 2 or 0xD2047988, + ['INPUT_SPRINT'] = isFivem and 21 or 0x8FFC75D6, + ['INPUT_AIM'] = isFivem and 25 or 0xF84FA74F, + ['INPUT_MOVE_LR'] = isFivem and 30 or 0x4D8FB4C1, + ['INPUT_MOVE_UD'] = isFivem and 31 or 0xFDA83190, + ['INPUT_DUCK'] = isFivem and 36 or 0xDB096B85, + ['INPUT_VEH_MOVE_LEFT_ONLY'] = isFivem and 63 or 0x9DF54706, + ['INPUT_VEH_MOVE_RIGHT_ONLY'] = isFivem and 64 or 0x97A8FD98, + ['INPUT_VEH_ACCELERATE'] = isFivem and 71 or 0x5B9FD4E2, + ['INPUT_VEH_BRAKE'] = isFivem and 72 or 0x6E1F639B, + ['INPUT_VEH_EXIT'] = isFivem and 75 or 0xFEFAB9B4, + ['INPUT_VEH_MOUSE_CONTROL_OVERRIDE'] = isFivem and 106 or 0x39CCABD5 + } while progress do if disable then if disable.mouse then - DisableControlAction(0, 1, true) - DisableControlAction(0, 2, true) - DisableControlAction(0, 106, true) + DisableControlAction(0, controls['INPUT_LOOK_LR'], true) + DisableControlAction(0, controls['INPUT_LOOK_UD'], true) + DisableControlAction(0, controls['INPUT_VEH_MOUSE_CONTROL_OVERRIDE'], true) end if disable.move then - DisableControlAction(0, 21, true) - DisableControlAction(0, 30, true) - DisableControlAction(0, 31, true) - DisableControlAction(0, 36, true) + DisableControlAction(0, controls['INPUT_SPRINT'], true) + DisableControlAction(0, controls['INPUT_MOVE_LR'], true) + DisableControlAction(0, controls['INPUT_MOVE_UD'], true) + DisableControlAction(0, controls['INPUT_DUCK'], true) end if disable.car then - DisableControlAction(0, 63, true) - DisableControlAction(0, 64, true) - DisableControlAction(0, 71, true) - DisableControlAction(0, 72, true) - DisableControlAction(0, 75, true) + DisableControlAction(0, controls['INPUT_VEH_MOVE_LEFT_ONLY'], true) + DisableControlAction(0, controls['INPUT_VEH_MOVE_RIGHT_ONLY'], true) + DisableControlAction(0, controls['INPUT_VEH_ACCELERATE'], true) + DisableControlAction(0, controls['INPUT_VEH_BRAKE'], true) + DisableControlAction(0, controls['INPUT_VEH_EXIT'], true) end if disable.combat then - DisableControlAction(0, 25, true) + DisableControlAction(0, controls['INPUT_AIM'], true) DisablePlayerFiring(cache.playerId, true) end end diff --git a/resource/vehicleProperties/client.lua b/resource/vehicleProperties/client.lua index 866b478..af6031f 100644 --- a/resource/vehicleProperties/client.lua +++ b/resource/vehicleProperties/client.lua @@ -1,3 +1,5 @@ +if cache.game == 'redm' then return end + ---@class VehicleProperties ---@field model? string ---@field plate? string diff --git a/resource/zoneCreator/client.lua b/resource/zoneCreator/client.lua index 0269d1b..9c29e59 100644 --- a/resource/zoneCreator/client.lua +++ b/resource/zoneCreator/client.lua @@ -136,6 +136,13 @@ local function drawLines() end end +local isFivem = cache.game == 'fivem' +local controls = { + ['INPUT_LOOK_LR'] = isFivem and 1 or 0xA987235F, + ['INPUT_LOOK_UD'] = isFivem and 2 or 0xD2047988, + ['INPUT_MP_TEXT_CHAT_ALL'] = isFivem and 245 or 0x9720FCEE +} + local function startCreator(arg) creatorActive = true controlsActive = true @@ -191,9 +198,9 @@ local function startCreator(arg) if controlsActive then DisableAllControlActions() - EnableControlAction(0, 1, true) - EnableControlAction(0, 2, true) - EnableControlAction(0, 245, true) -- t + EnableControlAction(0, controls['INPUT_LOOK_LR'], true) + EnableControlAction(0, controls['INPUT_LOOK_UD'], true) + EnableControlAction(0, controls['INPUT_MP_TEXT_CHAT_ALL'], true) local change = false local lStep = steps[1][step] local rStep = steps[2][step]