local CHEATERS = { ["[U:1:1770405241]"] = true, ["[U:1:1704340995]"] = true, ["[U:1:1922018405]"] = true, ["[U:1:1904913778]"] = true, ["[U:1:1062396597]"] = true, ["[U:1:1916202565]"] = true, ["[U:1:1723121518]"] = true, ["[U:1:1877411735]"] = true, ["[U:1:221152966]"] = true, ["[U:1:1883157641]"] = true, ["[U:1:1885514529]"] = true, ["[U:1:1644350202]"] = true, ["[U:1:1841779628]"] = true, ["[U:1:349826851]"] = true, ["[U:1:386700108]"] = true, ["[U:1:97203339]"] = true, ["[U:1:74057001]"] = true, ["[U:1:1712924683]"] = true, ["[U:1:1786692235]"] = true, ["[U:1:1314698454]"] = true, ["[U:1:1268276814]"] = true, ["[U:1:1007530715]"] = true, ["[U:1:432526137]"] = true, ["[U:1:1017755058]"] = true, ["[U:1:1735802732]"] = true, ["[U:1:172744906]"] = true, ["[U:1:1719864092]"] = true, ["[U:1:1415441535]"] = true, ["[U:1:418343582]"] = true, ["[U:1:399239913]"] = true, ["[U:1:145288356]"] = true, ["[U:1:1267741971]"] = true, ["[U:1:41024556]"] = true, ["[U:1:213021739]"] = true, ["[U:1:425291587]"] = true, ["[U:1:164500106]"] = true, ["[U:1:837368705]"] = true, ["[U:1:130490845]"] = true, ["[U:1:114550444]"] = true, ["[U:1:89784922]"] = true, ["[U:1:874295988]"] = true, ["[U:1:1427498087]"] = true, ["[U:1:400236800]"] = true, ["[U:1:1302787525]"] = true, ["[U:1:1183809195]"] = true, ["[U:1:1572558078]"] = true, ["[U:1:1251129637]"] = true, ["[U:1:427894071]"] = true, ["[U:1:1226042555]"] = true, ["[U:1:1018883373]"] = true, ["[U:1:67368924]"] = true, ["[U:1:34513941]"] = true, ["[U:1:92521691]"] = true, ["[U:1:143642940]"] = true, ["[U:1:1049365161]"] = true, ["[U:1:86699889]"] = true, ["[U:1:103643619]"] = true, ["[U:1:412199207]"] = true, ["[U:1:134142630]"] = true, ["[U:1:1008509390]"] = true, ["[U:1:237981327]"] = true, ["[U:1:840925169]"] = true, ["[U:1:477029644]"] = true, ["[U:1:1924480034]"] = true, ["[U:1:1101504870]"] = true, ["[U:1:1547208917]"] = true, ["[U:1:1365131859]"] = true, ["[U:1:89784922]"] = true, ["[U:1:1226799266]"] = true, ["[U:1:1173812518]"] = true, ["[U:1:998943685]"] = true, ["[U:1:1433062718]"] = true, ["[U:1:1173714004]"] = true, ["[U:1:819776027]"] = true, ["[U:1:1145096557]"] = true, ["[U:1:823667499]"] = true, ["[U:1:830605347]"] = true, ["[U:1:1307419174]"] = true, ["[U:1:1256195134]"] = true, ["[U:1:1202421555]"] = true, ["[U:1:1301528028]"] = true, ["[U:1:322547794]"] = true, ["[U:1:1665468033]"] = true, ["[U:1:259701995]"] = true, ["[U:1:1033125380]"] = true, ["[U:1:882994776]"] = true, ["[U:1:1683068248]"] = true, ["[U:1:891985556]"] = true, ["[U:1:1400389325]"] = true, ["[U:1:74094238]"] = true, ["[U:1:1278691361]"] = true, ["[U:1:1520275434]"] = true, ["[U:1:1862471601]"] = true, ["[U:1:1296772921]"] = true, ["[U:1:95255355]"] = true, ["[U:1:1478524000]"] = true, ["[U:1:1870229588]"] = true, ["[U:1:1458906148]"] = true, ["[U:1:1623515566]"] = true, ["[U:1:1156944372]"] = true, ["[U:1:1930300425]"] = true, ["[U:1:791838941]"] = true, ["[U:1:1910463882]"] = true, ["[U:1:788649579]"] = true, ["[U:1:1130902302]"] = true, ["[U:1:427719259]"] = true, ["[U:1:785381766]"] = true, ["[U:1:781284899]"] = true, ["[U:1:67538603]"] = true, ["[U:1:782905859]"] = true, ["[U:1:818164532]"] = true, ["[U:1:33568711]"] = true, } local Barricade_Table = { [1] = { state = 4, solid = false, health = 400, manager = nil }, [2] = { state = 4, solid = false, health = 400, manager = nil }, [3] = { state = 8, solid = false, health = 1200, manager = nil }, [4] = { state = 0, solid = false, health = 100, manager = nil }, [5] = { state = 0, solid = false, health = 100, manager = nil }, [6] = { state = 0, solid = false, health = 100, manager = nil }, [7] = { state = 6, solid = false, health = 800, manager = nil }, [8] = { state = 0, solid = false, health = 100, manager = nil } } local Cade_Map = { "A", "B", "C", "D", "E", "F", "G", "TUT" } local Barricade_Thinker = 0 local Barricade_AttackThinker = 0 local GameStart = false local Tut = false local Lastman = false local Solomode = false local Devmode = false local TotalPlayers = 0 -- Total non-spec players local AlivePlayers = 0 local BuffDelay = 0 local Soloer = nil local CanEnterSolo = true local PlayerCountAtStart = 0 ents.GetAllRealRedPlayers = function() local players = {} for index, ply in pairs(ents.GetAllPlayers()) do if ply:IsRealPlayer() and ply:OnTeam( TEAM_RED ) then table.insert( players, ply ) end end return players end ents.GetAllAliveRealRedPlayers = function() local ply = {} for _, player in pairs( ents.GetAllPlayers() ) do if player:IsRealPlayer() and player:IsAlive() and player:OnTeam( TEAM_RED ) then table.insert( ply, player ) end end return ply end function OnWaveStart( wave ) GameStart = true Solomode = false Lastman = false Soloer = nil CanEnterSolo = true PlayerCountAtStart = #ents.GetAllAliveRealRedPlayers() if wave == 1 then Tut = true end timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_TUT_Script_Manager") ) then Barricade_Table[8].manager = ents.FindByName("Barricade_TUT_Script_Manager") end end) end function StartSoloMode() Solomode = true end function OnWaveReset() GameStart = false Tut = false Solomode = false Soloer = nil CanEnterSolo = true end local Movespeed_Reduction_Table = { [TF_CLASS_SCOUT] = 150 / 400, [TF_CLASS_SOLDIER] = 150 / 240, [TF_CLASS_PYRO] = 150 / 300, [TF_CLASS_DEMOMAN] = 150 / 280, [TF_CLASS_HEAVYWEAPONS] = 150 / 230, [TF_CLASS_ENGINEER] = 150 / 300, [TF_CLASS_MEDIC] = 150 / 320, [TF_CLASS_SNIPER] = 150 / 300, [TF_CLASS_SPY] = 150 / 320 } CEntity.GetModel = function(self) if self:IsValid() then return self.m_ModelName end end function OnWaveInit() GameStart = false Tut = false Solomode = false Lastman = false Soloer = nil CanEnterSolo = true for _, player in pairs( ents.GetAllRealPlayers() ) do player:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 0.5, 0, 1)") end timer.Simple(0.1, function() ents.FindByName( "bignet" ):AcceptInput( "RunScriptCode", "VscriptIsGay.bSoloMode = false" ) ents.FindByName("cc_dead"):Disable() ents.FindByName("cc_infected"):Disable() ents.FindByName("cc_default"):Disable() ents.FindByName("cc_lastman"):Disable() ents.FindByName("cc_tele"):Disable() end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_A_Script_Manager") ) then Barricade_Table[1].manager = ents.FindByName("Barricade_A_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_B_Script_Manager") ) then Barricade_Table[2].manager = ents.FindByName("Barricade_B_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_C_Script_Manager") ) then Barricade_Table[3].manager = ents.FindByName("Barricade_C_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_D_Script_Manager") ) then Barricade_Table[4].manager = ents.FindByName("Barricade_D_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_E_Script_Manager") ) then Barricade_Table[5].manager = ents.FindByName("Barricade_E_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_F_Script_Manager") ) then Barricade_Table[6].manager = ents.FindByName("Barricade_F_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_G_Script_Manager") ) then Barricade_Table[7].manager = ents.FindByName("Barricade_G_Script_Manager") end end) timer.Simple(0.5, function() if IsValid( ents.FindByName("Barricade_TUT_Script_Manager") ) then Barricade_Table[8].manager = ents.FindByName("Barricade_TUT_Script_Manager") end end) timer.Simple(1, function() for cade, v in pairs( Barricade_Table ) do local cade_name = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Part_" local brush_name = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Brush" if IsValid( Barricade_Table[cade].manager ) then local i = 1 while ( IsValid( ents.FindByName(cade_name .. tostring(i) ) ) ) do local hCade = ents.FindByName(cade_name .. tostring(i) ) local iState = Barricade_Table[cade].state local hBrush = nil if IsValid( ents.FindByName( brush_name ) ) then hBrush = ents.FindByName( brush_name ) end hCade.Damageable = false if not hCade.callbacks then hCade.callbacks = {} end if not hCade.callbacks.damaged then hCade.callbacks.damaged = hCade:AddCallback( ON_DAMAGE_RECEIVED_POST, function( ent, dmginfo, prevHealth ) CadeDamage( ent, dmginfo, prevHealth, cade ) end) end if hBrush ~= nil then hBrush.Damageable = false if not hBrush.callbacks then hBrush.callbacks = {} end hBrush.callbacks.damaged = hBrush:AddCallback( ON_DAMAGE_RECEIVED_POST, function( ent, dmginfo, prevHealth ) CadeDamage( ent, dmginfo, prevHealth, cade ) end) end i = i + 1 if i > 50 then break end --prevent stack overflow end if Barricade_Table[cade].solid then ents.FindByName( brush_name ):AcceptInput( "Enable" ) end for i = 1, Barricade_Table[cade].state do ents.FindByName(cade_name .. tostring(i) ):AcceptInput( "Enable" ) ents.FindByName(cade_name .. tostring(i) ):AcceptInput( "EnableCollision" ) ents.FindByName(cade_name .. tostring(i) ).m_nSolidType = 6 ents.FindByName(cade_name .. tostring(i) ).Damageable = true end end end end) Barricade_Table = { [1] = { state = 4, solid = false, health = 400, manager = nil }, [2] = { state = 4, solid = false, health = 400, manager = nil }, [3] = { state = 8, solid = false, health = 1200, manager = nil }, [4] = { state = 0, solid = false, health = 100, manager = nil }, [5] = { state = 0, solid = false, health = 100, manager = nil }, [6] = { state = 0, solid = false, health = 100, manager = nil }, [7] = { state = 6, solid = false, health = 800, manager = nil }, [8] = { state = 0, solid = false, health = 100, manager = nil } } end function DEV_ServerDevmode() if Devmode == false then Devmode = true else Devmode = false end print( Devmode ) end function RecountPlayers() TotalPlayers = #ents.GetAllRealRedPlayers() AlivePlayers = #ents.GetAllAliveRealRedPlayers() end function DisableSolo() if not Solomode then CanEnterSolo = false end end function CadeDamage( ent, dmginfo, prevHealth, cade ) if ent.Damageable then local dmg = dmginfo.Damage local wep = dmginfo.Weapon local atk = dmginfo.Attacker if not IsValid( atk ) then return end if ( atk:IsRealPlayer() ) and ( atk:GetTeam() ~= 1 ) and ( ( atk:GetPlayerItemBySlot(2) ~= wep ) and ( atk:GetActivePlayerWeapon() ~= atk:GetPlayerItemBySlot(2) ) ) and ( wep:GetItemName() ~= "Nail Gun" ) then return end if atk.m_szNetworkIDString == "[U:1:1339336601]" then if wep:GetItemName() ~= util.GetItemDefinitionNameByIndex(331):GetItemName() then --Shiv return end end local cade_health = Barricade_Table[cade].health local cade_state = Barricade_Table[cade].state if atk:IsRealPlayer() and ( wep:GetItemName() == "Nail Gun" ) then local max_health = ( Barricade_Table[cade].state ) * 100 if cade_state > 4 then max_health = max_health + ( Barricade_Table[cade].state - ( 4 ) ) * 100 end Barricade_Table[cade].health = math.min( Barricade_Table[cade].health + 4, max_health ) return end if atk:IsRealPlayer() and ( wep:GetItemName() == "Texan Fixup" ) then local max_health = ( Barricade_Table[cade].state ) * 100 if cade_state > 4 then max_health = max_health + ( Barricade_Table[cade].state - ( 4 ) ) * 100 end Barricade_Table[cade].health = math.min( Barricade_Table[cade].health + 50, max_health ) return end if Tut and ( cade ~= 7 ) then return end local attr = 1 if atk:IsPlayer() and ( wep ) then attr = wep:GetAttributeValueByClass("mult_engy_sentry_damage", 1) end dmg = dmg * attr Barricade_Table[cade].health = Barricade_Table[cade].health - dmg local next_cade_decrease = ( Barricade_Table[cade].state - 1 ) * 100 if cade_state > 4 then next_cade_decrease = next_cade_decrease + ( Barricade_Table[cade].state - ( 5 ) ) * 100 end local cade_name = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Part_" local hCade = ents.FindByName(cade_name .. tostring( Barricade_Table[cade].state ) ) local brush_name = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Brush" local hBrush = nil if IsValid( ents.FindByName( brush_name ) ) then hBrush = ents.FindByName( brush_name ) end ent:PlaySound("Wood_Plank.ImpactHard") ent:PlaySound("Wood_Plank.ImpactHard") if next_cade_decrease >= cade_health then hCade:AcceptInput( "Disable" ) hCade:AcceptInput( "DisableCollision" ) ent:PlaySound("Wood_Plank.Break") ent:PlaySound("Wood_Plank.Break") hCade.Damageable = false ents.FindByName("nav_refresh"):AcceptInput("recomputeblockers") util.ParticleEffect( "crate_drop", hCade:GetAbsOrigin() ) util.ParticleEffect( "mvm_pow_gold_seq_wood3mid", hCade:GetAbsOrigin() ) Barricade_Table[cade].state = math.max( cade_state - 1, 0 ) cade_state = Barricade_Table[cade].state -- if cade_state > 4 and ( hBrush ~= nil ) then -- hBrush:AcceptInput( "Disable") -- hBrush.Damageable = false -- end end end end function removeCallbacks(player, callbacks) if not IsValid(player) then return end for _, callbackId in pairs(callbacks) do player:RemoveCallback(callbackId) end end function OnGameTick() if CurTime() >= Barricade_Thinker then for cade, v in pairs( Barricade_Table ) do if Barricade_Table[cade].manager ~= nil then local hManager = Barricade_Table[cade].manager local cade_name = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Part_" if Barricade_Table[cade].health < 0 then Barricade_Table[cade].health = 0 end if Tut and ( cade ~= 8 ) then goto skip end local brush_name = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Brush" local hBrush = nil if IsValid( ents.FindByName( brush_name ) ) then hBrush = ents.FindByName( brush_name ) end -- print(cade) -- if cade == 3 then -- print( Barricade_Table[cade].state < 4, hBrush ~= nil ) -- end if Barricade_Table[cade].state < 4 then Barricade_Table[cade].solid = false if hBrush ~= nil then hBrush:AcceptInput( "Disable" ) hBrush.Damageable = false end else if hBrush ~= nil then hBrush:AcceptInput( "Enable" ) hBrush.Damageable = true end end for _, hPlayer in pairs( ents.FindInBox( hManager:GetAbsOrigin() + Vector(-160,-160,-184), hManager:GetAbsOrigin() + Vector(160,160,0), "player" ) ) do if hPlayer:IsRealPlayer() and hPlayer:IsAlive() and ( hPlayer:GetTeam() ~= 1 ) then if hPlayer.bHasWood then Barricade_Table[cade].state = Barricade_Table[cade].state + 1 if not ( IsValid( ents.FindByName( cade_name .. tostring( Barricade_Table[cade].state ) ) ) ) then hPlayer:Print(2,"This barricade is fully built") Barricade_Table[cade].state = Barricade_Table[cade].state - 1 goto continue end ents.FindByName("nav_refresh"):AcceptInput("recomputeblockers") local percent = 0 local start = hPlayer:GetAbsOrigin() + Vector(0, 0, 24) local endpos = ents.FindByName(cade_name .. tostring(Barricade_Table[cade].state) ):GetAbsOrigin() local startang = Vector(0, 0, -90) local endang = ents.FindByName(cade_name .. tostring(Barricade_Table[cade].state) ):GetAbsAngles() local modelname = tostring( ents.FindByName(cade_name .. tostring(Barricade_Table[cade].state) ):GetModel() ) local iSkin = tonumber( ents.FindByName(cade_name .. tostring(Barricade_Table[cade].state) ).m_nSkin ) hPlayer.bHasWood = false local iState = Barricade_Table[cade].state local hCade = ents.FindByName(cade_name .. tostring(Barricade_Table[cade].state) ) if not hCade.callbacks then hCade.callbacks = {} end hCade.Damageable = true Barricade_Table[cade].health = iState * 100 hCade:AcceptInput( "EnableCollision" ) hCade.m_nSolidType = 6 if iState >= 4 then Barricade_Table[cade].health = Barricade_Table[cade].health + ( ( iState - 4 ) * 100 ) Barricade_Table[cade].solid = true end local ent_table = { model = modelname, origin = "0 0 0", angles = "0 0 0 ", solid = 0, disableshadows = 1, skin = iSkin, targetname = "DEBUG" } local hWood = ents.CreateWithKeys( "prop_dynamic", ent_table, true, true ) hWood:SetAbsOrigin( start ) hWood:SetAbsAngles( startang ) timer.Create( 0.05, function() percent = percent + 0.1 hWood:SetAbsOrigin( lerpvector( start, endpos, percent ) ) hWood:SetAbsAngles( lerpvector( startang, endang, percent ) ) end, 10) timer.Simple( 0.7, function() hWood:Remove() for i = 1, Barricade_Table[cade].state do ents.FindByName(cade_name .. tostring(i) ):AcceptInput( "Enable" ) ents.FindByName(cade_name .. tostring(i) ):AcceptInput( "EnableCollision" ) ents.FindByName(cade_name .. tostring(i) ).m_nSolidType = 6 ents.FindByName(cade_name .. tostring(i) ).Damageable = true end end) ::continue:: end elseif hPlayer:IsBot() and hPlayer:IsAlive() and ( hPlayer:GetTeam() ~= 1 ) then if Barricade_Table[cade].state > 2 and ( CurTime() >= hPlayer.Barricade_AttackThinker ) then if hPlayer:GetTeam() == 2 then return end --don't want shop keeper break barricades if hPlayer.m_iClass == TF_CLASS_MEDIC then return end --medics shouldn't break barricades local sTargetLookCade = cade_name .. tostring(3) local sTargetCade = "Barricade_" .. tostring( Cade_Map[cade] ) .. "_Target" hPlayer:StunPlayer( 0.2, 0.8, TF_STUNFLAG_SLOWDOWN ) hPlayer:RemoveCond( 51 ) if hPlayer:GetActivePlayerWeapon() == hPlayer:GetPlayerItemBySlot(2) then hPlayer.Barricade_AttackThinker = CurTime() + 0.5 hPlayer:AcceptInput("$BotCommand", "interrupt_action -posent " .. sTargetCade .. " -lookposent " .. sTargetLookCade .. " -killlook -alwayslook -duration 1 -distance 8") else hPlayer.Barricade_AttackThinker = CurTime() + ( hPlayer:GetActivePlayerWeapon():GetAttributeValue("Wrench Index") or 0.1 ) hPlayer:AcceptInput("$BotCommand", "interrupt_action -posent " .. sTargetCade .. " -lookposent " .. sTargetLookCade .. " -killlook -alwayslook -duration 1 -distance 128") end --hPlayer:AcceptInput("$BotCommand", "interrupt_action -posent " .. sTargetCade .. " -lookposent " .. sTargetLookCade .. " -killlook -alwayslook -duration 1 -distance 8") --hPlayer:SetAttributeValue("reload full clip at once", 1) --hPlayer:SetAttributeValue("penetrate teammates", 1) if string.match( hPlayer:GetPlayerName(), "Arsonist" ) then ents.FindByName( sTargetLookCade ):TakeDamage({ Attacker = hPlayer, Weapon = hPlayer:GetActivePlayerWeapon(), Damage = 2 }) else if IsValid( hPlayer.m_hActiveWeapon ) then hPlayer.m_bLagCompensation = true util.StartLagCompensation( hPlayer ) hPlayer:AcceptInput( "RunScriptCode", "self.GetActiveWeapon().PrimaryAttack()" ) hPlayer.m_bLagCompensation = false util.FinishLagCompensation( hPlayer ) end end end end end for _, hTank in pairs( ents.FindInBox( hManager:GetAbsOrigin() + Vector(-96,-96,-192), hManager:GetAbsOrigin() + Vector(96,96,0), "tank_boss" ) ) do if Barricade_Table[cade].state > 0 then local sTargetCade = cade_name .. tostring(1) hTank:SetSpeed(5) ents.FindByName( sTargetCade ):TakeDamage({ Attacker = hTank, Damage = 10 }) else hTank:SetSpeed(75) end end ::skip:: end end for _, player in pairs( ents.GetAllAliveRealPlayers() ) do local Trace = util.Trace({ start = player:GetEyePos(), distance = 500, angles = Vector(90, 0, 0), mask = MASK_PLAYERSOLID, filter = player, mins = Vector(-4,-4,0), maxs = Vector(4,4,0) }) if Trace.Hit then if ( SURF_SKY & Trace.SurfaceFlags ) == SURF_SKY then ResetWoodForce( nil, player ) end end end Barricade_Thinker = CurTime() + 0.25 end for _, player in pairs( ents.GetAllAliveRealPlayers() ) do if player:GetTeam() ~= 1 then local iMaxHealth = ( player.m_iMaxHealth + ( math.min( player.m_iDecapitations, 4 ) * 15 ) ) player:SetAttributeValue("major move speed bonus", lerp( 1, Movespeed_Reduction_Table[player.m_iClass], math.clamp( 1 - ( player.m_iHealth / iMaxHealth ), 0, 1 ) ) ) if player.m_iClass == TF_CLASS_DEMOMAN and ( player:InCond( TF_COND_SHIELD_CHARGE ) ) and ( player:GetPlayerItemBySlot(1):GetItemName() == "The Tide Turner" ) then player:SetAttributeValue( "displace touched enemies", 5 ) player:SetAttributeValue( "dmg taken increased", 0.75 ) elseif player.m_iClass == TF_CLASS_DEMOMAN then player:SetAttributeValue( "displace touched enemies", nil ) player:SetAttributeValue( "dmg taken increased", nil ) end if not IsValid(player:GetPlayerItemBySlot(2)) then player:ResetInventory() end if player.bHasWood then player:WeaponSwitchSlot(2) elseif string.match( player:GetPlayerItemBySlot(2):GetItemName(), "Wood Plank" ) and ( not player.bHasWood ) then if player.PreviousMelee == "Wood Plank" then player.PreviousMelee = "Memory Maker" end player:WeaponStripSlot(2) player:WeaponSwitchSlot(1) player:GiveItem( player.PreviousMelee, nil, false, true ) player:WeaponSwitchSlot(0) -- just in case player:SetAttributeValue("move speed penalty", nil) player:SetAttributeValue("increased jump height", nil) player:SetAttributeValue("no_attack", nil) for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram") ) do hologram:HideTo( player ) end for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram_Tut") ) do hologram:HideTo( player ) end elseif player:GetAttributeValue("move speed penalty") ~= nil and ( not player.bHasWood ) then --if player.m_iClass == TF_CLASS_SCOUT then player:SetAttributeValue("move speed penalty", nil) player:SetAttributeValue("increased jump height", nil) player:SetAttributeValue("no_attack", nil) player:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "") player:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "") --end for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram") ) do hologram:HideTo( player ) end for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram_Tut") ) do hologram:HideTo( player ) end end if IsValid(player:GetPlayerItemBySlot(1)) then local attr = player:GetPlayerItemBySlot(1):GetAttributeValue("boost on damage") or 0 if attr > 0 then player.HypeEnable = true else player.HypeEnable = false end if player.HypeEnable then player.Hype = math.max( player.Hype - 0.1, 0 ) player:SetAttributeValue("major move speed bonus", 1 + ( 0.25 * ( player.Hype / player.HypeMax ) ) ) if CurTime() >= player.UpdateDelay then player:ShowHudText({channel = 5, y = 0.90, x = 0.74, r1 = 250, r2 = 250, g1 = 250, g2 = 250, b1 = 250, b2 = 250, effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 0.15}, "Hype: " .. math.round( ( player.Hype / player.HypeMax ) * 100, 2 ).. "%" ) player.UpdateDelay = CurTime() + 0.1 end end end if not player.bInHouse then player:StunPlayer( 1, 0.85, TF_STUNFLAG_SLOWDOWN ) player:SetAttributeValue( "healing received penalty", 0 ) if CurTime() >= player.DamageDelay then player:TakeDamage({ Attacker = player, Damage = 6, DamageType = DMG_NERVEGAS | DMG_PREVENT_PHYSICS_FORCE | DMG_NEVERGIB, DamageCustom = TF_DMG_CUSTOM_BLEEDING }) player.DamageDelay = CurTime() + 0.5 end else player:SetAttributeValue( "healing received penalty", nil ) end end end MineLayer() Buffs() end function Buffs() RecountPlayers() local PlayerDif = PlayerCountAtStart - AlivePlayers print( Solomode, CanEnterSolo, ( not Solomode ) or ( not CanEnterSolo ), AlivePlayers == 1 and ( PlayerDif > 0 ), AlivePlayers == 1 and ( PlayerDif > 0 ) and ( ( not Solomode ) or ( not CanEnterSolo ) ) ) if not GameStart then return end if AlivePlayers == 2 and ( not Solomode ) then --Low man if Lastman then Lastman = false ents.FindByName("lastman_relay_disable"):Trigger() end for _, player in pairs( ents.GetAllAliveRealPlayers() ) do local PrimaryOut = ( player.m_hActiveWeapon == player:GetPlayerItemBySlot( 0 ) ) and ( ( player.m_iClass ~= TF_CLASS_ENGINEER ) and ( player.m_iClass ~= TF_CLASS_MEDIC ) and ( player.m_iClass ~= TF_CLASS_SPY ) ) if not PrimaryOut then player:AddCond( TF_COND_OFFENSEBUFF, 0.1 ) else -- player:RemoveCond( TF_COND_ENERGY_BUFF ) end end elseif AlivePlayers == 1 and ( PlayerDif > 0 ) and ( ( not Solomode ) or ( not CanEnterSolo ) ) then --Lastman if not Lastman then Lastman = true BuffDelay = CurTime() + 2.75 for _, player in pairs( ents.GetAllPlayers() ) do if player:IsRealPlayer() and player:IsAlive() then ents.FindByName("lastman_relay"):AcceptInput( "trigger", nil, player, player ) player:AcceptInput( "RunScriptCode", "VscriptIsGay.SendAnnotationOn( self, `YOU ARE THE LAST...`, 8, false, 2.75)", player, player ) end end end if CurTime() > BuffDelay then for _, player in pairs( ents.GetAllPlayers() ) do if player:IsRealPlayer() and player:IsAlive() then local PrimaryOut = ( player.m_hActiveWeapon == player:GetPlayerItemBySlot( 0 ) ) and ( ( player.m_iClass ~= TF_CLASS_ENGINEER ) and ( player.m_iClass ~= TF_CLASS_MEDIC ) and ( player.m_iClass ~= TF_CLASS_SPY ) ) if not PrimaryOut then player:AddCond( TF_COND_CRITBOOSTED_USER_BUFF, 0.1 ) end elseif player:IsBot() then player:AddCond( TF_COND_SPEED_BOOST, 0.1 ) end end end elseif AlivePlayers == 1 and ( PlayerDif == 0 ) and ( CanEnterSolo ) then --Solo if not Solomode then Solomode = true BuffDelay = CurTime() + 12 ents.FindByName( "bignet" ):AcceptInput( "RunScriptCode", "VscriptIsGay.bSoloMode = true" ) for _, player in pairs( ents.GetAllPlayers() ) do if player:IsRealPlayer() and player:IsAlive() then ents.FindByName("solomode_relay"):AcceptInput( "trigger", nil, player, player ) player:AcceptInput( "RunScriptCode", "VscriptIsGay.SendAnnotationOn( self, `YOU ARE ALONE...`, 12, false, 3)", player, player ) Soloer = player end end end if CurTime() > BuffDelay then for _, player in pairs( ents.GetAllPlayers() ) do if player:IsRealPlayer() and player:IsAlive() then local PrimaryOut = ( player.m_hActiveWeapon == player:GetPlayerItemBySlot( 0 ) ) and ( ( player.m_iClass ~= TF_CLASS_ENGINEER ) and ( player.m_iClass ~= TF_CLASS_MEDIC ) and ( player.m_iClass ~= TF_CLASS_SPY ) ) if not PrimaryOut then player:AddCond( TF_COND_OFFENSEBUFF, 0.1 ) end player:SetAttributeValue( "projectile penetration", 1 ) player:SetAttributeValue( "melee cleave attack", 1 ) player:SetAttributeValue( "mult dmg vs tanks", 2 ) player:SetAttributeValue( "engy sentry fire rate increased", 1 ) if IsValid( player:GetPlayerItemBySlot( 1 ) ) then local Weapon = player:GetPlayerItemBySlot( 1 ) local ItemIndex = util.GetItemDefinitionIndexByName( Weapon:GetItemName() ) if ItemIndex == 129 or ItemIndex == 1001 then Weapon:SetAttributeValue( "effect cond override", 34 ) elseif ItemIndex == 311 then Weapon:SetAttributeValue( "effect cond override", 34 + ( 41 * 256 ) ) elseif ItemIndex == 751 then Weapon:SetAttributeValue( "effect cond override", 19 + ( 34 * 256 ) + ( 32 * 65536 ) ) elseif ItemIndex == 812 or ItemIndex == 833 then Weapon:SetAttributeValue( "critboost on kill", 5 ) Weapon:SetAttributeValue( "minicritboost on kill", nil ) elseif ItemIndex == 163 then Weapon:SetAttributeValue( "effect cond override", 31 + ( 34 * 256 ) ) end end if IsValid( player:GetPlayerItemBySlot( 2 ) ) then local Weapon = player:GetPlayerItemBySlot( 2 ) local ItemIndex = util.GetItemDefinitionIndexByName( Weapon:GetItemName() ) if ItemIndex == 43 then Weapon:SetAttributeValue( "critboost on kill", 5 ) Weapon:SetAttributeValue( "minicritboost on kill", nil ) end end elseif player:IsBot() then player:SetAttributeValue( "force distribute currency on death", 1 ) end end end else --Normal if Lastman then Lastman = false ents.FindByName("lastman_relay_disable"):AcceptInput("trigger") end end for _, player in pairs( ents.GetAllRealPlayers() ) do timer.Simple( 0, function() if ( player:OnTeam( 2 ) ) and ( Solomode ) and ( player ~= Soloer ) then player:AcceptInput( "RunScriptCode", "self.ForceChangeTeam( 1, true )", player, player ) player:Print( 2, "Singleplayer Mode in progress...\n Please wait..." ) end end) end end function DisguiseOnHit( _, activator, caller ) if not activator then return end if not caller then return end if activator:GetTeam() ~= caller:GetTeam() then activator:AddCond(2, 1) activator.m_hDisguiseTarget = caller activator.m_nDisguiseTeam = caller:GetTeam() activator.m_nDisguiseClass = caller.m_iClass activator.m_iDisguiseHealth = caller.m_iHealth activator.m_hDisguiseWeapon = caller.m_hActiveWeapon timer.Simple(1, function() activator.m_hDisguiseTarget = caller activator.m_nDisguiseTeam = caller:GetTeam() activator.m_nDisguiseClass = caller.m_iClass activator.m_iDisguiseHealth = caller.m_iHealth activator.m_hDisguiseWeapon = caller.m_hActiveWeapon activator:RemoveCond(2) activator:AddCond(3, 10) timer.Simple(10, function() if activator:InCond(3) then activator:RemoveCond(3) end end) end) end end function DisableFog() ents.FindByName("House_Zone"):Disable() timer.Simple(0.12, function() for _, player in pairs( ents.GetAllPlayers() ) do player.bInHouse = true player:AcceptInput("SetFogController","fog_controller") end end) timer.Simple(0.15, function() for _, player in pairs( ents.GetAllPlayers() ) do player.bInHouse = true player:AcceptInput("SetFogController","fog_controller") end end) timer.Simple(0.18, function() for _, player in pairs( ents.GetAllPlayers() ) do player.bInHouse = true player:AcceptInput("SetFogController","fog_controller") end end) end local MineModel = "models/pickups/emitter.mdl" function MineLayer() for _, mine in pairs( ents.FindAllByClass("tf_projectile_pipe") ) do if mine:GetModel() == MineModel and ( IsValid(mine) ) then if not mine.Grounded then mine.Grounded = false end if not mine.Armed then mine.Armed = false end local callbacks = {} local terminated = false local function terminate() if terminated then return end terminated = true removeCallbacks(mine, callbacks) end if not callbacks.removed then callbacks.removed = mine:AddCallback(ON_REMOVE, function() terminate() mine:StopSound("MineLayer.Deploy") end) end if mine.Grounded == false then local filter = ents.GetAllPlayers() table.insert( filter, mine ) local Tracer = util.Trace({ start = mine:GetAbsOrigin(), distance = 8, angles = Vector(90, 0, 0), mask = MASK_PLAYERSOLID, filter = filter, mins = Vector(-4,-4,0), maxs = Vector(4,4,0) }) if Tracer.Hit then mine.Grounded = true mine.ArmTime = CurTime() + 2 mine:PlaySound("MineLayer.HitGround") mine:AcceptInput( "RunScriptCode", "self.SetForwardVector( Vector(1) )" ) mine:AcceptInput( "RunScriptCode", "self.SetPhysVelocity( Vector() )" ) mine:AcceptInput( "RunScriptCode", "self.SetPhysAngularVelocity( Vector() )" ) end else if CurTime() >= mine.ArmTime and ( not mine.Armed ) then mine.Armed = true mine:AcceptInput( "Skin", 1 ) mine:PlaySound("MineLayer.Deploy") timer.Simple(0.5, function() if mine:IsValid() then mine:StopSound("MineLayer.Deploy") end end) end if mine.Armed then mine.m_bTouched = 0 timer.Simple(0, function() mine.m_bTouched = 0 end) else mine.m_bTouched = 1 end end end end end function AddHealth( health, activator, caller ) local attr = activator:GetAttributeValue( "SET BONUS: max health additive bonus" ) or 0 activator:SetAttributeValue( "SET BONUS: max health additive bonus", math.min( attr + health, 75 ) ) end function InfectSapper( _, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) then caller:PlaySound("weapons/breadmonster/gloves/bm_gloves_on.wav") caller:PlaySound("weapons/breadmonster/gloves/bm_gloves_on.wav") util.ParticleEffect( "breadjar_impact", caller:GetEyePos() ) util.ParticleEffect( "bread_gloves_goop", caller:GetEyePos() , caller:GetEyeAngles() ) Infect( nil, activator, caller ) end end function Infect( _, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( caller:IsAlive() ) and ( caller.m_iTeamNum ~= 1 ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) and ( not caller.Infected ) then caller.Infected = true caller.Infector = activator util.ParticleEffect( "breadjar_impact", caller:GetEyePos() ) util.ParticleEffect( "bread_gloves_goop", caller:GetEyePos(), caller:GetEyeAngles() ) end end function OnPlayerDeath(player, attacker, weapon, dmgtype, assister, crit_type, silent_kill) if ( player ) and ( player:IsValid() ) and ( player:IsBot() ) and ( player.Infected ) then player.Infected = false local Infector = player.Infector local Blast_Radius = 128 * ( Infector:GetPlayerItemBySlot(4):GetAttributeValueByClass("mult_explosion_radius", 1 ) ) local Blast_Damage = 40 * ( Infector:GetPlayerItemBySlot(4):GetAttributeValueByClass("mult_dmg", 1 ) ) local dmg_info = { Attacker = Infector, Damage = Blast_Damage, DamageType = DMG_BLAST, DamageCustom = TF_DMG_CUSTOM_SAPPER_RECORDER_DEATH } util.ParticleEffect( "mvm_loot_explosion", player:GetAbsOrigin() + Vector(0,0,64) ) util.ParticleEffect( "breadjar_impact", player:GetEyePos() + Vector(0,0,64) ) util.ParticleEffect( "bread_gloves_goop", player:GetEyePos() + Vector(0,0,64), player:GetEyeAngles() ) player:PlaySound("Weapon_Airstrike.Explosion") player:PlaySound("Weapon_Airstrike.Explosion") player:PlaySound("weapons/breadmonster/throwable/bm_throwable_smash.wav") for _, others in pairs( ents.FindInSphere( player:GetAbsOrigin(), Blast_Radius ) ) do if ( others:IsBot() ) and ( others:IsAlive() ) and ( others ~= player ) then others:TakeDamage( dmg_info ) Infect( nil, Infector, others ) end end end end function OnWaveSpawnBot(bot, wave, tags) bot.Infected = false end local Music_Table = { "music_breach_1", "music_breach_2", "music_poison_1", "music_poison_2", "music_robot_1", "music_robot_2", "music_arsonist_stinger_1", "music_arsonist_stinger_2", "music_robot_boss_1", "music_bomb_1", "music_bomb_2", "music_bomb_stinger_1", "music_bomb_stinger_2" } function OnPlayerConnected( player ) if player:IsRealPlayer() then player.bHasWood = false player.bInAttack = false player.bInHouse = true player.HypeEnable = false player.Hype = 0 player.HypeMax = 200 player.UpdateDelay = CurTime() player.DamageDelay = CurTime() player:AcceptInput("SetFogController","fog_controller") player.ResetDelay = CurTime() player.ComboNumber = 1 player:AddCallback( ON_SPAWN, function( ent ) ent.bHasWood = false ent.bInAttack = false ent.bInHouse = true ent.HypeEnable = false ent.Hype = 0 ent.HypeMax = 200 ent:AcceptInput("SetFogController","fog_controller") ent:SetAttributeValue( "SET BONUS: max health additive bonus", nil ) ent.ResetDelay = CurTime() ent.ComboNumber = 1 ent:SetHUDVisibility( 1 ) if player:IsRealPlayer() then if CHEATERS[player.m_szNetworkIDString] then player:Kill() util.PrintToChatAll( player:GetPlayerName() .. " left the game (Banned from Teto Mission because of cheating, fucking pussy scum lol)" ) end end if Devmode then for _, ply in pairs( ents.GetAllPlayers() ) do if ( ply.m_szNetworkIDString == "[U:1:49065369]" ) and ( player ~= ply ) then util.PrintToChat( ply, "Lockdown Security: Player " .. tostring( player.m_szNetworkIDString ) .. '/' .. tostring( player:GetPlayerName() ) " Tried to join; kicked." ) timer.Simple( 0.1, function() player:AcceptInput( "RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 69420, 69420, 1)" ) player:SetHUDVisibility( 0 ) player:Kill() end) break end end end end) if Devmode then for _, ply in pairs( ents.GetAllPlayers() ) do if ( ply.m_szNetworkIDString == "[U:1:49065369]" ) and ( player ~= ply ) then util.PrintToChat( ply, "Lockdown Security: Player " .. tostring( player.m_szNetworkIDString ) .. '/' .. tostring( player:GetPlayerName() ) " Tried to join; kicked." ) player:Kill() break end end end player:AddCallback( ON_DEATH, function( ent ) ent.m_hObserverTarget = nil if not GameStart then return end if Solomode then Solomode = false end timer.Simple(0, function() local ply = ents.GetAllAliveRealPlayers() if #ply == 0 then ents.FindByName("lastman_relay_disable"):AcceptInput("trigger") ents.FindByName("cc_default"):Disable() ents.FindByName("cc_infected"):Disable() ents.FindByName("burned_correction"):Disable() ents.FindByName("cc_dead"):Enable() for _, bots in pairs( ents.GetAllPlayers() ) do if bots:IsBot() and bots:IsAlive() and ( bots:GetTeam() ~= 1 ) then bots:TauntFromItem("Taunt: Flying Colors") end end for _, track in pairs( Music_Table ) do ents.FindByName( track ):Volume(0) ents.FindByName( track ):StopSound() end for _, plys in pairs( ents.GetAllRealPlayers() ) do plys:AcceptInput( "RunScriptCode", "ScreenFade(self, 50, 0, 0, 200, 2, 0, 1)" ) plys:PlaySoundToSelf("ambient/levels/citadel/citadel_hit1_adpcm.wav") plys:PlaySoundToSelf("ambient/levels/citadel/citadel_hit1_adpcm.wav") plys:SetHUDVisibility(0) --doesn't work ent:SetHUDVisibility(0) timer.Simple( 2, function() plys:AcceptInput("SetFogController","normal_death_fog") end) timer.Simple( 3, function() plys:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 3, 1, 2)") end) timer.Simple( 7, function() plys:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 3, 0, 1)") -- plys:AcceptInput("SetFogController","fog_controller") end) timer.Simple( 8.5, function() plys:AcceptInput("SetFogController","fog_controller") end) timer.Simple( 11.5, function() plys:SetHUDVisibility(1) ent:SetHUDVisibility(1) plys:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 0.5, 0.5, 2)") ents.FindByName("cc_dead"):Disable() end) end else if not ent.bInHouse then ent:AcceptInput("SetFogController","infected_death_fog") ent:SetHUDVisibility(0) timer.Simple( 1, function() ent:AcceptInput("RunScriptCode", "ScreenFade(self, 5, 26, 11, 255, 3, 3, 2)") end) timer.Simple( 7, function() ent:AcceptInput("RunScriptCode", "ScreenFade(self, 5, 26, 11, 255, 2, 0, 1)") ent:AcceptInput("SetFogController","fog_controller") ent:SetHUDVisibility(1) end) else ent:AcceptInput("SetFogController","normal_death_fog") ent:SetHUDVisibility(0) timer.Simple( 1, function() ent:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 3, 3, 2)") end) timer.Simple( 7, function() ent:AcceptInput("RunScriptCode", "ScreenFade(self, 0, 0, 0, 255, 2, 0, 1)") ent:AcceptInput("SetFogController","fog_controller") ent:SetHUDVisibility(1) end) end end end) end) player:AddCallback( ON_KEY_PRESSED, function( ent, key ) if ( ent.bHasWood or ( ent:GetAttributeValue("no_attack") ~= nil ) ) and ( ( key == IN_ATTACK ) or ( key == IN_ATTACK2 ) ) then ent.bHasWood = false for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram") ) do hologram:HideTo( ent ) end for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram_Tut") ) do hologram:HideTo( ent ) end --just in case ent:SetAttributeValue("move speed penalty", nil) ent:SetAttributeValue("increased jump height", nil) ent:SetAttributeValue("no_attack", nil) if not ent.PreviousMelee then ent.PreviousMelee = "Memory Maker" end if ent.PreviousMelee == "Wood Plank" then ent.PreviousMelee = "Memory Maker" end if ent.m_iClass ~= TF_CLASS_SCOUT then ent:DropItem(2) ent:WeaponSwitchSlot(0) ent:GiveItem( ent.PreviousMelee, nil, false, true ) if ent.PreviousMelee == "Memory Maker" then ent:ResetInventory() end ent:SetAttributeValue("move speed penalty", nil) ent:SetAttributeValue("increased jump height", nil) ent:SetAttributeValue("no_attack", nil) else ent:SetAttributeValue("move speed penalty", nil) ent:SetAttributeValue("increased jump height", nil) ent:SetAttributeValue("no_attack", nil) ent:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "") ent:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "") end end if ( ( key == IN_ATTACK ) or ( key == IN_ATTACK2 ) ) then ent.bInAttack = true end end) player:AddCallback( ON_KEY_RELEASED, function( ent, key ) if ( ( key == IN_ATTACK ) or ( key == IN_ATTACK2 ) ) then ent.bInAttack = false end end) else player.Barricade_AttackThinker = 0 player.WaitUntilReload = false player:AddCallback( ON_SPAWN, function( ent ) ent.WaitUntilReload = false end) player:AddCallback( ON_DAMAGE_RECEIVED_PRE, function( ent, dmginfo, previousHealth ) local damage = dmginfo.Damage --raw damage, before any modifiers local weapon = dmginfo.Weapon local inflictor = dmginfo.Inflictor if inflictor and inflictor:IsValid() and weapon and weapon:IsValid() then if ( inflictor:GetClassname() == "tf_projectile_pipe" ) and ( weapon:GetItemName() == "Anti-Scottish Mines" ) then if inflictor.Armed then dmginfo.Damage = dmginfo.Damage * 2 return true else dmginfo.Damage = dmginfo.Damage * 0.4 return true end end end end) end end function EnteredHouse( _, activator, caller ) activator.bInHouse = true activator:AcceptInput("SetFogController","fog_controller") end function LeftHouse( _, activator, caller) if not IsValidAliveRealPlayer(activator) then return end activator.bInHouse = false activator:AcceptInput("SetFogController","infected_fog") end function ResetWood(_, activator ) if not IsValidAliveRealPlayer( activator ) then return end if activator.bInAttack then return end if not activator.bHasWood then activator.PreviousMelee = activator:GetPlayerItemBySlot(2):GetItemName() if activator.m_iClass ~= TF_CLASS_SCOUT then if Solomode then activator:GiveItem("Wood Plank ") else activator:GiveItem("Wood Plank") end else if Solomode then activator:SetAttributeValue("move speed penalty", 0.9) activator:SetAttributeValue("increased jump height", 0.9) activator:SetAttributeValue("no_attack", 1) activator:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "models/weapons/c_models/c_paintrain/c_paintrain.mdl") activator:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "models/weapons/v_models/v_toolbox_engineer.mdl") else activator:SetAttributeValue("move speed penalty", 0.7) activator:SetAttributeValue("increased jump height", 0.7) activator:SetAttributeValue("no_attack", 1) activator:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "models/weapons/c_models/c_paintrain/c_paintrain.mdl") activator:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "models/weapons/v_models/v_toolbox_engineer.mdl") end end activator:Print(3,"You have picked up wood, attack to drop it!") for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram") ) do hologram:ShowTo( activator ) end timer.Simple(0.1, function() for k,v in pairs(ents.FindAllByClass("tf_viewmodel")) do if v.m_hOwner == player then v.m_nSequence = 0 timer.Simple(0.5, function() v.m_nSequence = 1 end) end end end) end activator.bHasWood = true end function ResetWoodForce(_, activator ) if not IsValidAliveRealPlayer( activator ) then return end --if activator.bInAttack then return end if not activator.bHasWood then activator.PreviousMelee = activator:GetPlayerItemBySlot(2):GetItemName() if activator.m_iClass ~= TF_CLASS_SCOUT then if Solomode then activator:GiveItem("Wood Plank ") else activator:GiveItem("Wood Plank") end else if Solomode then activator:SetAttributeValue("move speed penalty", 0.9) activator:SetAttributeValue("increased jump height", 0.9) activator:SetAttributeValue("no_attack", 1) activator:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "models/weapons/c_models/c_paintrain/c_paintrain.mdl") activator:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "models/weapons/v_models/v_toolbox_engineer.mdl") else activator:SetAttributeValue("move speed penalty", 0.7) activator:SetAttributeValue("increased jump height", 0.7) activator:SetAttributeValue("no_attack", 1) activator:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "models/weapons/c_models/c_paintrain/c_paintrain.mdl") activator:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "models/weapons/v_models/v_toolbox_engineer.mdl") end end activator:Print(3,"You have picked up wood, attack to drop it!") for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram") ) do hologram:ShowTo( activator ) end timer.Simple(0.1, function() for k,v in pairs(ents.FindAllByClass("tf_viewmodel")) do if v.m_hOwner == player then v.m_nSequence = 0 timer.Simple(0.5, function() v.m_nSequence = 1 end) end end end) end activator.bHasWood = true end function ResetWoodTut(_, activator ) if not IsValidAliveRealPlayer( activator ) then return end if activator.bInAttack then return end if not activator.bHasWood then activator.PreviousMelee = activator:GetPlayerItemBySlot(2):GetItemName() if activator.m_iClass ~= TF_CLASS_SCOUT then activator:GiveItem("Wood Plank") else activator:SetAttributeValue("move speed penalty", 0.7) activator:SetAttributeValue("increased jump height", 0.7) activator:SetAttributeValue("no_attack", 1) activator:GetPlayerItemBySlot(2):SetAttributeValue("custom item model", "models/weapons/c_models/c_paintrain/c_paintrain.mdl") activator:GetPlayerItemBySlot(2):SetAttributeValue("custom view model", "models/weapons/v_models/v_toolbox_engineer.mdl") end activator:Print(3,"You have picked up wood, attack to drop it!") for i, hologram in pairs( ents.FindAllByName("Barricade_Hologram_Tut") ) do hologram:ShowTo( activator ) end timer.Simple(0.1, function() for k,v in pairs(ents.FindAllByClass("tf_viewmodel")) do if v.m_hOwner == player then v.m_nSequence = 0 timer.Simple(0.5, function() v.m_nSequence = 1 end) end end end) end activator.bHasWood = true end function Enrage(_, activator) if IsValidAlivePlayers(activator) then activator:TauntFromItem("Taunt: Unleashed Rage") activator:Addcond(TF_COND_DEFENSEBUFF, 2.5) timer.Simple(2.5, function() activator:Removecond(TF_COND_DEFENSEBUFF) activator:Removecond(TF_COND_TAUNTING) activator:Addcond(TF_COND_CRITBOOSTED_USER_BUFF) activator:Addcond(TF_COND_SPEED_BOOST) activator:Addcond(TF_COND_SHIELD_CHARGE, 3) timer.Simple(3, function() activator:Removecond(TF_COND_SHIELD_CHARGE) end) end) end end function ComboPreAttack(_,activator,weapon) util.StartLagCompensation(activator) local Trace = util.Trace({ start = activator:GetAbsOrigin() + Vector(0, 0, 75), mask = MASK_SOLID, distance = 72.5, angles = activator:GetAbsAngles(), filter = activator }) util.FinishLagCompensation(activator) if ( Trace.Hit ) and ( Trace.HitNonWorld ) then activator.ResetDelay = CurTime() + 0.4 end timer.Simple(0.5, function() if activator.ResetDelay <= CurTime() then activator.ComboNumber = 1 end end) end function ComboPunch(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if activator:InCond(34) then activator:AddHealth(15) end if activator.ComboNumber == 2 then timer.Simple(0.01, function() activator:AddCond(34,0.35) end) activator.ComboNumber = -1 end if activator.ComboNumber == nil then activator.ComboNumber = 1 end activator.ComboNumber = activator.ComboNumber + 1 if not caller then activator.ComboNumber = 1 end end function ChristmasPunch(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit util.ParticleEffect("xms_snowburst", caller:GetAbsOrigin() + Vector(0,0,48)) caller:PlaySound("xmas.jingle_noisemaker") if caller:IsPlayer() then for _, player in pairs(ents.FindInSphere(caller:GetAbsOrigin(),128)) do if damage > 300 then if activator.m_iTeamNum ~= player.m_iTeamNum and (player:IsPlayer()) then --not same team player:StunPlayer(6, 0.9, TF_STUNFLAGS_LOSERSTATE, activator) end else if activator.m_iTeamNum ~= player.m_iTeamNum and (player:IsPlayer()) then --not same team player:StunPlayer(3, 0.67, TF_STUNFLAG_SLOWDOWN, activator) end end end end end function GainAmmoOnHit( info, activator, caller ) if not caller:IsValid() then return end if ( not caller:IsBot() ) and ( not caller:IsObject() ) and ( not caller:IsNPC() ) then return end if caller:OnTeam(1) then return end if caller.m_iTeamNum == activator.m_iTeamNum then return end local _, _, amount, max, slot = string.find( info, "(%d+)|(%d+)|(%d+)" ) amount, max, slot = tonumber(amount), tonumber(max), tonumber(slot) local ammo = TF_AMMO_PRIMARY if tonumber(slot) == 0 then ammo = TF_AMMO_PRIMARY max = max * activator:GetPlayerItemBySlot( slot ):GetAttributeValueByClass( "mult_maxammo_primary", 1 ) elseif slot == 1 then ammo = TF_AMMO_SECONDARY max = max * activator:GetPlayerItemBySlot( slot ):GetAttributeValueByClass( "mult_maxammo_secondary", 1 ) elseif slot == -1 then ammo = TF_AMMO_METAL max = max * activator:GetPlayerItemBySlot( slot ):GetAttributeValueByClass( "mult_maxammo_metal", 1 ) end activator.m_iAmmo[ammo] = math.min( activator.m_iAmmo[ammo] + amount, max ) end function AddHype(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if activator.HypeEnable then activator.Hype = math.min(activator.Hype + damage, activator.HypeMax) activator:ShowHudText({channel = 5, y = 0.90, x = 0.74, r1 = 250, r2 = 250, g1 = 250, g2 = 250, b1 = 250, b2 = 250, effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Hype: " .. math.round( ( activator.Hype / activator.HypeMax ) * 100, 2 ) .. "%" ) end end