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 )
[url]http://wiki.garrysmod.com/page/Entity/Ignite[/url]
How exactly would i implement this?
[QUOTE=74pantera;42017038]How exactly would i implement this?[/QUOTE]
In the PrimaryAttack of the SWEP you would ignite its Owner.
self.Owner:Ignite(3)
EDIT: For the lulz I decided to actually make this (save it lua/weapons/wt_backfiregun.lua)
[lua]
/* I copied the skeleton of this from the flechette gun, and changed it to set the owner on fire. Simple. Whiterabbit */
/*
[url]http://steamcommunity.com/sharedfiles/filedetails/?id=174382408[/url]
*/
AddCSLuaFile()
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()
end
/*---------------------------------------------------------
Think does nothing
---------------------------------------------------------*/
function SWEP:Think()
end
/*---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------*/
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
end
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
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
end
/*---------------------------------------------------------
Name: ShouldDropOnDie
Desc: Should this weapon be dropped when its owner dies?
---------------------------------------------------------*/
function SWEP:ShouldDropOnDie()
return false
end
[/lua]
PlayerHurt hook?
[QUOTE=wh1t3rabbit;42017988]In the PrimaryAttack of the SWEP you would ignite its Owner.
self.Owner:Ignite(3)[/QUOTE]
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 [URL="http://wiki.garrysmod.com/page/util/GetPlayerTrace"]perform a trace[/URL] 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.
Sorry, you need to Log In to post a reply to this thread.