-- the stuff below is made by Royal -- they deserve a LOT of kudos for everything here local waveActive = false function OnWaveInit() waveActive = false DoublePointsText = "" FireSaleText = "" InstakillText = "" DoublePointsDuration = 0 FireSaleDuration = 0 InstakillDuration = 0 DumpsterCost = 2850 end function OnWaveStart() waveActive = true end function rejuvenatorHit(damage, activator, caller) local damageThreshold = 1 if damage < damageThreshold then return end caller:AddCond(43, 10, activator) timer.Simple(10, function() caller:Suicide() end) end local function cashforhits(activator) local callbacks = {} local function removeCallbacks() for _, callbackId in pairs(callbacks) do activator:RemoveCallback(callbackId) end end callbacks.damagetype = activator:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(_, damageInfo) -- PrintTable(damageInfo) local mult = (DoublePointsDuration > 0) and 2 or 1 local damage = damageInfo.Damage if damage <= 0 then return end local damageType = damageInfo.DamageType local hitter = damageInfo.Attacker if (damageType & DMG_BURN) ~= 0 then return end if (damageType == 1024) then hitter:AddCurrency(1) return end local isCrit = (damageType & DMG_CRITICAL) ~= 0 if isCrit then damage = damage * 3 end local curHealth = activator.m_iHealth if InstakillDuration > 0 and activator.m_szNetname == "Zombie" and hitter:InCond(56) == true then --instakill functionality -washy damage = curHealth activator.m_iHealth = 0 end if damage > curHealth and activator.m_szNetname == "Tank" then -- snuck in here so we don't need a separate function for it hitter:SpeakResponseConcept("TLK_MVM_TANK_DEAD") -- ding dong the tank is dead end if activator.m_szNetname == "Zombie" and hitter.m_szNetname == "Tank" then damage = curHealth activator.m_iHealth = 0 -- if converted zombie is hit by Tank, treat it as Instakill end --local isLethal = curHealth - (damage + 1) <= 0 local function addCurrency(amount) hitter:AddCurrency(amount * mult) end --[[ if not isLethal then ]] addCurrency(10) --[[ return end if IsLethal then addCurrency(75) return end if (damageType & DMG_BLAST) ~= 0 then addCurrency(75) -- used to be 50 -- print("explosive?") elseif (damageType & DMG_MELEE) ~= 0 then addCurrency(150) -- print("melee?") elseif (damageType & DMG_MELEE) == 0 and (damageType & DMG_CRITICAL) ~= 0 then -- this is used for headshots, may overlap with Instakill addCurrency(100) -- print("crit?") elseif (damageType & DMG_BULLET) ~= 0 then addCurrency(75) -- print("bullet?") elseif (damageType & DMG_USE_HITLOCATIONS) ~= 0 then addCurrency(75) -- print("fancier bullet?") else addCurrency(75) -- print("hell if I know") end ]] end) callbacks.killed = activator:AddCallback(ON_DEATH, function(_, damageInfo) -- PrintTable(damageInfo) local mult = (DoublePointsDuration > 0) and 2 or 1 local damage = damageInfo.Damage if damage <= 0 then return end local damageType = damageInfo.DamageType local hitter = damageInfo.Attacker if (damageType & DMG_BURN) ~= 0 then return end local isCrit = (damageType & DMG_CRITICAL) ~= 0 if isCrit then damage = damage * 3 end local curHealth = activator.m_iHealth if InstakillDuration > 0 and activator.m_szNetname == "Zombie" and hitter:InCond(56) == true then --instakill functionality -washy damage = curHealth activator.m_iHealth = 0 end if damage > curHealth and activator.m_szNetname == "Tank" then -- snuck in here so we don't need a separate function for it hitter:SpeakResponseConcept("TLK_MVM_TANK_DEAD") -- ding dong the tank is dead end local function addCurrency(amount) hitter:AddCurrency(amount * mult) end if (damageType & DMG_BLAST) ~= 0 then addCurrency(65) -- used to be 50 -- print("explosive?") elseif (damageType & DMG_MELEE) ~= 0 then addCurrency(140) -- print("melee?") elseif (damageType & DMG_MELEE) == 0 and (damageType & DMG_CRITICAL) ~= 0 then -- this is used for headshots, may overlap with Instakill addCurrency(90) -- print("crit?") elseif (damageType & DMG_BULLET) ~= 0 then addCurrency(65) -- print("bullet?") elseif (damageType & DMG_USE_HITLOCATIONS) ~= 0 then addCurrency(65) -- print("fancier bullet?") else addCurrency(65) -- print("hell if I know") end end) callbacks.spawned = activator:AddCallback(1, function() removeCallbacks() end) callbacks.died = activator:AddCallback(9, function() removeCallbacks() end) end function OnWaveSpawnBot(bot) timer.Simple(1, function() cashforhits(bot) end) end function playertracker(_, activator) -- the only other thing here made by Sntr local callbacks = {} local function removeCallbacks() for _, callbackId in pairs(callbacks) do activator:RemoveCallback(callbackId) end end callbacks.damagetype = activator:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(_, damageInfo) if activator:InCond(5) == true then return end -- disallow friendly fire, allow self damage if damageInfo.Attacker:GetHandleIndex() ~= activator:GetHandleIndex() then if damageInfo.Attacker.m_iTeamNum == activator.m_iTeamNum then return end end local damage = damageInfo.Damage local curHealth = activator.m_iHealth if damage > curHealth and activator:InCond(129) == true then -- give full heal + uber when condition 70 is removed activator:AddCond(5,2.5) activator:AddHealth(300,1) activator:PlaySoundToSelf("misc/halloween/merasmus_stun.wav") activator:RemoveCond(129) activator:RemoveCond(70) -- so people can't be undying forever activator.vm_quickrev = false -- added this for compatibility -washy end end) -- callbacks.output = activator:AddCallback(ON_INPUT, function(_, medicbonus_relay) -- -- local playerclass = activator.m_iClass -- local playercount = math_counter.m_OutValue -- -- if playerclass == 5 -- then -- activator:AddCurrency( playercount * 75 ) -- end -- end) callbacks.spawned = activator:AddCallback(1, function() removeCallbacks() end) end -- and here's the stuff made by Washy -- likewise, plenty of kudos function OnWaveReset() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() and player.loadout then for weapon = 0, 3, 1 do player.loadout[weapon] = "Default" end end end if TextDisplay then timer.Stop(TextDisplay) end end function OnGameTick() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player.m_bUsingActionSlot == 1 and player.InteractCooldown ~= true then player.HoldTime = player.HoldTime + 1 if player.HoldTime > 13 and player.InteractWith ~= "nothing" then Interact(player) player.InteractCooldown = true player.HoldTime = 0 timer.Simple(1, function() player.InteractCooldown = false end) end else player.holdTime = 0 end player:GetUserId() for k, v in pairs(ents.FindByClass("tf_player_manager"):DumpProperties().m_iUserID) do if v == player:GetUserId() then ents.FindByClass("tf_player_manager"):AcceptInput("$SetProp$m_iCurrencyCollected$" .. k-1, player.m_nCurrency) end end if not player.m_nCurrencyDiff then player.m_nCurrencyDiff = 0 end if not player.CashText then player.CashText = 0 end if player.m_nCurrencyDiff ~= player.m_nCurrency then if player.m_nCurrency - player.m_nCurrencyDiff > 0 then player.CashText = 132 player:ShowHudText({channel = 4, x = 0.04, y = 0.91, b1 = 0, b2 = 0}, "+"..player.m_nCurrency - player.m_nCurrencyDiff) else player.CashText = 132 player:ShowHudText({channel = 4, x = 0.04, y = 0.91, g1 = 25, g2 = 25, b1 = 0, b2 = 0,}, player.m_nCurrency - player.m_nCurrencyDiff) end end player.m_nCurrencyDiff = player.m_nCurrency player.CashText = player.CashText - 1 if player.CashText == 0 then player:ShowHudText({channel = 4}, "") end end end if DoublePointsDuration > 0 then DoublePointsDuration = DoublePointsDuration - 1 DoublePointsText = "Double Points: ".. math.floor(DoublePointsDuration/66+1) else DoublePointsText = "" end if FireSaleDuration > 0 then FireSaleDuration = FireSaleDuration - 1 FireSaleText = "Fire Sale: ".. math.floor(FireSaleDuration/66+1) else FireSaleText = "" end if InstakillDuration > 0 then InstakillDuration = InstakillDuration - 1 InstakillText = "Instakill: ".. math.floor(InstakillDuration/66+1) else InstakillText = "" end end function ShuffleInPlace(t) --copied from stack overflow for i = #t, 2, -1 do local j = math.random(i) t[i], t[j] = t[j], t[i] end end function OnWaveStart() BoxTable = {} waveActive = true DumpsterRoulette = {1,2,3,4,5} DumpsterRouletteIndex = 1 PowerupTable = {[1] = "DoublePoints", [2] = "FireSale", [3] = "Instakill", [4] = "Nuke", [5] = "MaxAmmo", [6] = "BonusPoints"} PowerupTableIndex = 1 ShuffleInPlace(DumpsterRoulette) ShuffleInPlace(PowerupTable) for box = 1, 5, 1 do ents.FindByName("dumpster_spawner"..box):Teleport(ents.FindByName("dumpster_tele_out"):GetAbsOrigin()) ents.FindByName("dumpster_spawner"..box):AcceptInput("ForceSpawn") BoxTable[box] = {message = 0, weapon = "", text = "", slot = "", response = "", firesale = false, dud = true, timer = 0, count = 0, spawned = false, opened = false} end SpawnDumpsterBox(DumpsterRoulette[DumpsterRouletteIndex]) timer.Simple(0.5,function() -- ents.FindByName("vm_jugmsg"):AddCallback(ON_START_TOUCH, -- function(_, player) -- if player:IsRealPlayer() and player.m_nCurrency >= 2500 then -- player.InteractWith = "vm_jugbutton" -- end -- end) -- ents.FindByName("vm_jugmsg"):AddCallback(ON_END_TOUCH, -- function(_, player) -- if player:IsRealPlayer() then -- player.InteractWith = "nothing" -- player:Print(2,"") -- end -- end) -- ents.FindByName("vm_quickrevmsg"):AddCallback(ON_START_TOUCH, -- function(_, player) -- if player:IsRealPlayer() and player.m_nCurrency >= 1500 then -- player.InteractWith = "vm_quickrevbutton" -- end -- end) -- ents.FindByName("vm_quickrevmsg"):AddCallback(ON_END_TOUCH, -- function(_, player) -- if player:IsRealPlayer() then -- player.InteractWith = "nothing" -- player:Print(2,"") -- end -- end) -- ents.FindByName("vm_speedmsg"):AddCallback(ON_START_TOUCH, -- function(_, player) -- if player:IsRealPlayer() and player.m_nCurrency >= 3000 then -- player.InteractWith = "vm_speedbutton" -- end -- end) -- ents.FindByName("vm_speedmsg"):AddCallback(ON_END_TOUCH, -- function(_, player) -- if player:IsRealPlayer() then -- player.InteractWith = "nothing" -- player:Print(2,"") -- end -- end) -- ents.FindByName("vm_blastermsg"):AddCallback(ON_START_TOUCH, -- function(_, player) -- if player:IsRealPlayer() and player.m_nCurrency >= 1500 then -- player.InteractWith = "vm_blasterbutton" -- end -- end) -- ents.FindByName("vm_blastermsg"):AddCallback(ON_END_TOUCH, -- function(_, player) -- if player:IsRealPlayer() then -- player.InteractWith = "nothing" -- player:Print(2,"") -- end -- end) -- ents.FindByName("vm_dtmsg"):AddCallback(ON_START_TOUCH, -- function(_, player) -- if player:IsRealPlayer() and player.m_nCurrency >= 2000 then -- player.InteractWith = "vm_dtbutton" -- end -- end) -- ents.FindByName("vm_dtmsg"):AddCallback(ON_END_TOUCH, -- function(_, player) -- if player:IsRealPlayer() then -- player.InteractWith = "nothing" -- player:Print(2,"") -- end -- end) end) TextDisplay = timer.Create(1, function() ents.FindByName("poweruptext"):AcceptInput("$SetKey$message",FireSaleText .. "\n" ..InstakillText .. "\n" ..DoublePointsText) ents.FindByName("poweruptext"):AcceptInput("Display") ents.FindByName("enemytext"):AcceptInput("Display") ents.FindByName("roundtext"):AcceptInput("Display") end, 0) end function Interact(player) if player.InteractWith == "dumpsterbutton1" and player.m_nCurrency >= DumpsterCost and ents.FindByName("dumpster_light1").m_On == false then OpenDumpsterBox(player, 1) player.m_nCurrency = player.m_nCurrency - DumpsterCost elseif player.InteractWith == "tradeweapon1" then DumpsterBoxTakeWeapon(player, 1) elseif player.InteractWith == "dumpsterbutton2" and player.m_nCurrency >= DumpsterCost and ents.FindByName("dumpster_light2").m_On == false then OpenDumpsterBox(player, 2) player.m_nCurrency = player.m_nCurrency - DumpsterCost elseif player.InteractWith == "tradeweapon2" then DumpsterBoxTakeWeapon(player, 2) elseif player.InteractWith == "dumpsterbutton3" and player.m_nCurrency >= DumpsterCost and ents.FindByName("dumpster_light3").m_On == false then OpenDumpsterBox(player, 3) player.m_nCurrency = player.m_nCurrency - DumpsterCost elseif player.InteractWith == "tradeweapon3" then DumpsterBoxTakeWeapon(player, 3) elseif player.InteractWith == "dumpsterbutton4" and player.m_nCurrency >= DumpsterCost and ents.FindByName("dumpster_light4").m_On == false then OpenDumpsterBox(player, 4) player.m_nCurrency = player.m_nCurrency - DumpsterCost elseif player.InteractWith == "tradeweapon4" then DumpsterBoxTakeWeapon(player, 4) elseif player.InteractWith == "dumpsterbutton5" and player.m_nCurrency >= DumpsterCost and ents.FindByName("dumpster_light5").m_On == false then OpenDumpsterBox(player, 5) player.m_nCurrency = player.m_nCurrency - DumpsterCost elseif player.InteractWith == "tradeweapon5" then DumpsterBoxTakeWeapon(player, 5) end end function PlayViewmodelSequence(player) for k,v in pairs(ents.FindAllByClass("tf_viewmodel")) do if v.m_hOwner == player then local PreviousPrimary = player:GetPlayerItemBySlot(0) local PreviousSecondary = player:GetPlayerItemBySlot(1) if player:GetPlayerItemBySlot(0) ~= nil then PreviousPrimary = player:GetPlayerItemBySlot(0):GetItemName() end if player:GetPlayerItemBySlot(1) ~= nil then PreviousSecondary = player:GetPlayerItemBySlot(1):GetItemName() if player:GetPlayerItemBySlot(1).m_flChargeLevel ~= nil then PreviousUbercharge = player:GetPlayerItemBySlot(1).m_flChargeLevel end end local PreviousMelee = player:GetPlayerItemBySlot(2):GetItemName() player:WeaponStripSlot(0) player:WeaponStripSlot(2) player:GiveItem("Bonk! Atomic Punch") player:WeaponSwitchSlot(1) v.m_flPlaybackRate = 0.8 if player.m_iClass == 1 then v.m_nSequence = 41 elseif player.m_iClass == 2 then v.m_nSequence = 34 elseif player.m_iClass == 3 then v.m_nSequence = 52 elseif player.m_iClass == 4 then v.m_nSequence = 34 elseif player.m_iClass == 5 then v.m_nSequence = 23 elseif player.m_iClass == 6 then v.m_nSequence = 32 elseif player.m_iClass == 7 then v.m_nSequence = 29 elseif player.m_iClass == 8 then v.m_nSequence = 23 elseif player.m_iClass == 9 then --spy skipped v.m_nSequence = 52 end timer.Simple(2.2, function() player:WeaponStripSlot(1) if PreviousPrimary ~= nil then player:GiveItem(PreviousPrimary) end if PreviousSecondary ~= nil then player:GiveItem(PreviousSecondary) if player:GetPlayerItemBySlot(1).m_flChargeLevel ~= nil then player:GetPlayerItemBySlot(1).m_flChargeLevel = PreviousUbercharge end end player:GiveItem(PreviousMelee) end) end end end function DropPowerup(player) ents.FindByName(PowerupTable[PowerupTableIndex] .. "_spawner"):Teleport(player:GetAbsOrigin()) ents.FindByName(PowerupTable[PowerupTableIndex] .. "_spawner"):AcceptInput("ForceSpawn") if PowerupTableIndex == 6 then ShuffleInPlace(PowerupTable) PowerupTableIndex = 0 end PowerupTableIndex = PowerupTableIndex + 1 end function ActivateDoublePoints() DoublePointsDuration = 1980 -- 1980 ticks divided by 66 tick rate = 30 seconds for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Double Points!") player:PlaySoundToSelf("shadows/powerup_doublepoints.mp3") player:PlaySoundToSelf("ui/quest_status_tick_advanced.wav") end end end function ActivateFireSale() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:Print(2,"Fire Sale!") player:PlaySoundToSelf("shadows/powerup_firesale01.mp3") player:PlaySoundToSelf("mvm/mvm_bought_upgrade.wav") if FireSaleDuration <= 0 then timer.Simple(1,function() ents.FindByName("firesale_music"):AcceptInput("PlaySound") end) end end end FireSaleDuration = FireSaleDuration + 1980 -- 1980 ticks divided by 66 tick rate = 30 seconds DumpsterCost = 30 for box = 1, 5, 1 do if BoxTable[box].spawned == false then SpawnDumpsterBox(box) end BoxTable[box].firesale = true BoxTable[box].dud = false end BoxTable[DumpsterRouletteIndex].firesale = false timer.Create(1, function() if FireSaleDuration <= 0 then DumpsterCost = 2850 for box = 1, 5, 1 do if BoxTable[box].firesale == true and BoxTable[box].opened == false then ents.FindByName("dumpster_warp_eff"..box):AcceptInput("Start") ents.FindByName("dumpster_warp_beam"..box):AcceptInput("Stop") ents.FindByName("dumpster_disappear"..box):AcceptInput("PlaySound") timer.Simple(1, function() ents.FindByName("dumpster_prop"..box):AcceptInput("$TeleportToEntity","dumpster_tele_out") end) timer.Simple(1, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") end) BoxTable[box].spawned = false BoxTable[DumpsterRouletteIndex].dud = true end end return false end end, 0) end BoxRoulette = { [5] = { {text = "The Scattergun", itemname = "TF_WEAPON_SCATTERGUN", model = "models/weapons/w_models/w_scattergun.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Sketchy Boomstick", itemname = "Sketchy Boomstick", model = "models/weapons/c_models/c_scattergun/c_scattergun_xmas.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Flamethrower", itemname = "TF_WEAPON_FLAMETHROWER", model = "models/weapons/c_models/c_flamethrower/c_flamethrower.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Oily Fire", itemname = "Oily Fire", model = "models/workshop/weapons/c_models/c_degreaser/c_degreaser.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Punch Packer", itemname = "The Punch Packer", model = "models/weapons/c_models/c_packer.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Unstable Payload", itemname = "Unstable Payload", model = "models/weapons/c_models/c_grenadelauncher/c_grenadelauncher_xmas.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Tetanus Slice", itemname = "Tetanus Slice", model = "models/weapons/c_models/c_bonesaw/c_bonesaw_xmas.mdl", slot = "melee", response = "TLK_MVM_LOOT_ULTRARARE"}, {text = "The SMG", itemname = "Primary SMG", model = "models/weapons/w_models/w_smg.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Crusader's Crossbow", itemname = "The Crusader's Crossbow", model = "models/weapons/c_models/c_crusaders_crossbow/c_crusaders_crossbow.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The Crusader's Crossbow", itemname = "The Crusader's Crossbow", model = "models/weapons/c_models/c_crusaders_crossbow/c_crusaders_crossbow.mdl", slot = "primary", response = "TLK_MVM_LOOT_COMMON"}, {text = "The DNA Rejuvenator", itemname = "DNA Rejuvenator", model = "models/workshop/weapons/c_models/c_uberneedle/c_uberneedle.mdl", slot = "melee", response = "TLK_MVM_LOOT_ULTRARARE"}, {text = "The Black Box", itemname = "The Black Box", model = "models/workshop/weapons/c_models/c_blackbox/c_blackbox.mdl", slot = "primary", response = "TLK_MVM_LOOT_RARE"}, {text = "Das Maschinenpistole", itemname = "Das Maschinenpistole", model = "models/weapons/c_models/c_mp40/c_mp40.mdl", slot = "primary", response = "TLK_MVM_LOOT_RARE"}, {text = "a dud", itemname = "Dud", model = "models/workshop/weapons/c_models/c_invasion_pistol/c_invasion_pistol.mdl"}, }, } function SpawnDumpsterBox(box) if FireSaleDuration <= 0 then BoxTable[box].firesale = false BoxTable[box].dud = true end if BoxTable[box].spawned == false then BoxTable[box].spawned = true ents.FindByName("dumpster_push"..box):AcceptInput("$TeleportToEntity","dumpster_tele_"..box) ents.FindByName("dumpster_push"..box):AcceptInput("Enable") ents.FindByName("dumpster_lid"..box):AcceptInput("TurnOff") ents.FindByName("dumpster_weapon"..box):AcceptInput("TurnOff") ents.FindByName("dumpster_prop"..box):AcceptInput("TurnOff") ents.FindByName("dumpster_light"..box):AcceptInput("TurnOff") ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") ents.FindByName("dumpster_weapon"..box):AcceptInput("SetParent","dumpster_train"..box) timer.Simple(1, function() ents.FindByName("dumpster_prop"..box):AcceptInput("$TeleportToEntity","dumpster_tele_"..box) end) timer.Simple(1, function() ents.FindByName("dumpster_warp_eff"..box):AcceptInput("Start") end) timer.Simple(1, function() ents.FindByName("dumpster_warp_beam"..box):AcceptInput("Start") end) timer.Simple(1.5, function() ents.FindByName("dumpster_appear"..box):AcceptInput("PlaySound") end) timer.Simple(2, function() ents.FindByName("dumpster_lid"..box):AcceptInput("TurnOn") end) timer.Simple(2, function() ents.FindByName("dumpster_prop"..box):AcceptInput("TurnOn") end) timer.Simple(2, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Enable") end) timer.Simple(2, function() ents.FindByName("dumpster_push"..box):AcceptInput("Disable") end) timer.Simple(3.2, function() ents.FindByName("dumpster_warp_eff"..box):AcceptInput("Stop") end) BoxTable[box].message = ents.FindByName("dumpster_msg"..box):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "dumpsterbutton"..box player:Print(2,"Hold Action key to receive a weapon for $"..DumpsterCost) end end) ents.FindByName("dumpster_msg"..box):AddCallback(ON_END_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "nothing" player:Print(2,"") end end) end end function OpenDumpsterBox(player, box) local owner = player BoxTable[box].count = BoxTable[box].count + 1 BoxTable[box].opened = true ents.FindByName("dumpster_rotdoor"..box):AcceptInput("Open") ents.FindByName("dumpster_light"..box):AcceptInput("TurnOn") ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") ents.FindByName("dumpster_train"..box):AcceptInput("SetSpeed", "0.2") ents.FindByName("dumpster_jingle"..box):AcceptInput("PlaySound") ents.FindByName("dumpster_weapon"..box):AcceptInput("Enable") ents.FindByName("dumpster_particles"..box):AcceptInput("Start") ents.FindByName("dumpster_train"..box):AcceptInput("TeleportToPathTrack", "dumpster_track1"..box) ents.FindByName("dumpster_msg"..box):RemoveCallback(14,BoxTable[box].message) local ChangeWeapon = timer.Create(0.1, function() local number = math.random(1, #BoxRoulette[player.m_iClass]) ents.FindByName("dumpster_weapon"..box):AcceptInput("$SetModel", BoxRoulette[player.m_iClass][number].model) BoxTable[box].weapon = BoxRoulette[player.m_iClass][number].itemname BoxTable[box].text = BoxRoulette[player.m_iClass][number].text BoxTable[box].slot = BoxRoulette[player.m_iClass][number].slot BoxTable[box].response = BoxRoulette[player.m_iClass][number].response end, 0 ) timer.Simple(4, function() timer.Stop(ChangeWeapon) if BoxTable[box].weapon == "Dud" then if BoxTable[box].dud == true and BoxTable[box].firesale == false and BoxTable[box].count >= 4 then BoxTable[box].count = 0 if DumpsterRouletteIndex == 5 then ShuffleInPlace(DumpsterRoulette) DumpsterRouletteIndex = 0 end DumpsterRouletteIndex = DumpsterRouletteIndex+1 ents.FindByName("dumpster_dudprop"..box):AcceptInput("Enable") ents.FindByName("dumpster_weapon"..box):AcceptInput("Disable") player:AddCurrency("2850") player:PlaySoundToSelf("misc/happy_birthday_tf_10.wav") timer.Simple(1, function() player:PlaySoundToSelf("shadows/powerup_dud_03.mp3") end) timer.Simple(3, function() ents.FindByName("dumpster_warp_eff"..box):AcceptInput("Start") end) timer.Simple(3, function() ents.FindByName("dumpster_warp_beam"..box):AcceptInput("Stop") end) timer.Simple(3, function() ents.FindByName("dumpster_disappear"..box):AcceptInput("PlaySound") end) timer.Simple(4, function() ents.FindByName("dumpster_prop"..box):AcceptInput("$TeleportToEntity","dumpster_tele_out") end) timer.Simple(4, function() ents.FindByName("dumpster_dudprop"..box):AcceptInput("Disable") end) timer.Simple(4, function() BoxTable[box].spawned = false end) timer.Simple(24, function() SpawnDumpsterBox(DumpsterRouletteIndex) end) else number = math.random(1, #BoxRoulette[player.m_iClass]-1) ents.FindByName("dumpster_weapon"..box):AcceptInput("$SetModel", BoxRoulette[player.m_iClass][number].model) BoxTable[box].weapon = BoxRoulette[player.m_iClass][number].itemname BoxTable[box].text = BoxRoulette[player.m_iClass][number].text BoxTable[box].slot = BoxRoulette[player.m_iClass][number].slot BoxTable[box].response = BoxRoulette[player.m_iClass][number].response BoxTable[box].message = ents.FindByName("dumpster_msg"..box):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() and player == owner then player.InteractWith = "tradeweapon"..box player:Print(2,"Hold Action key to trade your " .. BoxTable[box].slot .. " weapon with " .. BoxTable[box].text) end end) ents.FindByName("dumpster_msg"..box):AcceptInput("Enable") ents.FindByName("dumpster_train"..box):AcceptInput("TeleportToPathTrack", "dumpster_track2"..box) ents.FindByName("dumpster_train"..box):AcceptInput("SetSpeedDir", "0.02") end elseif BoxTable[box].weapon == "Thunder Gun" and ThunderGunTaken == true then ents.FindByName("dumpster_weapon"..box):AcceptInput("$SetModel", "models/weapons/c_models/c_shotfun/c_shotfun.mdl") BoxTable[box].weapon = "Double Barrel" BoxTable[box].text = "The Double Barrel" BoxTable[box].slot = "secondary" BoxTable[box].response = "TLK_MVM_LOOT_COMMON" elseif BoxTable[box].weapon == "DNA Rejuvenator" and RejuvenatorTaken == true then ents.FindByName("dumpster_weapon"..box):AcceptInput("$SetModel", "models/weapons/w_models/w_smg.mdl") BoxTable[box].weapon = "Primary SMG" BoxTable[box].text = "The SMG" BoxTable[box].slot = "primary" BoxTable[box].response = "TLK_MVM_LOOT_COMMON" BoxTable[box].message = ents.FindByName("dumpster_msg"..box):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() and player == owner then player.InteractWith = "tradeweapon"..box player:Print(2,"Hold Action key to trade your " .. BoxTable[box].slot .. " weapon with " .. BoxTable[box].text) end end) else BoxTable[box].message = ents.FindByName("dumpster_msg"..box):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() and player == owner then player.InteractWith = "tradeweapon"..box player:Print(2,"Hold Action key to trade your " .. BoxTable[box].slot .. " weapon with " .. BoxTable[box].text) end end) ents.FindByName("dumpster_msg"..box):AcceptInput("Enable") ents.FindByName("dumpster_train"..box):AcceptInput("TeleportToPathTrack", "dumpster_track2"..box) ents.FindByName("dumpster_train"..box):AcceptInput("SetSpeedDir", "0.02") end end) BoxTable[box].timer = timer.Simple(14, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") ents.FindByName("dumpster_msg"..box):RemoveCallback(14,BoxTable[box].message) BoxTable[box].message = ents.FindByName("dumpster_msg"..box):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "dumpsterbutton"..box player:Print(2,"Hold Action key to receive a weapon for $"..DumpsterCost) end end) timer.Simple(1, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Enable") end) timer.Simple(1, function() BoxTable[box].opened = false end) ents.FindByName("dumpster_rotdoor"..box):AcceptInput("Close") ents.FindByName("dumpster_particles"..box):AcceptInput("Stop") ents.FindByName("dumpster_light"..box):AcceptInput("TurnOff") ents.FindByName("dumpster_weapon"..box):AcceptInput("Disable") if BoxTable[box].firesale == true and FireSaleDuration <= 0 then ents.FindByName("dumpster_warp_eff"..box):AcceptInput("Start") ents.FindByName("dumpster_warp_beam"..box):AcceptInput("Stop") ents.FindByName("dumpster_disappear"..box):AcceptInput("PlaySound") timer.Simple(1, function() ents.FindByName("dumpster_prop"..box):AcceptInput("$TeleportToEntity","dumpster_tele_out") end) timer.Simple(1, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") end) BoxTable[box].spawned = false end end) end function DumpsterBoxTakeWeapon(player, box) ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") ents.FindByName("dumpster_particles"..box):AcceptInput("Stop") ents.FindByName("dumpster_rotdoor"..box):AcceptInput("Close") ents.FindByName("dumpster_light"..box):AcceptInput("TurnOff") ents.FindByName("dumpster_weapon"..box):AcceptInput("Disable") player:GiveItem(BoxTable[box].weapon) if BoxTable[box].weapon == "Thunder Gun" then ThunderGunTaken = true end if BoxTable[box].weapon == "DNA Rejuvenator" then RejuvenatorTaken = true end -- nuh uh you get only one of these like tgun if BoxTable[box].slot == "primary" then player.loadout[0] = BoxTable[box].weapon end if BoxTable[box].slot == "secondary" then player.loadout[1] = BoxTable[box].weapon end if BoxTable[box].slot == "melee" then player.loadout[2] = BoxTable[box].weapon end -- this line is for a single weapon :^) player:RefillAmmo() player:SpeakResponseConcept(BoxTable[box].response, 0.6) player:PlaySoundToSelf("items/gunpickup2.wav") player:DisplayTextChat("You've received: " .. BoxTable[box].text .. "!") timer.Stop(BoxTable[box].timer) ents.FindByName("dumpster_msg"..box):RemoveCallback(14,BoxTable[box].message) BoxTable[box].message = ents.FindByName("dumpster_msg"..box):AddCallback(ON_START_TOUCH, function(_, player) if player:IsRealPlayer() then player.InteractWith = "dumpsterbutton"..box player:Print(2,"Hold Action key to receive a weapon for $"..DumpsterCost) end end) timer.Simple(1, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Enable") end) timer.Simple(1, function() BoxTable[box].opened = false end) if BoxTable[box].firesale == true and FireSaleDuration <= 0 then ents.FindByName("dumpster_warp_eff"..box):AcceptInput("Start") ents.FindByName("dumpster_warp_beam"..box):AcceptInput("Stop") ents.FindByName("dumpster_disappear"..box):AcceptInput("PlaySound") timer.Simple(1, function() ents.FindByName("dumpster_prop"..box):AcceptInput("$TeleportToEntity","dumpster_tele_out") end) timer.Simple(1, function() ents.FindByName("dumpster_msg"..box):AcceptInput("Disable") end) BoxTable[box].spawned = false end end function GiveSuperShank(_,player) player:GiveItem("Super Shank") player.loadout[2] = "Super Shank" end 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, } function OnPlayerConnected(player) if player:IsRealPlayer() then player.HoldTime = 0 player.InteractWith = "nothing" player.InteractCooldown = false player.loadout = {[0] = "Default", [1] = "Default", [2] = "Default"} player.m_nCurrencyDiff = 0 player:AddCallback(ON_SPAWN, function(player) if player:IsRealPlayer() then if CHEATERS[player.m_szNetworkIDString] then player:Kill() end end end) player:AddCallback(ON_SPAWN, function() for weapon = 0, 3, 1 do if player.loadout[weapon] ~= "Default" then player:GiveItem(player.loadout[weapon]) end end end) else player:AddCallback(ON_DEATH, function() local number = math.random(1,100) if number <= 3 then -- 3% chance DropPowerup(player) end end); end end