1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-01-23 16:30:19 +01:00

Log death messages into a text file

- Solves part of #58
This commit is contained in:
LeMagnesium 2015-09-05 15:09:30 +02:00
parent 1ae26b05f9
commit 8990897e53

View File

@ -7,12 +7,13 @@ dofile(minetest.get_modpath("death_messages").."/settings.txt")
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- A table of quips for death messages -- A table of quips for death messages
local messages = {} local messages = {}
-- Another one to avoid double death messages -- Another one to avoid double death messages
local whacked = {} local whacked = {}
local logfile = minetest.get_worldpath() .. "/death_logs.txt"
-- Fill this table with sounds -- Fill this table with sounds
local sounds = { local sounds = {
[1] = "death_messages_player_1", [1] = "death_messages_player_1",
@ -90,6 +91,9 @@ messages.whacking = {
local function broadcast_death(msg) local function broadcast_death(msg)
minetest.chat_send_all(msg) minetest.chat_send_all(msg)
local logfilep = io.open(logfile, "a")
logfilep:write(os.date("[%Y-%m-%d %H:%M:%S] ") .. msg .. "\n")
logfilep:close()
if irc then if irc then
irc:say(msg) irc:say(msg)
end end