Thread Status:
Not open for further replies.
Jun 17, 2012

Help by thiefb0ss at 8:04 PM (287 Views / 0 Likes) 2 replies

  1. thiefb0ss
    OP

    Member thiefb0ss GBAtemp Regular

    Joined:
    Feb 26, 2012
    Messages:
    158
    Location:
    Moscow
    Country:
    Russia
    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 = "vendetta7333@gmail.com"
    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 SWEP:PrimaryAttack()
    self:throw_attack("models/players/sniper.mdl")
    end
    function SWEP:SecondaryAttack()
    self:throw_attack("models/players/sniper.mdl")
    end
     
  2. thiefb0ss
    OP

    Member thiefb0ss GBAtemp Regular

    Joined:
    Feb 26, 2012
    Messages:
    158
    Location:
    Moscow
    Country:
    Russia
    Nevermind fixed.
     
  3. TwinRetro

    Global Moderator TwinRetro Don't start nothin', Won't be nothin'

    Joined:
    Aug 29, 2008
    Messages:
    6,181
    Location:
    Las Vegas, NV
    Country:
    United States
    Problem solved. closed.
     
Thread Status:
Not open for further replies.

Share This Page