Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1.  
  2. if ( SERVER ) then
  3.  
  4. AddCSLuaFile( "shared.lua" )
  5.  
  6. SWEP.HoldType = "pistol"
  7.  
  8. end
  9.  
  10. if ( CLIENT ) then
  11.  
  12. SWEP.PrintName = "RP Base"
  13. SWEP.Author = "Fixed by FuriousJack95"
  14.  
  15. SWEP.Slot = 3
  16. SWEP.SlotPos = 1
  17. SWEP.IconLetter = "f"
  18. end
  19.  
  20. SWEP.Base = "weapon_cs_base"
  21. SWEP.Category = "Counter-Strike"
  22.  
  23. SWEP.Spawnable = false
  24. SWEP.AdminSpawnable = false
  25.  
  26. function SWEP:Initialize()
  27. self:SetWeaponHoldType( self.HoldType );
  28. end
  29.  
  30. function SWEP:Holster()
  31. self.Weapon:SetClip1(self.Weapon:Clip1() + 1);
  32. return true
  33. end
  34.  
  35. function SWEP:Deploy()
  36. self.Weapon:SetClip1(self.Weapon:Clip1() - 1);
  37. return true
  38. end
  39.  
  40. function SWEP:Equip()
  41. self.Weapon:SetClip1(self.Weapon:Clip1() + 1);
  42. return true
  43. end
  44.  
  45. function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
  46. draw.SimpleText( self.IconLetter, "CSSelectIcons", x + wide/2, y + tall*0.2, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
  47. end
  48.  
  49. function SWEP:CSShootBullet ( dmg, recoil, numbul, cone )
  50.  
  51. numbul = numbul or 1
  52. cone = cone or 0.01
  53.  
  54. if SERVER then
  55. local VehHurt = self.Owner:GetEyeTrace();
  56.  
  57. local Vehicle = VehHurt.Entity;
  58. if Vehicle and Vehicle:IsValid() then
  59. if Vehicle:IsVehicle() then
  60. Vehicle:GetTable().CarDamage = Vehicle:GetTable().CarDamage - (dmg * .5);
  61.  
  62. if Vehicle:GetTable().CarDamage <= 0 then
  63. Vehicle:DisableVehicle();
  64. end
  65.  
  66. local Driver = Vehicle:GetDriver();
  67.  
  68. if Driver and Driver:IsValid() and Driver:IsPlayer() then
  69. local NewHealth = Driver:Health() - (dmg * .4);
  70.  
  71. if NewHealth <= 0 then
  72. Driver:Kill();
  73. else
  74. Driver:SetHealth(NewHealth);
  75. Driver:GetTable().OnEnteredHealth = NewHealth;
  76. end
  77. end
  78. end
  79. end
  80. else
  81. local VehHurt = self.Owner:GetEyeTrace();
  82.  
  83. for k, v in pairs(player.GetAll()) do
  84. if !v:Alive() then
  85. for _, ent in pairs(ents.FindInSphere(VehHurt.HitPos, 1)) do
  86. if ent == v:GetRagdollEntity() then
  87. RunConsoleCommand('perp_fpo', v:UniqueID());
  88. end
  89. end
  90. end
  91. end
  92. end
  93.  
  94. local bullet = {}
  95. bullet.Num = numbul
  96. bullet.Src = self.Owner:GetShootPos() // Source
  97. bullet.Dir = self.Owner:GetAimVector() // Dir of bullet
  98. bullet.Spread = Vector( cone, cone, 0 ) // Aim Cone
  99. bullet.Tracer = 4 // Show a tracer on every x bullets
  100. bullet.Force = 5 // Amount of force to give to phys objects
  101. bullet.Damage = dmg
  102.  
  103. self.Owner:FireBullets( bullet )
  104. self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) // View model animation
  105. self.Owner:MuzzleFlash() // Crappy muzzle light
  106. self.Owner:SetAnimation( PLAYER_ATTACK1 ) // 3rd Person Animation
  107.  
  108. if ( self.Owner:IsNPC() ) then return end
  109.  
  110. // CUSTOM RECOIL !
  111. if ( (SinglePlayer() && SERVER) || ( !SinglePlayer() && CLIENT && IsFirstTimePredicted() ) ) then
  112.  
  113. local eyeang = self.Owner:EyeAngles()
  114. eyeang.pitch = eyeang.pitch - recoil
  115. self.Owner:SetEyeAngles( eyeang )
  116.  
  117. end
  118.  
  119. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement