Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. plogs.Register('Kills', true, Color(255,0,0))
  2.  
  3. function rone_ttt_printrole(ply)
  4. if ply:IsPlayer() then
  5. if ply:GetRole() == 0 then
  6. return "innocent"
  7. elseif ply:GetRole() == 1 then
  8. return "traitor"
  9. elseif ply:GetRole() == 2 then
  10. return "detective"
  11. else
  12. return ""
  13. end
  14. else
  15. return ""
  16. end
  17. end
  18.  
  19. plogs.AddHook('PlayerDeath', function(pl, _, attacker)
  20. local copy = {
  21. ['Name'] = pl:Name(),
  22. ['SteamID'] = pl:SteamID(),
  23. }
  24. local weapon = ''
  25. if IsValid(attacker) then
  26. if attacker:IsPlayer() then
  27. copy['Attacker Name'] = attacker:Name()
  28. copy['Attacker SteamID'] = attacker:SteamID()
  29. weapon = ' with ' .. (IsValid(attacker:GetActiveWeapon()) and attacker:GetActiveWeapon():GetClass() or 'unknown')
  30. attacker = attacker:NameID()
  31. else
  32. if attacker.CPPIGetOwner and IsValid(attacker:CPPIGetOwner()) then
  33. weapon = ' with ' .. attacker:GetClass()
  34. attacker = attacker:CPPIGetOwner():NameID()
  35. else
  36. attacker = attacker:GetClass()
  37. end
  38. end
  39. else
  40. attacker = tostring(attacker)
  41. end
  42. if not ( pl == attacker ) then
  43. rone_victim_team = rone_ttt_printrole(pl)
  44. rone_attacker_team = rone_ttt_printrole(attacker)
  45. else
  46. rone_victim_team = ""
  47. rone_attacker_team = ""
  48. end
  49. plogs.PlayerLog(pl, 'Kills', "[" .. rone_attacker_team "] " .. attacker .. ' killed ' .. "[" .. rone_victim_team .. "] " .. pl:NameID() .. weapon, copy)
  50. end)
  51.  
  52.  
  53. plogs.Register('Damage', false)
  54.  
  55. plogs.AddHook('EntityTakeDamage', function(ent, dmginfo)
  56. if ent:IsPlayer() then
  57. local copy = {
  58. ['Name'] = ent:Name(),
  59. ['SteamID'] = ent:SteamID(),
  60. }
  61. local weapon = ''
  62. local attacker = dmginfo:GetAttacker()
  63. if IsValid(attacker) then
  64. if attacker:IsPlayer() then
  65. copy['Attacker Name'] = attacker:Name()
  66. copy['Attacker SteamID'] = attacker:SteamID()
  67. weapon = ' with ' .. (IsValid(attacker:GetActiveWeapon()) and attacker:GetActiveWeapon():GetClass() or 'unknown')
  68. attacker = attacker:NameID()
  69. else
  70. if attacker.CPPIGetOwner and IsValid(attacker:CPPIGetOwner()) then
  71. weapon = ' with ' .. attacker:GetClass()
  72. attacker = attacker:CPPIGetOwner():NameID()
  73. else
  74. attacker = attacker:GetClass()
  75. end
  76. end
  77. else
  78. attacker = tostring(attacker)
  79. end
  80. plogs.PlayerLog(ent, 'Damage', attacker .. ' did ' .. math.Round(dmginfo:GetDamage(), 0) .. ' damage to ' .. ent:NameID() .. weapon, copy)
  81. end
  82. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement