Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. [ERROR] addons/plogs 2.7.1/lua/plogs_hooks/kills.lua:4: attempt to index a string value with bad key ('IsPlayer' is not part of the string library)
  2. 1. error - [C]:-1
  3. 2. __index - lua/includes/extensions/string.lua:310
  4. 3. rone_ttt_printrole - addons/plogs 2.7.1/lua/plogs_hooks/kills.lua:4
  5. 4. fn - addons/plogs 2.7.1/lua/plogs_hooks/kills.lua:44
  6. 5. unknown - addons/ulib/lua/ulib/shared/hook.lua:109
  7. 6. FireBullets - [C]:-1
  8. 7. ShootBullet - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:318
  9. 8. unknown - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:242
  10.  
  11.  
  12.  
  13. kills.lua
  14.  
  15.  
  16.  
  17. plogs.Register('Kills', true, Color(255,0,0))
  18.  
  19. function rone_ttt_printrole(ply)
  20. if ply:IsPlayer() then
  21. if ply:GetRole() == 0 then
  22. return "innocent"
  23. elseif ply:GetRole() == 1 then
  24. return "traitor"
  25. elseif ply:GetRole() == 2 then
  26. return "detective"
  27. else
  28. return ""
  29. end
  30. else
  31. return ""
  32. end
  33. end
  34.  
  35. plogs.AddHook('PlayerDeath', function(pl, _, attacker)
  36. local copy = {
  37. ['Name'] = pl:Name(),
  38. ['SteamID'] = pl:SteamID(),
  39. }
  40. local weapon = ''
  41. if IsValid(attacker) then
  42. if attacker:IsPlayer() then
  43. copy['Attacker Name'] = attacker:Name()
  44. copy['Attacker SteamID'] = attacker:SteamID()
  45. weapon = ' with ' .. (IsValid(attacker:GetActiveWeapon()) and attacker:GetActiveWeapon():GetClass() or 'unknown')
  46. attacker = attacker:NameID()
  47. else
  48. if attacker.CPPIGetOwner and IsValid(attacker:CPPIGetOwner()) then
  49. weapon = ' with ' .. attacker:GetClass()
  50. attacker = attacker:CPPIGetOwner():NameID()
  51. else
  52. attacker = attacker:GetClass()
  53. end
  54. end
  55. else
  56. attacker = tostring(attacker)
  57. end
  58. if not ( pl == attacker ) then
  59. rone_victim_team = rone_ttt_printrole(pl)
  60. rone_attacker_team = rone_ttt_printrole(attacker)
  61. else
  62. rone_victim_team = ""
  63. rone_attacker_team = ""
  64. end
  65. plogs.PlayerLog(pl, 'Kills', "[" .. rone_attacker_team "] " .. attacker .. ' killed ' .. "[" .. rone_victim_team .. "] " .. pl:NameID() .. weapon, copy)
  66. end)
  67.  
  68.  
  69. plogs.Register('Damage', false)
  70.  
  71. plogs.AddHook('EntityTakeDamage', function(ent, dmginfo)
  72. if ent:IsPlayer() then
  73. local copy = {
  74. ['Name'] = ent:Name(),
  75. ['SteamID'] = ent:SteamID(),
  76. }
  77. local weapon = ''
  78. local attacker = dmginfo:GetAttacker()
  79. if IsValid(attacker) then
  80. if attacker:IsPlayer() then
  81. copy['Attacker Name'] = attacker:Name()
  82. copy['Attacker SteamID'] = attacker:SteamID()
  83. weapon = ' with ' .. (IsValid(attacker:GetActiveWeapon()) and attacker:GetActiveWeapon():GetClass() or 'unknown')
  84. attacker = attacker:NameID()
  85. else
  86. if attacker.CPPIGetOwner and IsValid(attacker:CPPIGetOwner()) then
  87. weapon = ' with ' .. attacker:GetClass()
  88. attacker = attacker:CPPIGetOwner():NameID()
  89. else
  90. attacker = attacker:GetClass()
  91. end
  92. end
  93. else
  94. attacker = tostring(attacker)
  95. end
  96. plogs.PlayerLog(ent, 'Damage', attacker .. ' did ' .. math.Round(dmginfo:GetDamage(), 0) .. ' damage to ' .. ent:NameID() .. weapon, copy)
  97. end
  98. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement