Weapon damage

Hello,

Is anyone able to point me in the right direction of a server modification that modifies weapon damage.
For example during shootouts there have been many times where I have shot a suspect in the torso 4+ times but then they get one well placed shot in my head and I die instantly and their free to run or drive off as if nothing happened.

any help is appreciated

Kind regards
Mr Blue

You can set a global weapon modifier using this native.

https://runtime.fivem.net/doc/reference.html#_0xCE07B9F7817AADA3

You can set the modifier values based on the current equipped weapon…

i.e.

if currentWeapon == smg then
    SetWeaponDamageMultiplier(player, 10)
end

(above code is purely hypothetical)

4 Likes

Thank you for the quick reply.

Unfortunately i have no experience using these natives or programming for fivem mods. Would you be able to provide me with a rough guide or link to anything that can help.

Regards
Mr Blue

Can this simply be done as a script resource?

2 Likes

Someone Find a script or correct code ?

1 Like

where did you get it?

so where on my server could this be ? SET_PLAYER_WEAPON_DAMAGE_MODIFIER ? is it a file i can edit?

Citizen.CreateThread(function()
    while true do
	N_0x4757f00bc6323cfe(GetHashKey("WEAPON_UNARMED"), 0.1) 
    	Wait(0)
    	N_0x4757f00bc6323cfe(GetHashKey("WEAPON_NIGHTSTICK"), 0.1) 
    	Wait(0)
    end
end)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
	local ped = PlayerPedId()
        if IsPedArmed(ped, 6) then
	   DisableControlAction(1, 140, true)
       	   DisableControlAction(1, 141, true)
           DisableControlAction(1, 142, true)
        end
    end
end)

here

2 Likes

Thanks!

1 Like

so i just add all the weapons we use,

kinda like this
Citizen.CreateThread(function()
while true do
N_0x4757f00bc6323cfe(GetHashKey(“WEAPON_UNARMED”), 0.1)
Wait(0)
N_0x4757f00bc6323cfe(GetHashKey(“WEAPON_NIGHTSTICK”), 0.1)
Wait(0)
N_0x4757f00bc6323cfe(GetHashKey(“WEAPON_PISTOL”), 0.1)
Wait(0)
N_0x4757f00bc6323cfe(GetHashKey(“WEAPON_SHOTGUN”), 0.1)
Wait(0)
end
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
if IsPedArmed(ped, 6) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)

that 0.1 is the dmg modifier i bet…
then i make a folder call it something like weapondmg, make a __resource.lua and make an above text file with all the code above in it. save that as something like weapondmg.lua
in your above example you wrote (((N_0x4757f00bc6323cfe))) just checking to see if that is going to be the same for every line, all i have to do is put all the WEAPON_GUNSNAMES and i should be good to go right?

if that is all it takes I LOVE YOU , if it is not what all it takes I STILL LOVE YOU

a blanl __resouce file right
resource_manifest_version “77731fab-63ca-442c-a67b-abc70f28dfa5”

i dont need to add something like
server_scripts {

	"weapondmg.lua",

}

client_scripts {
“weapondmgr.lua”,\

thanks again

update :::: well it did not work and now for somereason i cannot /heal
ok new update /heal was effected by something else got that fixed,

my new weapon one did not change the dmg, dont know if it is the coding or was i supposed to do more with __resource

I’m not sure this is for you, but it works with all my weapons, what you need to do is add the “N_0x4757f00bc6323cfe script (GetHashKey (” WEAPON_SHOTGUN "), 0.1)
Wait (0) "and change the name of the gun

1 Like

so im missing the word “script” is that the only difference?

yea its WEAPON_PUMPSHOTGUN i think it was a bad example sorry about that
wait and also quotations around the whole thing too?

so like this as a example
Citizen.CreateThread(function()
while true do
“N_0x4757f00bc6323cfe script (GetHashKey (” WEAPON_KNIFE "), 0.1)
Wait (0) "
“N_0x4757f00bc6323cfe script (GetHashKey (” WEAPON_PISTOL "), 0.1)
Wait (0) "
end
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
if IsPedArmed(ped, 6) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
end
end
end)

I got it working thanks!

like where do i edit those weapon stats like on database or where?

2 Likes

nvm is it just that i create folder to resource folder and then just paste that code to __resource.lua

You need to stream weapons.meta, here you can change the range of a weapon, it’s damages and a lot more other things.

1 Like

Can you help me fix the weapon damage?

1 Like

I made this two scripts today using the comments above.

fxmanifest.lua (87 Bytes) weapon-dmg.lua (1.5 KB)

7 Likes

What should you do with the manifest file?

It’s a newer version of __resource.lua so you should just put it in the same folder

1 Like