Spoiler ![>](img/i_plus.png)
To create a weapon. You need use hooks to this.
uses the hooks:
attack
attack2
reload
equip
Need Create!
![•](img/dot.gif)
Create a weapon called "WEAPON" and this weapon do nothing.
cloneweaponb [wpnID] [SLOT]
Will set the name of weapon.
![•](img/dot.gif)
Set Weapon Name to [Name]
setweaponname [wpnID] [Name\$]
![•](img/dot.gif)
Set Weapon Inventory Sprite to [imgpath]
setinvwpnsprite [wpnID] [imgpath]
![•](img/dot.gif)
Set Holding Weapon Sprite to [imgpath]
setholwpnsprite [wpnID] [imgpath]
![•](img/dot.gif)
Set the Max Reserve Ammo to [maxreserve\num]
setwpnlimreser [wpnID] [maxreserve\num]
![•](img/dot.gif)
Set the Max Ammo to [maxammo\num]
setwpnlimammo [wpnID] [maxammo\num]
The game cannot remove the weapons. Then to get the weapon.
You need use in console:
equip plyID
100 + wpnID
e.g:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
----------Console:------------
cloneweaponb 50 9 -- Will create the weapon at id 150 in inventory slot 9.
setweaponname 150 "Glitch Shotgun"
setinvwpnsprite 150 "gfx/weapons/ak47.bmp<b>"
setholwpnsprite 150 "gfx/weapons/ak47_d.bmp<b>"
setwpnlimreser 150 90
setwpnlimammo 150 30
----------Some lua hooks----
addhook("attack","glitchshotgun_primary")
function glitchshotgun_primary(plyID)
	_x = player(plyID,"x")
	_y = player(plyID,"y")
	_rot = player(plyID,"rot")
	if player(plyID,"weapontype") == 150 then
		parse("spawnprojectile "..plyID.." 1 ".._x.." ".._y.." 9000 ".._rot)
	end
end