Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. AddCSLuaFile()
  2. SWEP.Author = "Gladiateur45"
  3. SWEP.Contact = "https://www.uraniumcommunity.com/index.php"
  4. SWEP.Purpose = "Arme pour SCP 049"
  5. SWEP.Instructions = "Click Gauche pour transformer quelqu'un en Instance"
  6. SWEP.Category = "SCP Uranium"
  7. SWEP.Spawnable = true
  8. SWEP.AdminSpawnable = true
  9. SWEP.ViewModel = "models/weapons/v_stunbaton.mdl"
  10. SWEP.WorldModel = "models/weapons/w_stunbaton.mdl"
  11.  
  12. SWEP.PrintName = "SCP 049 Uranium Community."
  13. SWEP.Slot = 3
  14. SWEP.SlotPos = 1
  15. SWEP.DrawAmmo = false
  16. SWEP.DrawCrosshair = true
  17.  
  18. SWEP.Primary.ClipSize = -1
  19. SWEP.Primary.DefaultClip = -1
  20. SWEP.Primary.Automatic = false
  21. SWEP.Primary.Ammo = "none"
  22.  
  23. SWEP.Secondary.ClipSize = -1
  24. SWEP.Secondary.DefaultClip = -1
  25. SWEP.Secondary.Automatic = false
  26. SWEP.Secondary.Ammo = "none"
  27.  
  28. SWEP.SwingSound = "Weapon_Crowbar.Single"
  29. SWEP.HitSound = "weapons/stunstick/stunstick_fleshhit1.wav"
  30. SWEP.HoldType = "normal"
  31. SWEP.AllowDrop = true
  32. SWEP.Kind = WEAPON_MELEE
  33.  
  34. SWEP.Delay = 1
  35. SWEP.Range = 100
  36. SWEP.Damage = 0
  37. SWEP.RemoveCan = true
  38. SWEP.MTFModel = "models/player/undead/undead.mdl"
  39. SWEP.InfectedModel = "models/player/undead/undead.mdl"
  40. SWEP.infectedTime = 300
  41. SWEP.cooldown = 3*60
  42. SWEP.currentInfectionCount = 0
  43.  
  44. function SWEP:infectPlayer(ent)
  45. local ply = self.Owner
  46. if ent:IsPlayer() and ent != ply and not ent.IsInfected then
  47. ent.EntModel = ent:GetModel()
  48. ent.IsInfected = true
  49. end
  50. if SERVER then
  51. ent:SetModel(self.InfectedModel)
  52. else
  53. ent:SetModel(self.InfectedModel)
  54. util.AddNetworkString("049_sendinfected_effects")
  55. util.AddNetworkString("049_cancelall")
  56. net.Start("049_sendinfected_effects")
  57. net.WriteString(tostring(self.infectedTime))
  58. net.Send(ent)
  59. ent:StripWeapons()
  60. ent:Give("weapon_sillyzombieclaw_v2")
  61. hook.Add("PlayerDeath", "Revert_To_Model", function(pl)
  62. if pl == ent and ent.IsInfected then
  63. ent:SetModel(ent.EntModel)
  64. net.Start("049_cancelall")
  65. net.Send(pl)
  66. ent.IsInfected = false
  67. end
  68. end)
  69. end
  70. end
  71. end
  72.  
  73. function SWEP:PrimaryAttack()
  74. local ply = self.Owner
  75. local tr = util.TraceHull {
  76. start = ply:GetShootPos(),
  77. endpos = ply:GetShootPos() + ply:GetAimVector() * 1500,
  78. filter = ply,
  79. mins = Vector(-10, -10, -10),
  80. maxs = Vector(10, 10, 10)
  81. }
  82. if not tr.Entity then return end
  83. local ent = tr.Entity
  84. if not IsValid(ply) then return end
  85. ply:SetAnimation(PLAYER_ATTACK1)
  86. if tr.StartPos:Distance(tr.HitPos) < 100 then
  87. self:EmitSound(self.HitSound)
  88. else
  89. self:EmitSound(self.SwingSound)
  90. end
  91.  
  92. local vm = self:GetOwner():GetViewModel()
  93. if not IsValid(vm) then return end
  94. vm:SendViewModelMatchingSequence(vm:LookupSequence("attackch"))
  95. vm:SetPlaybackRate(1 + 1/3)
  96. local duration = vm:SequenceDuration() / vm:GetPlaybackRate()
  97. local time = CurTime() + duration
  98. self:SetNextPrimaryFire(time)
  99.  
  100. if ent:IsPlayer() and ent:Alive() then
  101. if ply:GetPos():Distance(ent:GetPos()) <= 100 then
  102. if ent.IsInfected != true then
  103. self:infectPlayer(ent)
  104. end
  105. end
  106. end
  107. end
  108.  
  109. function SWEP:SecondaryAttack()
  110. if self.RemoveCan == true then
  111. self.RemoveCan = false
  112. timer.Simple(2, function() self.RemoveCan = true end)
  113. end
  114. end
  115.  
  116. function SWEP:Reload()
  117. if self.RemoveCan == true then
  118. self.RemoveCan = false
  119. timer.Simple(2, function() self.RemoveCan = true end)
  120. end
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement