Advertisement
Guest User

Count of traitors and Detectives.

a guest
Apr 24th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. --You will of course need to call getCount() if you want this to work :D
  2.  
  3. local function getCount()
  4. if (SERVER) then
  5.     hook.Add( "TTTBeginRound", "NumberOfTypes", function()
  6.         local TCount = 0
  7.         local DCount = 0
  8.         local ICount = 0
  9.         for k, v in pairs( player.GetAll() ) do
  10.             if v:IsTraitor() and v:Alive() then
  11.                 TCount=TCount+1
  12.             elseif v:IsDetective() and v:Alive() then
  13.                 DCount=DCount+1
  14.             elseif v:Alive() then
  15.                 ICount=ICount+1;
  16.             end
  17.         end
  18.         timer.Simple( .5, function()
  19.             PrintMessage( HUD_PRINTTALK, "Traitors: "..TCount )
  20.             PrintMessage( HUD_PRINTTALK, "Detectives: "..DCount )
  21.             PrintMessage( HUD_PRINTTALK, "Innocents: ".. ICount )
  22.         end )
  23.     end )
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement