Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1.     function HailTheKing()
  2.         local _PlayersDI = {}
  3.         for _, v in pairs(player.GetAll()) do
  4.             if ( v:GetRole() == ROLE_DETECTIVE and v:Alive() ) then
  5.                 table.insert(_PlayersDI, v)
  6.             end  
  7.         end
  8.  
  9.         if ( _PlayersDI == {} ) then
  10.             for _, v in pairs(player.GetAll()) do
  11.                 if ( v:GetRole() == ROLE_INNOCENT and v:Alive() ) then
  12.                     table.insert(_PlayersDI, v)
  13.                 end  
  14.             end
  15.         end
  16.  
  17.         local rply = _PlayersDI[math.random(1,#_PlayersDI)]
  18.         rply:SetMaxHealth(200)
  19.         rply:SetHealth(200)
  20.         rply:SetModel( "models/player/riot.mdl" )
  21.  
  22.         SuddenBroadcast("Sudden Death: ", Color(255,255,255), "LONG LIVE THE KING!")
  23.  
  24.         hook.Add("PlayerDeath", "HTK_Punishment", function(ply)
  25.             if ( ply == rply ) then
  26.                 SuddenBroadcast("Sudden Death: ", Color(255,255,255), "The King was killed by a Traitor. It´s time to impose a penalty!")
  27.  
  28.                 for k, v in pairs(player.GetAll()) do
  29.                     if ( v:GetRole() == ROLE_INNOCENT ) then
  30.                         v:SetHealth(1)
  31.                     end
  32.                 end
  33.             end
  34.         end)
  35.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement