Hey I am trying to create a no reticle script that allows you to set reticle bypass for specific scopes, and specific weapons. But when I try to use IsPedWeaponComponentActive, HasWeaponGotWeaponComponent, and/or HasPedGotWeaponComponent I just get a false value even though I have the weapon and the component on.
Does anyone know how it would be possible to do this?
Do you mind sharing what you have tried?
HasPedGotWeaponComponent
works fine for me
I have tried this
HasPedGotWeaponComponent(PlayerPedId(), GetCurrentPedWeapon( ped, true ), ‘COMPONENT_MPX_SCOPE_09’)
replacing the ‘COMPONENT_MPX_SCOPE_09’ with the actual hash doing it with/without the qoutes etc.
Can you show me how your doing it?
local ped = PlayerPedId()
local weapon_hash = GetSelectedPedWeapon(ped)
local component_hash = GetHashKey("COMPONENT_AT_SCOPE_MACRO")
if HasPedGotWeaponComponent(ped, weapon_hash, component_hash) then
-- Do stuff...
end
Did you look at the docs for GetCurrentPedWeapon - FiveM Natives @ Cfx.re Docs
I believe it should be local _, weapon_hash = GetCurrentPedWeapon(PlayerPedId(), true)
The first return value
seems to indicate returns true if the hash of the weapon object weapon equals the weapon hash.
and the second one is the weapon hash
Okay so I am being dumb right now.
How would I get this code to work with say a Config.Scopes
so users would be able to list their scope name and if they are using it, the code will work?
Sorry for asking so many questions but I have spent the last hour or 2 trying to find work arounds to allow me to make it so people can config scopes and allow multiple scopes to be useable, but its not working no mater what I do.
Do you have any ideas of how I can add a config inside of that for the scope components?