Logging Player Deaths and Kills?

How would i code and addon that logs players kills and deaths, and stores it for the future when i make a derma panel that sais all the info of the selected info.

[lua]
hook.Add( “PlayerDeath”, function( vic, inf, att )
print( vic:Name()…" was killed by "…att:name() )
end )
[/lua]

from there, you can save it to a file in data with file.read and write

Thank you sir.

[lua]

hook.Add( “PlayerDeath”, function( vic, inf, att )
local str = vic:Name()…" was killed by "…att:name()
file.Append(“death-log.txt”,( str )
end )[/lua]

couldnt you also do this.

To open and edit a file every time someone dies seems to me ineffecient, can store it temporarily then have a timer save it.

You can have a buffer and just append it to a file every 30 minutes or so and clear it.