Skip to content

Error in weapon hashes in the event: weaponDamageEvent #3827

@candidow

Description

@candidow

What happened?

When we debug the weaponDamageEvent event, when printing the supposed weapon hash (data.weaponType), one result should appear, but another appears instead.
For example, with the weapon_rpg weapon, when I shoot at another player, the hash result will be 2982836145, but if I use runcode and print(GetHashKey(‘weapon_rpg’)) the result will be -1312131151.
Now, if I debug the startProjectileEvent event and print the supposed weapon hash (data.weaponHash), the result is as expected: -1312131151.

Expected result

Return the correct hash in the weaponDamageEvent event and globalise the hashes

Reproduction steps

1 - Have 2 clients open
2 - Debug the weaponDamageEvent and startProjectileEvent events

AddEventHandler(‘weaponDamageEvent’, function(sender, data)
    print(‘weaponDamageEvent: ’ ..data.weaponType)
end)

AddEventHandler(“startProjectileEvent”, function(sender, data)
    print(‘startProjectileEvent: ’ .. data.weaponHash)
end)

3 - On client 1, shoot at client 2 with an RPG or other weapon
4 - Observe and save the weapon hashes.
5 - Use the runcode and execute

print(GetHashKey(‘weapon_rpg’))

6 - Observe and compare the results

Results:

weaponDamageEvent: 2982836145
startProjectileEvent: -1312131151
runcode: -1312131151

It can be seen that the hashes are not the same.

Image Image Image Image

Importancy

Slight inconvenience

Area(s)

FiveM, OneSync, ScRT: Lua

Specific version(s)

Fivem/Latest/3570 - Server/Windows/25770

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ScRT: LuaIssues/PRs related to the Lua scripting runtimebugtriageNeeds a preliminary assessment to determine the urgency and required action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions