write something there
This commit is contained in:
commit
b4b6c08f4f
8546 changed files with 309825 additions and 0 deletions
31
mods/minetest_game/game_commands/init.lua
Normal file
31
mods/minetest_game/game_commands/init.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
-- game_commands/init.lua
|
||||
|
||||
-- Load support for MT game translation.
|
||||
local S = minetest.get_translator("game_commands")
|
||||
|
||||
|
||||
minetest.register_chatcommand("killme", {
|
||||
description = S("Kill yourself to respawn"),
|
||||
func = function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
if minetest.settings:get_bool("enable_damage") then
|
||||
player:set_hp(0)
|
||||
return true
|
||||
else
|
||||
for _, callback in pairs(minetest.registered_on_respawnplayers) do
|
||||
if callback(player) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- There doesn't seem to be a way to get a default spawn pos
|
||||
-- from the lua API
|
||||
return false, S("No static_spawnpoint defined")
|
||||
end
|
||||
else
|
||||
-- Show error message if used when not logged in, eg: from IRC mod
|
||||
return false, S("You need to be online to be killed!")
|
||||
end
|
||||
end
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue