Guest User

Untitled

a guest
Dec 22nd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.20 KB | None | 0 0
  1.             --This Hook controls everything. When the contract is done, the Assassin gets his reward. When he was supported, he will fail.--
  2.             hook.Add("PlayerDeath", "TemplarDeath", function(victim, inflictor, attacker)
  3.                 if ( victim == ChosenTemplar ) and ( attacker == ply ) then
  4.                     net.Start("ACPSuccessMessage")
  5.                     net.WriteEntity( ChosenTemplar )
  6.                     net.Send( ply )
  7.  
  8.                     ply:SetWalkSpeed(250)
  9.                     ply:SetJumpPower(200)
  10.                     ply:SetHealth(140)
  11.  
  12.                     if ( CreedEagleScreamActive:GetBool() ) then
  13.                         ply:EmitSound("eaglescream.wav")
  14.                     end
  15.  
  16.                     ply:SetNWBool("CreedDisguise", false)
  17.  
  18.                     if ( CreedThemeActive:GetBool() ) then
  19.                         creed_sound:Stop()
  20.                     end
  21.  
  22.                     for _, g in pairs(player.GetAll()) do
  23.                         if g:HasEquipmentItem("item_ttt_the_assassin") then
  24.                             return
  25.                         else
  26.                             g:ScreenFade( SCREENFADE.OUT, Color(255, 255, 255), 0.1, 2)
  27.                         end
  28.                     end
  29.  
  30.                     local spawnpointofmap = {}
  31.  
  32.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_start"))
  33.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_deathmatch"))
  34.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_combine"))
  35.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_rebel"))
  36.  
  37.                     -- CS Maps
  38.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_counterterrorist"))
  39.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_terrorist"))
  40.  
  41.                     -- DOD Maps
  42.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_axis"))
  43.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_allies"))
  44.  
  45.                     -- (Old) GMod Maps
  46.                     spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("gmod_player_start"))
  47.  
  48.                     if spawnpointofmap and #spawnpointofmap > 0 then
  49.                         ply:SetPos(spawnpointofmap[math.random(1, #spawnpointofmap)]:GetPos())
  50.                     end
  51.  
  52.                     CreedBroadcast("Anonymous Creed: ", Color(255, 114, 86), "The Assassin disappeared. There´s no trace of him. He fulfilled his contract. The Game goes on!")
  53.  
  54.                     hook.Remove("TemplarDeath")
  55.  
  56.                     timer.Create("LetACrespawn", 1, 600, function()
  57.                         if ply:Health() < 15 then
  58.                             ply:SetHealth(110)
  59.  
  60.                             if spawnpointofmap and #spawnpointofmap > 0 then
  61.                                 ply:SetPos(spawnpointofmap[math.random(1, #spawnpointofmap)]:GetPos())
  62.                                 timer.Remove("LetACrespawn")
  63.                             end
  64.                         end
  65.                     end)
  66.  
  67.                 -- TODO!
  68.                 elseif victim == ChosenTemplar and attacker:GetTeam() == TEAM_TRAITOR and attacker ~= ply then
  69.                     CreedBroadcast("Anonymous Creed: ", Color(153, 0, 0), "The treacherous Assassin ", Color(255, 255, 000), ply:Nick(), Color(153, 0, 0), " was support by a Traitor called ", Color(255, 255, 000), attacker:Nick(), Color(153, 0, 0), ". You can kill them!")
  70.  
  71.                     ply:SetWalkSpeed(250)
  72.                     ply:SetJumpPower(200)
  73.                     ply:SetHealth(100)
  74.                     ply:SetNWBool("CreedDisguise", false)
  75.  
  76.                     hook.Remove("TemplarDeath")
  77.  
  78.                     if CreedThemeActive:GetBool() then
  79.                         creed_sound:Stop()
  80.                     end
  81.  
  82.                 elseif victim == ChosenTemplar and attacker ~= ply and not attacker:GetTeam() == TEAM_TRAITOR and not attacker:IsWorld() and victim ~= attacker then
  83.                     if ply:HasEquipmentItem("item_ttt_the_assassin") then
  84.                         net.Start("ACPUninitiatedMessage")
  85.                         net.WriteEntity( ChosenTemplar )
  86.                         net.Send( ply )
  87.                     end
  88.  
  89.                     ply:SetWalkSpeed(250)
  90.                     ply:SetJumpPower(200)
  91.                     ply:SetHealth(180)
  92.                     ply:SetNWBool("CreedDisguise", false)
  93.  
  94.                     hook.Remove("TemplarDeath")
  95.  
  96.                     if CreedThemeActive:GetBool() then
  97.                         creed_sound:Stop()
  98.                     end
  99.  
  100.                 elseif victim == ChosenTemplar and victim == attacker or attacker:IsWorld() then
  101.                     net.Start("ACPassAwayMessage")
  102.                     net.WriteEntity( ChosenTemplar )
  103.                     net.Send( ply )
  104.  
  105.                     ply:SetWalkSpeed(250)
  106.                     ply:SetJumpPower(200)
  107.                     ply:SetHealth(180)
  108.                     ply:SetNWBool("CreedDisguise", false)
  109.  
  110.                     hook.Remove("TemplarDeath")
  111.  
  112.                     if CreedThemeActive:GetBool() then
  113.                         creed_sound:Stop()
  114.                     end
  115.                 else
  116.                     return
  117.                 end
  118.             end)
  119.  
  120.             --The Assassin fails. He gets revealed and he loses his advantages--
  121.             timer.Create("ClockIsTicking", 150, 1, function()
  122.                 if ChosenTemplar:Alive() then
  123.                     CreedBroadcast("Anonymous Creed: ", Color(153, 0, 0), "The Assassin ", Color(255, 255, 000), ply:Nick(), Color(153, 0, 0), " has failed. You can kill him. He isn´t one of us anymore!")
  124.  
  125.                     ply:SetWalkSpeed(250)
  126.                     ply:SetJumpPower(200)
  127.                     ply:SetHealth(100)
  128.                     ply:SetNWBool("CreedDisguise", false)
  129.  
  130.                     hook.Remove("TemplarDeath")
  131.  
  132.                     if CreedThemeActive:GetBool() then
  133.                         creed_sound:Stop()
  134.                     end
  135.                 end
  136.             end)
  137.  
  138.             --When the Assassin dies, the Timer and Hook above shall be removed--
  139.             hook.Add("PlayerDeath", "AssassinDies", function( victim, inflictor, attacker )
  140.                 if victim == ply then
  141.                     timer.Remove("ClockIsTicking")
  142.  
  143.                     hook.Remove("TemplarDeath")
  144.  
  145.                     if CreedThemeActive:GetBool() then
  146.                         creed_sound:Stop()
  147.                     end
  148.                 end
  149.             end)    
  150.         end)
  151.     end
  152.  
  153.     hook.Add("TTTEndRound", "ResettheStuff", function()
  154.         hook.Remove("TemplarDeath")
  155.         hook.Remove("AssassinDies")
  156.         timer.Remove("ClockIsTicking")
  157.     end)
Advertisement
Add Comment
Please, Sign In to add comment