Inital commit.

master
Teodor Spæren 2012-10-13 23:32:53 +02:00
commit 58790ef31f
3 changed files with 66 additions and 0 deletions

16
README.txt Normal file
View File

@ -0,0 +1,16 @@
ABOUT
======
Redsand is a collection of utilites for servers. It is not aimed at adding new blocks to the game,
but rather add more chat commands and so on.
====
FEATURES
====
- Death messages
- MOTD
-
COMMANDS
========
/list - List out the players on the server.

5
conf.lua Normal file
View File

@ -0,0 +1,5 @@
MOTD = "Welcome %s! This is the default MOTD."
JOIN_MSG = "Player %s just joined."
LEAVE_MSG = "Player %s just left."
REVIVE_MSG = "Like an phonix %s raises from the ashes."
DEATH_MSG = "%s left this world :("

45
init.lua Normal file
View File

@ -0,0 +1,45 @@
dofile("../mods/minetest/redsand/conf.lua")
-- !!! COMMANDS !!! ---
--[[ List function. ]]--
minetest.register_chatcommand("list", {
params = "", -- short parameter description
description = "List connected players", -- full description
privs = {privs=true}, -- require the "privs" privilege to run
func = function(name, param)
local namelist, count = "", 0
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
namelist = namelist .. string.format("%s, ", name)
count = count + 1
end
minetest.chat_send_player(name, string.format("Current players online: %d", count))
minetest.chat_send_player(name, string.format("Names: \[%s\]", namelist))
end,
})
minetest.register_chatcommand("sand", {
params = "",
description = "",
privs = {privs=true},
func = function(name, param)
print(minetest.get_server_status())
end,
})
-- !!! EVENTS !!! --
minetest.register_on_joinplayer( function(player)
minetest.after( 2.0, function(param)
minetest.chat_send_player(player:get_player_name(), string.format(MOTD, player:get_player_name()))
end)
end
)
minetest.register_on_dieplayer( function(player)
minetest.chat_send_all(string.format(DEATH_MSG, player:get_player_name()))
end
)
minetest.register_on_respawnplayer( function(player)
minetest.chat_send_all(string.format(REVIVE_MSG, player:get_player_name()))
end
)