diff --git a/fxmanifest.lua b/fxmanifest.lua index 9a3d0db..8265b32 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ game 'gta5' name 'qbx_smallresources' description 'Collection of small scripts' repository 'https://github.com/Qbox-project/qbx_smallresources' -version '0.2.0' +version '0.3.0' ox_lib 'locale' diff --git a/qbx_afk/config.json b/qbx_afk/config.json index f53956d..e9cc627 100644 --- a/qbx_afk/config.json +++ b/qbx_afk/config.json @@ -3,5 +3,6 @@ "ignoreGroupsForAFK": { "mod": true, "admin": true - } + }, + "disabled": false } diff --git a/qbx_afk/server.lua b/qbx_afk/server.lua index 7ee4b15..9a7e726 100644 --- a/qbx_afk/server.lua +++ b/qbx_afk/server.lua @@ -1,4 +1,5 @@ local config = lib.loadJson('qbx_afk.config') +if config.disabled then return end local loggedInPlayers = {} local checkUser = {} diff --git a/qbx_hudcomponents/client.lua b/qbx_hudcomponents/client.lua index 3afbd69..0693054 100644 --- a/qbx_hudcomponents/client.lua +++ b/qbx_hudcomponents/client.lua @@ -2,16 +2,31 @@ local config = require 'qbx_hudcomponents.config' local disableHudComponents = config.disable.hudComponents local disableControls = config.disable.controls local displayAmmo = config.disable.displayAmmo +local radioStation = config.disable.radioStation + +-- caching the function instead of checking it later in a loop +local setRadioStation = function() end CreateThread(function() - for i = 1, #disableHudComponents do - SetHudComponentSize(disableHudComponents[i],0.0,0.0) + if radioStation then + -- overriding the default function if the state of radioStation is truthy + setRadioStation = function() + SetVehRadioStation(GetVehiclePedIsIn(PlayerPedId(), false), '') + DisableControlAction(2, 85, true) end - + end while true do + setRadioStation() + -- dropping the native in a loop since it should be called every frame + for i = 1, #disableHudComponents do + HideHudComponentThisFrame(disableHudComponents[i]) + end + for i = 1, #disableControls do DisableControlAction(2, disableControls[i], true) end + + DisplayAmmoThisFrame(displayAmmo) Wait(0) end end) diff --git a/qbx_hudcomponents/config.lua b/qbx_hudcomponents/config.lua index 47e68ac..ca49992 100644 --- a/qbx_hudcomponents/config.lua +++ b/qbx_hudcomponents/config.lua @@ -8,5 +8,11 @@ return { -- the small white dot in the middle of the screen when aiming with a weapon. recticle = true, + + -- whether or not to display ammo in the top right corner of the screen. + displayAmmo = true, + + -- whether or not to display the gta radio station script inside the vehicle + radioStation = true } } diff --git a/qbx_ignore/client.lua b/qbx_ignore/client.lua index 847ad22..4df47a1 100644 --- a/qbx_ignore/client.lua +++ b/qbx_ignore/client.lua @@ -16,6 +16,27 @@ CreateThread(function() end end) +CreateThread(function() + if config.disable.meleeWithWeapon then + -- Disable weapon melee attacks + while true do + local ped = cache.ped + local weapon = GetSelectedPedWeapon(ped) + local weaponGroup = GetWeapontypeGroup(weapon) + + if weaponGroup ~= `GROUP_MELEE` and weaponGroup ~= `GROUP_UNARMED` then + DisableControlAction(0, 140, true) -- Melee Attack Light + DisableControlAction(0, 141, true) -- Melee Attack Heavy + DisableControlAction(0, 142, true) -- Melee Attack Alternate + DisableControlAction(0, 263, true) -- Melee Attack 1 + DisableControlAction(0, 264, true) -- Melee Attack 2 + end + + Wait(0) + end + end +end) + AddEventHandler('populationPedCreating', function(x, y, z) Wait(500) -- Give the entity some time to be created local _, handle = GetClosestPed(x, y, z, 1.0) -- Get the entity handle diff --git a/qbx_ignore/config.lua b/qbx_ignore/config.lua index d796828..e37df86 100644 --- a/qbx_ignore/config.lua +++ b/qbx_ignore/config.lua @@ -9,6 +9,8 @@ return { -- Disables headshots instantly killing players headshots = false, + -- Disables melee attacks with weapons (e.g. using a gun to hit someone close to) + meleeWithWeapon = true, }, blacklisted = {