Advertisement
Guest User

Sneaky Rocks AWARN2 System Free2Kill

a guest
Nov 22nd, 2015
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. if SERVER then
  2.     local SHOW_KILLER_ROLE = true
  3.     local FREE_TO_KILL = true
  4.    
  5.     ServerLog("AWarn: TTT Teamkill Module Loaded!\n")
  6.     function awarn_warn_ttt_teamkill( ply, ent, killer )
  7.         if GetRoundState() != ROUND_POST and killer:IsPlayer() and ply:IsPlayer() then
  8.             local pid = ply:UniqueID()
  9.             if SHOW_KILLER_ROLE then
  10.                 player.GetByUniqueID(pid):PrintMessage( HUD_PRINTTALK, "You got killed by a "..killer:GetRoleString().."!" )   
  11.             end
  12.            
  13.             if !ply.vogelfrei then
  14.                 local was_teamkill = false
  15.                 if killer:GetRole() == ply:GetRole() and killer:GetName() != ply:GetName() then
  16.                     args = { killer:EntIndex(), "Autowarn: Teamkill" }
  17.                     awarn_con_warn(nil, nil, args)
  18.                     was_teamkill = true
  19.                 elseif killer:GetRole() == ROLE_INNOCENT and ply:GetRole() == ROLE_DETECTIVE then
  20.                     args = { killer:EntIndex(), "Autowarn: Detekill" }
  21.                     awarn_con_warn(nil, nil, args)     
  22.                     was_teamkill = true
  23.                 end
  24.                
  25.                 if !killer.vogelfrei and was_teamkill and FREE_TO_KILL then
  26.                     killer.vogelfrei = true
  27.                     print( "[FTK]", killer:Nick(), " is free to kill because teamkill" )
  28.                 end
  29.             end
  30.         end
  31.     end
  32.  
  33.     function awarn_vogelfrei( ply, atk, hp, dmg )
  34.         if GetRoundState() != ROUND_POST and atk:IsPlayer() and ply:IsPlayer() then
  35.             if atk:GetRole() == ply:GetRole() and atk:GetName() != ply:GetName() then
  36.                 atk.teamdmg = atk.teamdmg + dmg
  37.             elseif atk:GetRole() == ROLE_INNOCENT and ply:GetRole() == ROLE_DETECTIVE then
  38.                 atk.teamdmg = atk.teamdmg + dmg
  39.             end
  40.        
  41.             if atk.teamdmg > 40 and !atk.vogelfrei and FREE_TO_KILL then
  42.                 atk.vogelfrei = true
  43.                 print( "[FTK]", atk:Nick(), " is free to kill because ", atk.teamdmg, " teamdmg" )
  44.             end
  45.         end
  46.     end
  47.  
  48.     function awarn_reset( ply )
  49.         ply.teamdmg = 0
  50.         ply.vogelfrei = false
  51.     end
  52.  
  53.     hook.Add( "PlayerDeath", "awarn_warn_ttt_teamkill", awarn_warn_ttt_teamkill )
  54.     hook.Add( "PlayerHurt", "awarn_vogelfrei", awarn_vogelfrei )
  55.     hook.Add( "PlayerSpawn", "arwarn_reset", awarn_reset )
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement