SWEP help.

How do you make it so when a guy shoots a guy, it ignites him for 2 seconds?

If you want someone to code for you go to coderhire. Otherwise I suggest looking at ttt’s flare gun code.

I asked for help, This is the dev section, Dont start a flame, pls. I’m not going on coderhire to pay someone 50 dollars just to write 3 simple lines, when i can ask on a free website.

Entity:Ignite( time )

How exactly would i implement this?

In the PrimaryAttack of the SWEP you would ignite its Owner.


EDIT: For the lulz I decided to actually make this (save it lua/weapons/wt_backfiregun.lua)

/* I copied the skeleton of this from the flechette gun, and changed it to set the owner on fire. Simple. Whiterabbit */

SWEP.Author                     = "Whiterabbit"
SWEP.Instructions       = "Ignites yourself"
SWEP.Spawnable                  = true
SWEP.AdminOnly                  = false
SWEP.UseHands                   = true
SWEP.ViewModel                  = "models/weapons/c_smg1.mdl"
SWEP.WorldModel                 = "models/weapons/w_smg1.mdl"
SWEP.Primary.ClipSize           = -1
SWEP.Primary.DefaultClip        = -1
SWEP.Primary.Automatic          = true
SWEP.Primary.Ammo                       = "none"
SWEP.Secondary.ClipSize         = -1
SWEP.Secondary.DefaultClip      = -1
SWEP.Secondary.Automatic        = false
SWEP.Secondary.Ammo                     = "none"
SWEP.AutoSwitchTo               = false
SWEP.AutoSwitchFrom             = false
SWEP.PrintName                  = "Backfire Gun"
SWEP.Category                   = "Whiterabbit Server Weapons"
SWEP.Slot                               = 1
SWEP.SlotPos                    = 2
SWEP.DrawAmmo                   = false
local ShootSound = Sound( "garrysmod/balloon_pop_cute.wav" )
        Reload does nothing
function SWEP:Reload()
   Think does nothing
function SWEP:Think()
function SWEP:PrimaryAttack()
        self:SetNextPrimaryFire( CurTime() + 0.2175 )
        self:EmitSound( ShootSound ) --shooting sound
        self:ShootEffects( self ) --eject a bullet cartridge / muzzle flash
        -- The rest is only done on the server
        if (!SERVER) then return end
        if not IsValid(self.Owner) then return end --no owner to ignite?
        self.Owner:Ignite(3, 0) --ignite the weapon holder
function SWEP:SecondaryAttack()
        if CLIENT then return end --only need to run this serverside
        if not IsValid(self.Owner) then return end --no owner to extinguish?
        self.Owner:Extinguish() --extinguish the owner
   Name: ShouldDropOnDie
   Desc: Should this weapon be dropped when its owner dies?
function SWEP:ShouldDropOnDie()
        return false


PlayerHurt hook?

Lol I just re-read the OP and don’t know why I thought you wanted it to ignite the owner. Did you?

If you wanted it to ignite the person that GOT shot, in the PrimaryAttack of the SWEP you can perform a trace and if it hits a player (and they are within range), ignite them as shown above.

Ugh, i still dont know how to implement this, lmao.