Guest User

Untitled

a guest
Jul 1st, 2013
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if SERVER then
  2. resource.AddFile("models/weapons/w_357_rusty.mdl")
  3. AddCSLuaFile()
  4. end
  5. SWEP.Author = "RobZ51"
  6. SWEP.Instructions = ""
  7. SWEP.HoldType = "pistol"
  8. SWEP.Slot = 6
  9. SWEP.SlotPos = 3
  10. SWEP.Spawnable = false
  11. SWEP.AdminSpawnable = true
  12. SWEP.Base = "weapon_tttbase"
  13. SWEP.ViewModel = "models/weapons/v_357_rusty.mdl"
  14. SWEP.WorldModel = "models/weapons/w_357.mdl"
  15. SWEP.AmmoEnt = "item_ammo_357_ttt"
  16. SWEP.Primary.Sound = Sound( "weapons/357_fire2.wav" )
  17. SWEP.Primary.Recoil = 20
  18. SWEP.Primary.Damage = 60
  19. SWEP.Primary.NumShots = 1
  20. SWEP.Primary.Cone = 0.05
  21. SWEP.Primary.ClipSize = 6
  22. SWEP.Primary.Delay = 1.2
  23. SWEP.Primary.DefaultClip = 6
  24. SWEP.Primary.Automatic = false
  25. SWEP.Primary.Ammo = "357"
  26. SWEP.SlotPos = 1
  27. SWEP.Secondary.ClipSize = -1
  28. SWEP.Secondary.DefaultClip = -1
  29. SWEP.Secondary.Automatic = false
  30. SWEP.Secondary.Ammo = "none"
  31.  
  32. SWEP.Weight = 5
  33. SWEP.AutoSwitchTo = false
  34. SWEP.AutoSwitchFrom = false
  35.  
  36. SWEP.PrintName = "Rusty .357"
  37. SWEP.DrawAmmo = true
  38. SWEP.DrawCrosshair = true
  39. SWEP.ViewModelFOV = 55
  40. SWEP.ViewModelFlip = false
  41.  
  42. SWEP.NoSights = true
  43. SWEP.Kind = WEAPON_EQUIP
  44. SWEP.CanBuy = {ROLE_TRAITOR}
  45. SWEP.LimitedStock = true
  46. SWEP.Icon = "VGUI/ttt/icon_rusty"
  47.  
  48. /*---------------------------------------------------------
  49. Reload does nothing
  50. ---------------------------------------------------------*/
  51. function SWEP:Reload()
  52. self.Weapon:DefaultReload( ACT_VM_RELOAD )
  53. end
  54.  
  55. /*---------------------------------------------------------
  56. Think does nothing
  57. ---------------------------------------------------------*/
  58. function SWEP:Think()
  59. end
  60.  
  61.  
  62. /*---------------------------------------------------------
  63. PrimaryAttack
  64. ---------------------------------------------------------*/
  65. function SWEP:PrimaryAttack()
  66.  
  67. self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
  68. self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
  69.  
  70. if ( !self:CanPrimaryAttack() ) then return end
  71. self.Weapon:EmitSound( self.Primary.Sound )
  72. // Shoot the bullet
  73. self:ShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone )
  74. self:TakePrimaryAmmo( 1 )
  75.  
  76. self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) )
  77. local explode = math.random(10)
  78. if(explode == 5) then
  79. self.Weapon:EmitSound ( "weapons/c4/c4_explode1.wav",50)
  80. local effectdata = EffectData()
  81. effectdata:SetStart( self:GetPos() ) // not sure if we need a start and origin (endpoint) for this effect, but whatever
  82. effectdata:SetOrigin( self:GetPos() )
  83. effectdata:SetScale( 0.01 )
  84. util.Effect( "HelicopterMegaBomb", effectdata, true, true )
  85. util.BlastDamage( self.Owner, self.Owner, self:GetPos(), 200, 100 )
  86. if SERVER then
  87. self.Owner:StripWeapon(self:GetClass())
  88. end
  89. end
  90.  
  91. end
  92.  
  93. function SWEP:ShootBullet( dmg, recoil, numbul, cone )
  94.  
  95. numbul = numbul or 1
  96. cone = cone or 0.01
  97.  
  98. local bullet = {}
  99. bullet.Num = numbul
  100. bullet.Src = self.Owner:GetShootPos() // Source
  101. bullet.Dir = self.Owner:GetAimVector() // Dir of bullet
  102. bullet.Spread = Vector( cone, cone, 0 ) // Aim Cone
  103. bullet.Tracer = 4 // Show a tracer on every x bullets
  104. bullet.Force = 5 // Amount of force to give to phys objects
  105. bullet.Damage = dmg
  106.  
  107. self.Owner:FireBullets( bullet )
  108. self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) // View model animation
  109. self.Owner:MuzzleFlash() // Crappy muzzle light
  110. self.Owner:SetAnimation( PLAYER_ATTACK1 ) // 3rd Person Animation
  111.  
  112. if ( self.Owner:IsNPC() ) then return end
  113.  
  114. end
  115.  
  116. function SWEP:SecondaryAttack()
  117. end
RAW Paste Data