[How-To] Add names to custom weapons

Hi there! Recently i released a tutorial on stream add-on melee weapons (which can be found here)

Today I’ll show you simply how to stream the names for your add-on weapons.

Step 1. Create a new resource folder and make a __resource.lua file

Step 2. Create a LUA file named “client.lua” and reference it in the __resource as so:

Note: the manifest version is not needed

image

Step 3: in client.lua use this script:

Citizen.CreateThread(function()
	AddTextEntry(WT_WEAPONNAME, 'NAME YOU DESIRE')
end)

To get the WT_WEAPONNAME, go to the weapons.meta of the weapon you want to stream the name for and search for HumanNameHash (ex. for the Katana, i put WT_KATANA)

image

You will want to copy what is there, and put it in the client.lua as the WT_WEAPONNAME

Ex. for my katana, this is how i have the code:

Citizen.CreateThread(function()
	AddTextEntry('WT_KATANA', 'Katana bby')
end)

This is how it looks after we load the resource:

Hope this helps out some of you who want to stream addon weapons and want the names. The blank spot bothered me :smile:

Still tweaking out things for add-on guns, but it’s possible!

Thank you for taking the time to read.

EDIT: Don’t need the WeaponIsValid native.

14 Likes

Good tutorial

Thank you! Still a bit new to FiveM server development, but i pick up on things quickly. Small, but hopefully will lead to bigger things.

Thanks m8 this is going to help me alot

Great tutorial! But I could only find the numberic hash for weapons alredy in the game. Could you briefly explain how did you get the “3055806197” hash for “WT_KATANA”? thanks a lot!

That’s a custom weapon, and you have to identify the HumanNameHash in a weapons.meta

Thank you xRxWxTxRxOx, maybe I didn’t explain the question clearly. I understand how you get the “HumanNameHash”, thus ‘WT_KATANA’. But wondering how you get the number “3055806197”. Thanks!

Use Hash generator in OpenIV

1 Like

Thanks for your help, but when I put “WT_KATANA” in the hash generator (case sensitive on) I get 3202994769 instead of 3055806197. Should I use a different hash generator? Thanks.

you don’t put WT_KATANA into hash generator, you put the hash of the weapon name you put in Weapons.Meta; For example to get the hash of a Katana, you would need to insert “WEAPON_KATANA” as shown below.

I’ll correct that in Tutorial, sorry for confusion

1 Like

Thanks xRxExTxRxOx, really appreciate your kind help :slight_smile:

1 Like

When you say, “Go to the weapons.meta of the weapon you want to stream the name for” what do you mean? Neither the Specialcarbine has a specific weapons.meta for it nor the SCAR-H I’m trying to stream. That part of the tutorial is super confusing for me.

EDIT: After a lot of searching I figured it out however when I run it, I get errors.

Citizen.CreateThread(function()
	if IsWeaponValid(3231910285) then
		AddTextEntry(WT_SPCARBINE, 'SCAR-H')
	end
end)```

You didn’t put the WT_SPCARBINE in quotes. That’s shown in the example I gave for the tutorial. Also I can’t list every single meta that weapons have, though all DLC weapons do have their own META’s, so to find these, you will have to look at the DLC packs in OPENIV, specific path is update/x64/dlcpacks/

Pretty sure for special carbine it’s something like weapon_specialcarbine.meta

1 Like

Yeah I got it all working except the ‘WT_SPCCARBINE’ part because I didnt notice the quotes. Thank you!

Not a problem! :call_me_hand:t2:

1 Like

Worked great now!

1 Like

Could you help me to stream these?

weaponcomponents.meta
and
weapons_pistol_mk2.meta

Not sure what to list them as in the __resource file.

weapons_pistol_mk2 is a weapons.meta btw

data_file ‘WEAPONINFO_FILE’ ‘weaons_pistol_mk2.meta’
data_file ’ ‘WEAPONCOMPONENTSINFO_FILE’ ‘weaponcomponents.meta’

2 Likes

Okay, I am really new in this world. I dont have good scripting skills but I really wanna know how to just copy paste combat pistol. Like I wanna do it so I can use glock 17 replace folders for it. But what should I do ? How will I find meta files for combat pistol ?

Can this work on combat pistol ? Like I wanna only change combat pistols name ?