Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
3 changes: 2 additions & 1 deletion qbx_afk/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"ignoreGroupsForAFK": {
"mod": true,
"admin": true
}
},
"disabled": false
}
1 change: 1 addition & 0 deletions qbx_afk/server.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local config = lib.loadJson('qbx_afk.config')
if config.disabled then return end

local loggedInPlayers = {}
local checkUser = {}
Expand Down
21 changes: 18 additions & 3 deletions qbx_hudcomponents/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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<const> = 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)
Expand Down
6 changes: 6 additions & 0 deletions qbx_hudcomponents/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
21 changes: 21 additions & 0 deletions qbx_ignore/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions qbx_ignore/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down