Shopping Cart
FiveM script 11abac85b780a6bfb422bb414511bacab31e72a7

[How to] Handle weapons (ex: Change snowball damage) – Modding Tutorials

FiveM Modding Tutorial

Hello !
I’m sharing today a way to modify any weapons and make them do whatever you want.

For this example we are going to handle the weaponsnowball.meta :

  • I want the snowball to do only 1 damage, default is 25 and be able to have up to 100 snowballs on me so i can use : GIVE_WEAPON_TO_PED(Ped ped, “WEAPON_SNOWBALL”, int ammoCount, BOOL isHidden, BOOL equipNow); and set the ammoCount up to 100.
  1. I open my best friend OpenIV and search for weaponsnowball.meta (change snowball by any other weapon, if you can’t find it, look for the default weapons.meta that contains some weapons) and copy it somewhere.

  2. Open the copy and edit whatever you want inside,

  • in this example i’m looking for damage, there is this :slight_smile: so i’ll edit it to 1.0, so we keep the ragdoll when doing headshot but damage is reduced to 1.
  • Now i need to change the max ammo, here we go :
<AmmoMax value="10" />
<AmmoMax50 value="10" />
<AmmoMax100 value="10" />
<AmmoMaxMP value="10" />
<AmmoMax50MP value="10" />
<AmmoMax100MP value="10" />

There is tons of other informations that you can change, but i’m not interested in this example i changed whatever i needed.

  1. Now we need to add it on the server, this is very simple, you need to create new resource or use an other one, so i’ll create folder called for example : mycustomweapons, inside of this folder you will place the weaponsnowball.meta and your resource.lua.

  2. Important, we now have to write the resource.lua :

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' 

files 
{
	'weaponsnowball.meta',
}

data_file 'WEAPONINFO_FILE_PATCH' 'weaponsnowball.meta'

Don’t forget to check what’s the latest “resource_manifest_version ” so you are up to date !

  1. You are good to go, start your resource, you can edit this at runtime and have fun changing any properties.

Here is the example on the work : https://streamable.com/o1fp9

And here is the download/view : Github Link

Don’t hesitate to ask any question, if i can help you create your own idea !



Original source: https://forum.cfx.re/t/how-to-handle-weapons-ex-change-snowball-damage/884697

Leave a Reply

Your email address will not be published. Required fields are marked *

FiveM ESX Scripts

The best scripts and maps

Best support

Problems? We are there to help!

Wide range of products

We have a wide range of products

100% Secure Checkout

Stripe