-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
49 lines (40 loc) · 1.43 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
-- olliy
info = {}
local items = {
"no info at the moment",
}
for i = 1, #items do
items[i] = minetest.formspec_escape(items[i])
end
info.txt = table.concat(items, ",")
minetest.register_chatcommand("info", {
func = function(name, param)
if param ~= "" and
minetest.check_player_privs(name, { kick = true }) then
name = param
end
local player = minetest.get_player_by_name(name)
if player then
info.show(player)
return true, "info shown."
else
return false, "Player " .. name .. " does not exist or is not online"
end
end
})
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
if name then
minetest.after(5, minetest.chat_send_player, name, "Hi " .. name .. ". You can review more infomation about the server by running /info")
else
print("Something went wrong")
end
end)
function info.show(player)
local fs = "size[9,7]bgcolor[#080808BB;true]" ..
default.gui_bg ..
default.gui_bg_img ..
"textlist[0.1,0.1;8.8,6.3;msg;" .. info.txt .. ";-1;true]"..
"button_exit[0.5,6;7,2;yes;Okay]"
minetest.show_formspec(player:get_player_name(), "info:info", fs)
end