0 Members and 3 Guests are viewing this topic.
local EVENT = {}if SERVER then function EVENT:Prepare() self:EventNotification() self:SmallNotification(_, { "Juggernauts Have alot of health but only crowbars", "Innocents know who Juggernuts are and must kill them", "Innocents spawn with a HUGE with 1000 bullets", }, 15) end function EVENT:GiveKnife(ply) local wep = ply:Give("weapon_zm_improvised") wep.AllowDrop = false wep.OnDrop = function(self) -- Remove H.U.G.E on drop self:Remove() end wep.SecondaryAttack = function() end self:ModWepToPushVisOnAtck(wep) timer.Simple(0.1, function() if not IsValid(ply) then return end ply:SelectWeapon("weapon_zm_improvised") -- meh end) end local allowed_weapons = { "weapon_zm_carry", "weapon_zm_improvised" } function EVENT:Begin() for _,ply in pairs(player.GetAll()) do ply:Flashlight( false ) if ply:GetRole() == ROLE_TRAITOR then ply:SetHealth(500) ply:SetColor(Color(0, 0, 255)) ply:StripWeapons() if ply:GetRole() == ROLE_INNOCENT then for _,aw in pairs(allowed_weapons) do if aw ~= "weapon_zm_sledge" then -- Handled in self.GiveKnife local wep = ply:Give(aw) if IsValid(wep) then self:ModWepToPushVisOnAtck(wep) end end end end end function DrawJuggernutIndicator(ply) local zOffset = 50 local x = ply:GetPos().x //Get the X position of our player local y = ply:GetPos().y //Get the Y position of our player local z = ply:GetPos().z //Get the Z position of our player local pos = Vector(x,y,z+zOffset) //Add our offset onto the Vector local pos2d = pos:ToScreen() //Change the 3D vector to a 2D one draw.DrawText("Juggernut","Default",pos2d.x,pos2d.y,Color(255,255,255,255),TEXT_ALIGN_CENTER) //Draw the indicator end function LoopThroughPlayers() for k,v in(player.GetAll()) do //Loop through all the players if ply:GetRole() == ROLE_TRAITOR then //Check if they're a Traitor DrawJuggernutIndicator(v) //Call our draw "Juggernut" func end end end hook.Add("HUDPaint", "LoopThroughPlayers", LoopThroughPlayers) //Add our function to the HUDPaint hook self:AddHook("WyoziTEVPlayerSpeed", self.ModifyStalkersSpeed) self:AddHook("PlayerSwitchWeapon", self.PreventStalkerWepSwitch) self:AddHook("Think") self:AddHook("EntityTakeDamage") self:AddHook("KeyPress") end function EVENT:End() self:CleanUpHooks() for _,ply in pairs(player.GetAll()) do ply.PushPlayerVis = nil self:SetPlayerInvisibility(ply, false) ply:SetColor(Color(255, 255, 255)) end end function EVENT:ModifyStalkersSpeed(ply) return ply:GetRole() == ROLE_TRAITOR and 1.45 or 1 end function EVENT:PreventStalkerWepSwitch(ply, oldwep, newwep) if ply:GetRole() == ROLE_TRAITOR and not table.HasValue(allowed_weapons, newwep:GetClass()) then timer.Simple(0, function() if not IsValid(ply) then return end ply:SelectWeapon("weapon_zm_improvised") end) end end -- Longjump stuff function EVENT:KeyPress(ply, key) if (ply:Alive() && key == IN_JUMP && ply:WaterLevel() <= 1 && ply:IsOnGround()) then if (ply:GetRole() == ROLE_TRAITOR and ply:KeyDown(IN_DUCK) && ply:KeyDown(IN_FORWARD) && ply:GetVelocity():Length() >= 200) then ply:SetVelocity((ply:GetUp() * 300) + (ply:GetForward() * 425)) end end end function EVENT:Think() for _,ply in pairs(player.GetAll()) do if ply:GetRole() == ROLE_TRAITOR and not ply:HasWeapon("weapon_zm_improvised") then self:GiveKnife(ply) end end end function EVENT:EntityTakeDamage(targ, dmginfo) if (targ:IsPlayer() and targ:GetRole() == ROLE_TRAITOR ) then if (dmginfo:IsDamageType(DMG_FALL)) then dmginfo:ScaleDamage(0.3) else end end endendif CLIENT then local wtev_halos = CreateConVar("wyozitev_stalker_halos", "0", FCVAR_ARCHIVE) function EVENT:Begin() self:AddHook("PreDrawHalos", self.DrawStalkerWH) end function EVENT:DrawStalkerWH() if not wtev_halos:GetBool() then return end local me = LocalPlayer() if me:IsActiveTraitor() then local reds = {} local greens = {} for _,ply in pairs( player.GetAll() ) do if not ply:IsTerror() or not ply:Alive() then continue end if ply:IsActiveTraitor() then table.insert(reds, ply) else table.insert(greens, ply) end end effects.halo.Add( reds, COLOR_RED, _, _, _, true, true ) effects.halo.Add( greens, COLOR_GREEN, _, _, _, true, true ) end endendEVENT.RequireClientside = truewyozitev.RegisterEvent("juggernut", EVENT)