Skip to content

Instantly share code, notes, and snippets.

@20kdc
Last active December 12, 2016 21:31
File for testing
minetest.register_chatcommand("selfdestruct", {
privs = {
server = true,
},
func = function(name, param)
minetest.get_player_by_name(name):set_hp(0)
end
})
minetest.register_on_dieplayer(function (ply)
-- This will appear twice in the server log, if the player closes the window after death, then comes back.
-- (the "Server killed for testing" error can be removed to test this with a proper game shutdown and restart,
-- though it's faster to just test this with an error to stop the game without respawn.
-- The Escape button WILL respawn the player.)
print(ply:get_player_name() .. " has died for some reason")
minetest.after(1.0, function ()
error("Server killed for testing")
end)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment