Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This Hook controls everything. When the contract is done, the Assassin gets his reward. When he was supported, he will fail.--
- hook.Add("PlayerDeath", "TemplarDeath", function(victim, inflictor, attacker)
- if ( victim == ChosenTemplar ) and ( attacker == ply ) then
- net.Start("ACPSuccessMessage")
- net.WriteEntity( ChosenTemplar )
- net.Send( ply )
- ply:SetWalkSpeed(250)
- ply:SetJumpPower(200)
- ply:SetHealth(140)
- if ( CreedEagleScreamActive:GetBool() ) then
- ply:EmitSound("eaglescream.wav")
- end
- ply:SetNWBool("CreedDisguise", false)
- if ( CreedThemeActive:GetBool() ) then
- creed_sound:Stop()
- end
- for _, g in pairs(player.GetAll()) do
- if g:HasEquipmentItem("item_ttt_the_assassin") then
- return
- else
- g:ScreenFade( SCREENFADE.OUT, Color(255, 255, 255), 0.1, 2)
- end
- end
- local spawnpointofmap = {}
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_start"))
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_deathmatch"))
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_combine"))
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_rebel"))
- -- CS Maps
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_counterterrorist"))
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_terrorist"))
- -- DOD Maps
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_axis"))
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("info_player_allies"))
- -- (Old) GMod Maps
- spawnpointofmap = table.Add(spawnpointofmap, ents.FindByClass("gmod_player_start"))
- if spawnpointofmap and #spawnpointofmap > 0 then
- ply:SetPos(spawnpointofmap[math.random(1, #spawnpointofmap)]:GetPos())
- end
- CreedBroadcast("Anonymous Creed: ", Color(255, 114, 86), "The Assassin disappeared. There´s no trace of him. He fulfilled his contract. The Game goes on!")
- hook.Remove("TemplarDeath")
- timer.Create("LetACrespawn", 1, 600, function()
- if ply:Health() < 15 then
- ply:SetHealth(110)
- if spawnpointofmap and #spawnpointofmap > 0 then
- ply:SetPos(spawnpointofmap[math.random(1, #spawnpointofmap)]:GetPos())
- timer.Remove("LetACrespawn")
- end
- end
- end)
- -- TODO!
- elseif victim == ChosenTemplar and attacker:GetTeam() == TEAM_TRAITOR and attacker ~= ply then
- 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!")
- ply:SetWalkSpeed(250)
- ply:SetJumpPower(200)
- ply:SetHealth(100)
- ply:SetNWBool("CreedDisguise", false)
- hook.Remove("TemplarDeath")
- if CreedThemeActive:GetBool() then
- creed_sound:Stop()
- end
- elseif victim == ChosenTemplar and attacker ~= ply and not attacker:GetTeam() == TEAM_TRAITOR and not attacker:IsWorld() and victim ~= attacker then
- if ply:HasEquipmentItem("item_ttt_the_assassin") then
- net.Start("ACPUninitiatedMessage")
- net.WriteEntity( ChosenTemplar )
- net.Send( ply )
- end
- ply:SetWalkSpeed(250)
- ply:SetJumpPower(200)
- ply:SetHealth(180)
- ply:SetNWBool("CreedDisguise", false)
- hook.Remove("TemplarDeath")
- if CreedThemeActive:GetBool() then
- creed_sound:Stop()
- end
- elseif victim == ChosenTemplar and victim == attacker or attacker:IsWorld() then
- net.Start("ACPassAwayMessage")
- net.WriteEntity( ChosenTemplar )
- net.Send( ply )
- ply:SetWalkSpeed(250)
- ply:SetJumpPower(200)
- ply:SetHealth(180)
- ply:SetNWBool("CreedDisguise", false)
- hook.Remove("TemplarDeath")
- if CreedThemeActive:GetBool() then
- creed_sound:Stop()
- end
- else
- return
- end
- end)
- --The Assassin fails. He gets revealed and he loses his advantages--
- timer.Create("ClockIsTicking", 150, 1, function()
- if ChosenTemplar:Alive() then
- 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!")
- ply:SetWalkSpeed(250)
- ply:SetJumpPower(200)
- ply:SetHealth(100)
- ply:SetNWBool("CreedDisguise", false)
- hook.Remove("TemplarDeath")
- if CreedThemeActive:GetBool() then
- creed_sound:Stop()
- end
- end
- end)
- --When the Assassin dies, the Timer and Hook above shall be removed--
- hook.Add("PlayerDeath", "AssassinDies", function( victim, inflictor, attacker )
- if victim == ply then
- timer.Remove("ClockIsTicking")
- hook.Remove("TemplarDeath")
- if CreedThemeActive:GetBool() then
- creed_sound:Stop()
- end
- end
- end)
- end)
- end
- hook.Add("TTTEndRound", "ResettheStuff", function()
- hook.Remove("TemplarDeath")
- hook.Remove("AssassinDies")
- timer.Remove("ClockIsTicking")
- end)
Advertisement
Add Comment
Please, Sign In to add comment