Enable Aim Dot when Shooting

Currently when I aim, there’s no dot. How do you enable it or what mod/script do you need? I’m not talking about aim assist or aim bot.

You have a resource running that is removing it by calling HideHudComponentThisFrame(14)

Where do you find the file or folder? I’m on QBCore

You search them all

Probably in qb-smallresources

1 Like

Found it the qb-smallresources , what should I do next?

You can probably use the “IsPlayerFreeAiming(PlayerId())” function.

You should wrap the previous mentioned function in a if statement around line 27 of qb-smallresources/client/hudcomponents.lua: qb-smallresources/client/hudcomponents.lua at 10af83bbd91ce73c7418de0e801870973c016532 · qbcore-framework/qb-smallresources · GitHub

(I haven’t used lua in a while, but I think this should work:)

for i = 1, #disableHudComponents do
        -- Get the hud id
        local hudId = disableHudComponents[i]
        -- If current hudId isn't 14 hide hud-id
        -- If player is not aiming, hide hud-id
        if hudId is not 14 or not IsPlayerFreeAiming(PlayerId()) then
                HideHudComponentThisFrame(hudId)
        -- If hud-id is 14 (and player is aiming, stated by the previous if) show id 14
        elseif hudId is 14 then
                ShowHudComponentThisFrame(hudId)
        end
end

Sources:

It’s confusing for me since I’m new to this. Can you help me write it so I can copy and paste it into small-resources config?

@c_rammmm

local isAiming = IsControlPressed(0, 24) -- Check if the right mouse button (aim) is held down

for i = 1, #disableHudComponents do
    if isAiming then
        HideHudComponentThisFrame(disableHudComponents[i])
    end
end

or use this script

Should I add this to qb-smallresources config file?

It depends on whether you’re using the script or the code. We just replaced the code in ‘qb-smallresources/client/hudcomponents.lua line 26-32’ on my friend’s server, and it worked fine. However, I can’t guarantee that it will run on your server as smoothly as it did when we initially set it up. We haven’t encountered any errors, and it’s been running fine up to this day. Please make a backup of ‘qb-smallresources,’ and if it doesn’t work, then use the script.

Oh okay you’re talking about having it like this removing number 14 from the config?

disableHudComponents = {1, 2, 3, 4, 7, 9, 13, 19, 20, 21, 22}, – Hud Components: HideHudComponentThisFrame - FiveM Natives @ Cfx.re Docs
disableControls = {37}, – Controls: Controls - Cfx.re Docs
displayAmmo = true – false disables ammo display

if you go to qb-smallresources > client > hudcomponents.lua and remove the code below it should work, worked for me

image

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.