Skip to content

Basics of Creating Weapon

Ghost edited this page Jul 6, 2018 · 2 revisions

Welcome to the CSWM wiki!

Creating Weapon

This will create and return weapons index in weapons array.

new Weapon = CreateWeapon("m82", Sniper, "Parker Hale M82");

Function Parameters:

  • Weapon Model Name
  • Weapon Type
  • Weapon Name

CSWM Module Does Nothing With Weapon Name, But You May Create Weapon Menu Using AMXX, So You Will Need Weapon Name. Weapon Type Can Be Pistol (P228), ShotGun (XM1014), Rifle (AK47), Sniper (AWP).

Editing Weapon Parameters

At first we have to build weapons' deploy

BuildWeaponDeploy(Weapon, 4, 1.0);

Function Parameters:

  • Weapon Index In Weapons Array
  • Deploy Animation Index
  • Deploy Animation Duration

You will need 'Half Life Model Viewer' for animations. Next we have to build weapons' shoot.

BuildWeaponShoot(Weapon, { 1, 2, 1 }, 46.0 / 30, 0.1, 0.9, 0.7);

Function Parameters:

  • Weapon Index
  • Shoot Animation (It's Array With Size of 3)
  • Animation Duration (After This, Weapon Will Be Switched Into Idle Mode)
  • Delay (Time Before Next Shot)
  • Damage (Damage Multiplier For Weapon)
  • Recoil (Recoil Multiplier For Weapon)

Damage & Recoil multipliers are actually multipliers of their original weapons. 🔫

Reload Time! (No Ammo? 🏃‍♂️)

BuildWeaponReload(Weapon, 3, 100.0 / 37);

Function Parameters:

  • Weapon Index
  • Reload Animation
  • Reload Time

I think here everything is easy to understand, so lets continue. 🐑 Next, you have to set weapons attack sound.

BuildWeaponFireSound(Weapon, "weapons/m82-1.wav");

Function Parameters:

  • Weapon Index
  • Sound Name

Make sure sound name is into following directory cstrike/sound/* 🌊 Building weapons' ammunition

BuildWeaponAmmunition(Weapon, 10, WAmmoType_762Nato)

Function Parameters:

  • Weapon Index
  • Weapon Clip Size
  • Weapon Ammo Index

Weapon ammo index ? What is this ? Well, Zombie Mods Extra Items are using its original weapons' ammo type, so that's bad, but using this module you can set your own ammo type on weapon, and you can create a new one too! 👍 There's WAmmoType enum for Original CS Ammos.

Clone this wiki locally