Is it me who can’t get a native working or the GetPlayerWeaponDamageModifier native always return 1.0 ? I’ve tried it on both server side with netId of the player and client side with PlayerId() and it is always returning 1.0 even though my pistol makes a car explode in 3 shots ?
If you did not change the modifier (in the weapon meta, cfx native), it’s default value will be 1.0.
Also, GetWeaponDamageModifier - FiveM Natives @ Cfx.re Docs takes only a weapon hash as argument, and is also client-sided.
So your code would somewhat look like:
client.lua
local targetWeapon = `weapon_pistol`
local weaponDamageModifier = GetWeaponDamageModifier(targetWeapon)
print(weaponDamageModifier) -- prints 1.0 as we did not change anything
SetWeaponDamageModifier(targetWeapon, 0.5)
weaponDamageModifier = GetWeaponDamageModifier(targetWeapon)
print(weaponDamageModifier) -- prints 0.5 as we changed the damage modifier to 0.5
Indeed GetWeaponDamageModifier does work, I knew it but I was using GetPlayerWeaponDamageModifier to create a server sided logic to prevent damage modifiers from cheaters but I guess I’ll have to stay client sided for this.