Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile()
- SWEP.Author = "Gladiateur45"
- SWEP.Contact = "https://www.uraniumcommunity.com/index.php"
- SWEP.Purpose = "Arme pour SCP 049"
- SWEP.Instructions = "Click Gauche pour transformer quelqu'un en Instance"
- SWEP.Category = "SCP Uranium"
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = true
- SWEP.ViewModel = "models/weapons/v_stunbaton.mdl"
- SWEP.WorldModel = "models/weapons/w_stunbaton.mdl"
- SWEP.PrintName = "SCP 049 Uranium Community."
- SWEP.Slot = 3
- SWEP.SlotPos = 1
- SWEP.DrawAmmo = false
- SWEP.DrawCrosshair = true
- 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"
- SWEP.SwingSound = "Weapon_Crowbar.Single"
- SWEP.HitSound = "weapons/stunstick/stunstick_fleshhit1.wav"
- SWEP.HoldType = "normal"
- SWEP.AllowDrop = true
- SWEP.Kind = WEAPON_MELEE
- SWEP.Delay = 1
- SWEP.Range = 100
- SWEP.Damage = 0
- SWEP.RemoveCan = true
- SWEP.MTFModel = "models/player/undead/undead.mdl"
- SWEP.InfectedModel = "models/player/undead/undead.mdl"
- SWEP.infectedTime = 300
- SWEP.cooldown = 3*60
- SWEP.currentInfectionCount = 0
- function SWEP:infectPlayer(ent)
- local ply = self.Owner
- if ent:IsPlayer() and ent != ply and not ent.IsInfected then
- ent.EntModel = ent:GetModel()
- ent.IsInfected = true
- end
- if SERVER then
- ent:SetModel(self.InfectedModel)
- else
- ent:SetModel(self.InfectedModel)
- util.AddNetworkString("049_sendinfected_effects")
- util.AddNetworkString("049_cancelall")
- net.Start("049_sendinfected_effects")
- net.WriteString(tostring(self.infectedTime))
- net.Send(ent)
- ent:StripWeapons()
- ent:Give("weapon_sillyzombieclaw_v2")
- hook.Add("PlayerDeath", "Revert_To_Model", function(pl)
- if pl == ent and ent.IsInfected then
- ent:SetModel(ent.EntModel)
- net.Start("049_cancelall")
- net.Send(pl)
- ent.IsInfected = false
- end
- end)
- end
- end
- end
- function SWEP:PrimaryAttack()
- local ply = self.Owner
- local tr = util.TraceHull {
- start = ply:GetShootPos(),
- endpos = ply:GetShootPos() + ply:GetAimVector() * 1500,
- filter = ply,
- mins = Vector(-10, -10, -10),
- maxs = Vector(10, 10, 10)
- }
- if not tr.Entity then return end
- local ent = tr.Entity
- if not IsValid(ply) then return end
- ply:SetAnimation(PLAYER_ATTACK1)
- if tr.StartPos:Distance(tr.HitPos) < 100 then
- self:EmitSound(self.HitSound)
- else
- self:EmitSound(self.SwingSound)
- end
- local vm = self:GetOwner():GetViewModel()
- if not IsValid(vm) then return end
- vm:SendViewModelMatchingSequence(vm:LookupSequence("attackch"))
- vm:SetPlaybackRate(1 + 1/3)
- local duration = vm:SequenceDuration() / vm:GetPlaybackRate()
- local time = CurTime() + duration
- self:SetNextPrimaryFire(time)
- if ent:IsPlayer() and ent:Alive() then
- if ply:GetPos():Distance(ent:GetPos()) <= 100 then
- if ent.IsInfected != true then
- self:infectPlayer(ent)
- end
- end
- end
- end
- function SWEP:SecondaryAttack()
- if self.RemoveCan == true then
- self.RemoveCan = false
- timer.Simple(2, function() self.RemoveCan = true end)
- end
- end
- function SWEP:Reload()
- if self.RemoveCan == true then
- self.RemoveCan = false
- timer.Simple(2, function() self.RemoveCan = true end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement