//Contact and SpawnSettings.. blabla
SWEP.Author = "Flo / Peacemaker"
SWEP.Contact = "Garrysmod.de - User peacemaker"
SWEP.Instructions = "Rightclick to Spawn a Can / Leftclick To Spawn and Wekd a Can to a Prop"
SWEP.Spawnable = "True"
SWEP.AdminSpawnable = "True"
local Can_Trail = CreateClientConVar("Can_Trail",10,true,true)
local myint = Can_Trail:GetInt()
function GetClientInfo( property )
local mode = self:GetMode()
return self:GetOwner():GetInfo("Can_Trail")
end
//Model Setting or somethin'
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
// Primary Settings. Like Garrys-Manhack gun.
SWEP.Primary.Clipsize = "-1"
SWEP.Primary.DefaultClip= "-1"
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
// Secondary. Like Garrys-Manhack gun.
SWEP.Secondary.Clipsize = "-1"
SWEP.Secondary.DefaultClip= "-1"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
//Primary Attack
function SWEP:PrimaryAttack(tr)
local tr = self.Owner:GetEyeTrace()
if (!SERVER) then return end
Msg (myint)
//Spawn the Can. Yay
local ent = ents.Create ("prop_physics")
ent:SetModel ("models/props_junk/PopCan01a.mdl")
ent:SetPos( tr.HitPos + self.Owner:GetAimVector() * -3 )
ent:SetAngles( tr.HitNormal:Angle() )
ent:Spawn()
//Weld the Can. Yay Again!
local weld = constraint.Weld( tr.Entity, ent, tr.PhysicsBone, 0, 0 )
// Let's Undo It. Again the 3rd. Time
undo.Create( "OMFG CAN!" )
undo.AddEntity( weld )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
if (myint == 1) then
local trail = util.SpriteTrail(ent, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, "trails/plasma.vmt")
else
return false
end
end
function SWEP:SecondaryAttack()
local tr = self.Owner:GetEyeTrace()
if (!SERVER) then return end
//Spawn the Can. Yay
local ent = ents.Create ("prop_physics")
ent:SetModel ("models/props_junk/PopCan01a.mdl")
ent:SetPos( tr.HitPos + self.Owner:GetAimVector() * -3 )
ent:SetAngles( tr.HitNormal:Angle() )
ent:Spawn()
// Let's Undo It. Again the 3rd. Time
undo.Create( "OMFG CAN!" )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
//Kill other Keys. OBEY
function SWEP:Think()
end
function SWEP:Reload()
end