View difference between Paste ID: YNiRHfEK and 5AM5TVSy
SHOW: | | - or go back to the newest paste.
1
/* I copied the skeleton of this from the flechette gun, and changed it to set the owner on fire. Simple. Whiterabbit */
2
3
/*
4
5
	http://steamcommunity.com/sharedfiles/filedetails/?id=174382408
6-
	http://steamcommunity.com/sharedfiles/filedetails/?id=1
6+
7
*/
8
9
AddCSLuaFile()
10
11
SWEP.Author			= "Whiterabbit"
12
SWEP.Instructions	= "Ignites yourself"
13
14
SWEP.Spawnable			= true
15
SWEP.AdminOnly			= false
16
SWEP.UseHands			= true
17
18
SWEP.ViewModel			= "models/weapons/c_smg1.mdl"
19
SWEP.WorldModel			= "models/weapons/w_smg1.mdl"
20
21
SWEP.Primary.ClipSize		= -1
22
SWEP.Primary.DefaultClip	= -1
23
SWEP.Primary.Automatic		= true
24
SWEP.Primary.Ammo			= "none"
25
26
SWEP.Secondary.ClipSize		= -1
27
SWEP.Secondary.DefaultClip	= -1
28
SWEP.Secondary.Automatic	= false
29
SWEP.Secondary.Ammo			= "none"
30
31
SWEP.AutoSwitchTo		= false
32
SWEP.AutoSwitchFrom		= false
33
34
SWEP.PrintName			= "Backfire Gun"
35
SWEP.Category 			= "Whiterabbit Server Weapons"
36
SWEP.Slot				= 1
37
SWEP.SlotPos			= 2
38
SWEP.DrawAmmo			= false
39
40
local ShootSound = Sound( "garrysmod/balloon_pop_cute.wav" )
41
42
/*---------------------------------------------------------
43
	Reload does nothing
44
---------------------------------------------------------*/
45
function SWEP:Reload()
46
end
47
48
/*---------------------------------------------------------
49
   Think does nothing
50
---------------------------------------------------------*/
51
function SWEP:Think()
52
end
53
54
55
/*---------------------------------------------------------
56
	PrimaryAttack
57
---------------------------------------------------------*/
58
function SWEP:PrimaryAttack()
59
60
	self:SetNextPrimaryFire( CurTime() + 0.2175 )
61
62
	self:EmitSound( ShootSound ) --shooting sound
63
	self:ShootEffects( self ) --eject a bullet cartridge / muzzle flash
64
	
65
	-- The rest is only done on the server
66
	if (!SERVER) then return end
67
	
68
	if not IsValid(self.Owner) then return end --no owner to ignite?
69
	
70
	self.Owner:Ignite(3, 0) --ignite the weapon holder
71
72
end
73
74
/*---------------------------------------------------------
75
	SecondaryAttack
76
---------------------------------------------------------*/
77
function SWEP:SecondaryAttack()
78
	if CLIENT then return end --only need to run this serverside
79
	if not IsValid(self.Owner) then return end --no owner to extinguish?
80
	self.Owner:Extinguish() --extinguish the owner
81
end
82
83
84
/*---------------------------------------------------------
85
   Name: ShouldDropOnDie
86
   Desc: Should this weapon be dropped when its owner dies?
87
---------------------------------------------------------*/
88
function SWEP:ShouldDropOnDie()
89
	return false
90
end