Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [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)
- 1. error - [C]:-1
- 2. __index - lua/includes/extensions/string.lua:310
- 3. rone_ttt_printrole - addons/plogs 2.7.1/lua/plogs_hooks/kills.lua:4
- 4. fn - addons/plogs 2.7.1/lua/plogs_hooks/kills.lua:44
- 5. unknown - addons/ulib/lua/ulib/shared/hook.lua:109
- 6. FireBullets - [C]:-1
- 7. ShootBullet - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:318
- 8. unknown - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:242
- kills.lua
- plogs.Register('Kills', true, Color(255,0,0))
- function rone_ttt_printrole(ply)
- if ply:IsPlayer() then
- if ply:GetRole() == 0 then
- return "innocent"
- elseif ply:GetRole() == 1 then
- return "traitor"
- elseif ply:GetRole() == 2 then
- return "detective"
- else
- return ""
- end
- else
- return ""
- end
- end
- plogs.AddHook('PlayerDeath', function(pl, _, attacker)
- local copy = {
- ['Name'] = pl:Name(),
- ['SteamID'] = pl:SteamID(),
- }
- local weapon = ''
- if IsValid(attacker) then
- if attacker:IsPlayer() then
- copy['Attacker Name'] = attacker:Name()
- copy['Attacker SteamID'] = attacker:SteamID()
- weapon = ' with ' .. (IsValid(attacker:GetActiveWeapon()) and attacker:GetActiveWeapon():GetClass() or 'unknown')
- attacker = attacker:NameID()
- else
- if attacker.CPPIGetOwner and IsValid(attacker:CPPIGetOwner()) then
- weapon = ' with ' .. attacker:GetClass()
- attacker = attacker:CPPIGetOwner():NameID()
- else
- attacker = attacker:GetClass()
- end
- end
- else
- attacker = tostring(attacker)
- end
- if not ( pl == attacker ) then
- rone_victim_team = rone_ttt_printrole(pl)
- rone_attacker_team = rone_ttt_printrole(attacker)
- else
- rone_victim_team = ""
- rone_attacker_team = ""
- end
- plogs.PlayerLog(pl, 'Kills', "[" .. rone_attacker_team "] " .. attacker .. ' killed ' .. "[" .. rone_victim_team .. "] " .. pl:NameID() .. weapon, copy)
- end)
- plogs.Register('Damage', false)
- plogs.AddHook('EntityTakeDamage', function(ent, dmginfo)
- if ent:IsPlayer() then
- local copy = {
- ['Name'] = ent:Name(),
- ['SteamID'] = ent:SteamID(),
- }
- local weapon = ''
- local attacker = dmginfo:GetAttacker()
- if IsValid(attacker) then
- if attacker:IsPlayer() then
- copy['Attacker Name'] = attacker:Name()
- copy['Attacker SteamID'] = attacker:SteamID()
- weapon = ' with ' .. (IsValid(attacker:GetActiveWeapon()) and attacker:GetActiveWeapon():GetClass() or 'unknown')
- attacker = attacker:NameID()
- else
- if attacker.CPPIGetOwner and IsValid(attacker:CPPIGetOwner()) then
- weapon = ' with ' .. attacker:GetClass()
- attacker = attacker:CPPIGetOwner():NameID()
- else
- attacker = attacker:GetClass()
- end
- end
- else
- attacker = tostring(attacker)
- end
- plogs.PlayerLog(ent, 'Damage', attacker .. ' did ' .. math.Round(dmginfo:GetDamage(), 0) .. ' damage to ' .. ent:NameID() .. weapon, copy)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement