- Joined
- Feb 26, 2012
- Messages
- 158
- Trophies
- 0
- Location
- Moscow
- Website
- thiefboss.blogspot.com
- XP
- 29
- Country
So I made a Garry's Mod addon, no new textures or anything, but I ran into one problem. I don't know how to install it. I know how to install mods, but I don't know how to set up the directory or where to put the mod. Can anyone who knows about GMOD modding help me?
Code:
if SERVER then
AddCSLuaFile
SWEP.Weight = 15
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true
elseif CLIENT then
SWEP.PrintName = "Sniper Rifle"
SWEP.Slot = 4
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
language.Add("Undone_Thrown_SWEP_Entity","Undone Thrown SWEP Entity")
end
SWEP.Author = "Vendetta"
SWEP.Contact = "[email protected]"
SWEP.Purpose = "It's a Sniper Rifle"
SWEP.Instructions = "1. Equip 2. Click"
SWEP.Category = "Other"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_crossbow.mdl"
SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
local ShootSound = Sound("Weapon_357.Spin")
function SWEP:Reload()
end
function SWEP.Think()
end
function SWEP:throw_attack (model_file)
local tr = self.Owner:GetEyeTrace()
self:EmitSound(ShootSound)
self.BaseClass.ShootEffects(self)
if(!SERVER) then return end
local ent = ents.Create("prop_physics")
ent:SetModel(model_file)
ent:SetPos(self.Owner:EyePos() +(self.Owner:GetAimVector() *16))
ent:Spawn()
local phys = ent:GetPhysicsObject()
if(!phys && IsValid(phys)) then ent:Remove() return end
phys:ApplyForceCenter(slef.Owner:GetAimVector():GetNormalized() * math.pow(tr.HitPos:Length(), 3))
cleanup.Add(self.Owner, "props", ent)
undo.Create ("Thrown_SWEP_Entity")
undo.AddEntity (ent)
undo.SetPlayer (self.Owner)
undo.Finish
end
function SWEPrimaryAttack()
self:throw_attack("models/players/sniper.mdl")
end
function SWEP:SecondaryAttack()
self:throw_attack("models/players/sniper.mdl")
end
Code:
if SERVER then
AddCSLuaFile
SWEP.Weight = 15
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true
elseif CLIENT then
SWEP.PrintName = "Sniper Rifle"
SWEP.Slot = 4
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
language.Add("Undone_Thrown_SWEP_Entity","Undone Thrown SWEP Entity")
end
SWEP.Author = "Vendetta"
SWEP.Contact = "[email protected]"
SWEP.Purpose = "It's a Sniper Rifle"
SWEP.Instructions = "1. Equip 2. Click"
SWEP.Category = "Other"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_crossbow.mdl"
SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
local ShootSound = Sound("Weapon_357.Spin")
function SWEP:Reload()
end
function SWEP.Think()
end
function SWEP:throw_attack (model_file)
local tr = self.Owner:GetEyeTrace()
self:EmitSound(ShootSound)
self.BaseClass.ShootEffects(self)
if(!SERVER) then return end
local ent = ents.Create("prop_physics")
ent:SetModel(model_file)
ent:SetPos(self.Owner:EyePos() +(self.Owner:GetAimVector() *16))
ent:Spawn()
local phys = ent:GetPhysicsObject()
if(!phys && IsValid(phys)) then ent:Remove() return end
phys:ApplyForceCenter(slef.Owner:GetAimVector():GetNormalized() * math.pow(tr.HitPos:Length(), 3))
cleanup.Add(self.Owner, "props", ent)
undo.Create ("Thrown_SWEP_Entity")
undo.AddEntity (ent)
undo.SetPlayer (self.Owner)
undo.Finish
end
function SWEPrimaryAttack()
self:throw_attack("models/players/sniper.mdl")
end
function SWEP:SecondaryAttack()
self:throw_attack("models/players/sniper.mdl")
end