How to add custom weapons to your server?!

Started by Sebastian, May 19, 2021, 06:28 AM

Previous topic - Next topic


1st step: Install "7-zip" program, because you will need to archive the needed files into a .7z archive.
(you can download the program from the link in description)
2nd step: Find (or create) the weapon you want to import in your server.
(I will give you a "sniper" as example, converted by Silent Viper from Max Payne 2)
3rd step: Make sure you have all needed files from this list:

Describes the weapon and its settings, like in weapon.dat. logicalid is the same as the <weapon> specified in the filename.
weaponname_icon.png (optional, but you better add it)
The icon for the weapon that will be used in-game. If not specified, a blank icon is used.
animgroup.ifp (optional)
The animation group file used for the weapon. If not given, the client will use the default animation group provided by Vice City.
weaponname.dff (optional, but you better add it)
The model for the weapon. If not given, the client will use the same model as the logical weapon ID.
weaponname.txd (optional, but you better add it)
The texture for the weapon. If not given, the client will use default textures for the logical weapon ID.
stretch_scope.png (optional)
For sniper rifles and RPGs; the texture used for the scope when zoomed in. If not given, the client will use default scopes.
gunshot.wav (optional)
The sound effect that should be played when you fire.

4th step: Open "7-zip" program, and create the ".7z" archive, but we need to think a bit about it's name.

The name should have this format:

<id> - starting from 100 and increasing with each weapon you add; the ID used by the weapon in-game.
<slot> - the weapon slot the weapon uses, with 0 being fist, 1 being melee, etc.
<weapon> - the ID of the weapon your custom weapon behaves like; putting 6 in here will make your weapon behave like a baseball bat.
name - the name of the weapon.

If <weapon> is 81, it will act as a hat, and the player will use fists for melee.

We will use this name:   w100_s8_l28_sniper.7z
100 - because it is the first weapon in my example server.
8 - because it is part of sniper&laser class.
28 - because it is the id of the default sniper of Vice City
sniper - because it is the name of the custom weapon

5th step: Since the archive is done, you can move it to ".../server/store/weapons/"
6th step: Open your server, spawn the weapon with ID 100, and have fun testing it ! :D

That's all, I hope you will success ! Good luck ! ;)
Credits: Seby (me) & Stormeus (for written tutorial in forum)


@vito shared this in discord, for calculating weapon flags.

Don't forget that, when applying in vcmp, you must add "0x" before the flags, as it must be in hex.
Quote from: stormeus vl8 rel000SetWeaponDataValue(33, 25, 0x020040); // FieldFlags