Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetCurrentPedWeapon (0xADF692B254977C0C) doesn't actually do anything. #3226

Open
Rohaneanew91 opened this issue Mar 11, 2025 · 1 comment
Open
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action

Comments

@Rohaneanew91
Copy link

What happened?

When trying to do some experimentation with natives and weapon attachments, I made this small snip of code (below, setWeapon). Neither invoking the native, or calling it directly seems to do anything, regardless of the args utilized.

local WeaponAttachPoint = {
    WEAPON_ATTACH_POINT_INVALID = -1,
    WEAPON_ATTACH_POINT_HAND_PRIMARY = 0,
    WEAPON_ATTACH_POINT_HAND_SECONDARY = 1,
    WEAPON_ATTACH_POINT_PISTOL_R = 2,
    MAX_HAND_WEAPON_ATTACH_POINTS = 2,
    WEAPON_ATTACH_POINT_PISTOL_L = 3,
    WEAPON_ATTACH_POINT_KNIFE = 4,
    WEAPON_ATTACH_POINT_LASSO = 5,
    WEAPON_ATTACH_POINT_THROWER = 6,
    WEAPON_ATTACH_POINT_BOW = 7,
    WEAPON_ATTACH_POINT_BOW_ALTERNATE = 8,
    WEAPON_ATTACH_POINT_RIFLE = 9,
    WEAPON_ATTACH_POINT_RIFLE_ALTERNATE = 10,
    WEAPON_ATTACH_POINT_LANTERN = 11,
    WEAPON_ATTACH_POINT_TEMP_LANTERN = 12,
    WEAPON_ATTACH_POINT_MELEE = 13,
    MAX_SYNCED_WEAPON_ATTACH_POINTS = 13,
    WEAPON_ATTACH_POINT_HIP = 14,
    WEAPON_ATTACH_POINT_BOOT = 15,
    WEAPON_ATTACH_POINT_BACK = 16,
    WEAPON_ATTACH_POINT_FRONT = 17,
    WEAPON_ATTACH_POINT_SHOULDERSLING = 18,
    WEAPON_ATTACH_POINT_LEFTBREAST = 19,
    WEAPON_ATTACH_POINT_RIGHTBREAST = 20,
    WEAPON_ATTACH_POINT_LEFTARMPIT = 21,
    WEAPON_ATTACH_POINT_RIGHTARMPIT = 22,
    WEAPON_ATTACH_POINT_LEFTARMPIT_RIFLE = 23,
    WEAPON_ATTACH_POINT_SATCHEL = 24,
    WEAPON_ATTACH_POINT_LEFTARMPIT_BOW = 25,
    WEAPON_ATTACH_POINT_RIGHT_HAND_EXTRA = 26,
    WEAPON_ATTACH_POINT_LEFT_HAND_EXTRA = 27,
    WEAPON_ATTACH_POINT_RIGHT_HAND_AUX = 28,
    MAX_WEAPON_ATTACH_POINTS = 29
}

RegisterCommand("currentWeapon", function(source, args, rawCommand)
    local playerPed = PlayerPedId()

    for enumName, attachValue in pairs(WeaponAttachPoint) do
        local gotWeapon, weaponHash = GetCurrentPedWeapon(playerPed, false, attachValue, false)
        print(enumName, "=> attachValue:", attachValue, "gotWeapon:", gotWeapon, "hash:", weaponHash)
        print("Printing Weapon Name:", GetWeaponName(weaponHash))
    end
end, false)

RegisterCommand("setWeapon", function(source, args, rawCommand)
    local playerPed = PlayerPedId()
    print("Recieved setWeapon command with args:", args[1], args[2])
    local weaponHash = GetHashKey(tostring(args[1]))
    print("[Debug]: setWeapon weaponHash after conversion", weaponHash)
    local equipNow = true
    local attachPoint = args[2]

    Citizen.InvokeNative(0xADF692B254977C0C, playerPed, weaponHash, equipNow, attachPoint, false, false) -- SetCurrentPedWeapon
end, false)

Expected result

When using the command /setWeapon WEAPON_MELEE_LANTERN 0, it should be adding a lantern to my hand, in theory.

Reproduction steps

  • Added the above code snip to a client-side script
  • Attempted to use the command using different args (different weapon strings specifically, as well as attach points)
  • Ran the /currentWeapon command to verify that the weapon didn't get added to the attach point

Importancy

Slight inconvenience

Area(s)

Natives

Specific version(s)

RedM b12508, game version 1491

Additional information

No response

@Rohaneanew91 Rohaneanew91 added bug triage Needs a preliminary assessment to determine the urgency and required action labels Mar 11, 2025
@outsider31000
Copy link
Contributor

outsider31000 commented Mar 11, 2025

try use this one before
0x5E3BDDBCB83F3D84 and then use the one you are trying to use after
but i think is not for 2 handed weapons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

2 participants