Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile (shared.lua)
- SWEP.Weight = 6
- SWEP.AutoSwitchTo = false
- SWEP.AutoSwitchFrom = false
- elseif CLIENT then
- SWEP.PrintName = "Chair throwing gun"
- SWEP.slot = 4
- SWEP.SlotPos = 1
- SWEP.DrawAmmo = false
- SWEP.DrawCrosshair = false
- language.Add("Undone_Thrown_SWEP_Entity","Undone Thrown SWEP Entinty")
- end
- SWEP.Author = "LGS Madara Uchiha"
- SWEP.Contact = "noneya"
- SWEP.Purpose = "Throws chairs what else did you expect?"
- SWEP.Instructions = "Do you really need to know? Just shoot"
- SWEP.Category = "Category"
- SWEP.ViewModel = "models/weapons/v_RPG.mdl"
- SWEP.WorldModel = "models/weapons/w_rocket_launcher.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 = true
- SWEP.Secondary.Ammo = "none"
- local ShootSound = Sound("Metal.SawbladeStick")
- 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:SetAngles(self.Owner:EyeAngles())
- ent:Spawn()
- local phys = ent:GetPhysicsObject ()
- if !(phys && IsValid(phys)) then ent:Remove() return end
- phys:ApplyForceCenter(self.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/props/cs_office/Chair_office.mdl")
- end
- function SWEP:SecondaryAttack()
- self:throw_attack("models/props_c17/FurnitureChair001a.mdl")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement