as if I would want that the player has an empty inventory?Krock wrote:brunob.santos wrote:there is a command for suicide? Can you show me?Code: Select all
minetest.register_chatcommand("killme", { description = "Kills you", func = function(name, param) local player = minetest.get_player_by_name(name) player:set_hp(0) end })
Code: Select all
minetest.register_chatcommand("killme", {
description = "Kills you",
func = function(name, param)
local player = minetest.get_player_by_name(name)
local invref = player:get_inventory()
local size = invref:get_size(name)
if size == nil then
player:setpos({x = 100, y = 20, z = 100})
end
if size ~= nil then
player:set_hp(0)
end
end})
This will serve to fix a bug (to be so)