Improve messages
This commit is contained in:
parent
d9155d4f7f
commit
4afd183f47
38
init.lua
38
init.lua
@ -18,8 +18,7 @@ minetest.register_chatcommand("hobble", {
|
|||||||
func = function(name, target)
|
func = function(name, target)
|
||||||
local player = minetest.get_player_by_name(target)
|
local player = minetest.get_player_by_name(target)
|
||||||
if player == nil then
|
if player == nil then
|
||||||
minetest.chat_send_player(name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
hobble(name, target)
|
hobble(name, target)
|
||||||
minetest.chat_send_player(target, "Cursed by an admin! No more jumping!")
|
minetest.chat_send_player(target, "Cursed by an admin! No more jumping!")
|
||||||
@ -41,8 +40,7 @@ minetest.register_chatcommand("slowmo", {
|
|||||||
func = function(name, target)
|
func = function(name, target)
|
||||||
local player = minetest.get_player_by_name(target)
|
local player = minetest.get_player_by_name(target)
|
||||||
if player == nil then
|
if player == nil then
|
||||||
minetest.chat_send_player(name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
slowmo(name,target)
|
slowmo(name,target)
|
||||||
minetest.chat_send_player(target, "Cursed by an admin! You feel sloooooow!")
|
minetest.chat_send_player(target, "Cursed by an admin! You feel sloooooow!")
|
||||||
@ -64,8 +62,7 @@ minetest.register_chatcommand("freeze", {
|
|||||||
func = function(name, target)
|
func = function(name, target)
|
||||||
local player = minetest.get_player_by_name(target)
|
local player = minetest.get_player_by_name(target)
|
||||||
if player == nil then
|
if player == nil then
|
||||||
minetest.chat_send_player(name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
freeze(name, target)
|
freeze(name, target)
|
||||||
minetest.chat_send_player(target, "Cursed by an admin! You are now frozen!")
|
minetest.chat_send_player(target, "Cursed by an admin! You are now frozen!")
|
||||||
@ -87,8 +84,7 @@ minetest.register_chatcommand("getlost", {
|
|||||||
func = function(name, target)
|
func = function(name, target)
|
||||||
local player = minetest.get_player_by_name(target)
|
local player = minetest.get_player_by_name(target)
|
||||||
if player == nil then
|
if player == nil then
|
||||||
minetest.chat_send_player(name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
getlost(name,target)
|
getlost(name,target)
|
||||||
minetest.chat_send_player(target, "Cursed by an admin! You will get lost now!")
|
minetest.chat_send_player(target, "Cursed by an admin! You will get lost now!")
|
||||||
@ -130,8 +126,7 @@ minetest.register_chatcommand("setfree",{
|
|||||||
func = function(name, target)
|
func = function(name, target)
|
||||||
local player = minetest.get_player_by_name(target)
|
local player = minetest.get_player_by_name(target)
|
||||||
if player == nil then
|
if player == nil then
|
||||||
minetest.chat_send_player(name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
player:set_attribute("hobbled", "")
|
player:set_attribute("hobbled", "")
|
||||||
player:set_attribute("slowed", "")
|
player:set_attribute("slowed", "")
|
||||||
@ -168,7 +163,7 @@ minetest.register_chatcommand("set_sneak",{
|
|||||||
end
|
end
|
||||||
local player = minetest.get_player_by_name(target)
|
local player = minetest.get_player_by_name(target)
|
||||||
if not player then
|
if not player then
|
||||||
return false, "Player does not exist"
|
return false, "Player does not exist."
|
||||||
end
|
end
|
||||||
if not mode or (mode ~= "old" and mode ~= "new" and mode ~= "none") then
|
if not mode or (mode ~= "old" and mode ~= "new" and mode ~= "none") then
|
||||||
return false, "Set a mode: old, new or none."
|
return false, "Set a mode: old, new or none."
|
||||||
@ -223,25 +218,21 @@ minetest.register_chatcommand("cage", {
|
|||||||
func = function(warden_name, target_name)
|
func = function(warden_name, target_name)
|
||||||
-- prevent self-caging
|
-- prevent self-caging
|
||||||
if warden_name == target_name then
|
if warden_name == target_name then
|
||||||
minetest.chat_send_player(warden_name,"You can't cage yourself")
|
return false, "You can't cage yourself."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- get target player or return
|
-- get target player or return
|
||||||
local target = minetest.get_player_by_name(target_name)
|
local target = minetest.get_player_by_name(target_name)
|
||||||
if not target then
|
if not target then
|
||||||
minetest.chat_send_player(warden_name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- return if already caged
|
-- return if already caged
|
||||||
if target:get_attribute("caged") == "true" then
|
if target:get_attribute("caged") == "true" then
|
||||||
minetest.chat_send_player(warden_name,"This player is already caged")
|
return false, "This player is already caged."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- get cage position from config or return
|
-- get cage position from config or return
|
||||||
local cagepos = minetest.setting_get_pos("cage_coordinate")
|
local cagepos = minetest.setting_get_pos("cage_coordinate")
|
||||||
if not cagepos then
|
if not cagepos then
|
||||||
minetest.chat_send_player(warden_name, "No cage set...")
|
return false, "No cage set..."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- add current target privs to table and save to file
|
-- add current target privs to table and save to file
|
||||||
local privs = minetest.get_player_privs(target_name)
|
local privs = minetest.get_player_privs(target_name)
|
||||||
@ -265,19 +256,16 @@ minetest.register_chatcommand("uncage", {
|
|||||||
-- get target player or return
|
-- get target player or return
|
||||||
local target = minetest.get_player_by_name(target_name)
|
local target = minetest.get_player_by_name(target_name)
|
||||||
if not target then
|
if not target then
|
||||||
minetest.chat_send_player(warden_name,"Player does not exist")
|
return false, "Player does not exist."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- return if not caged
|
-- return if not caged
|
||||||
if target:get_attribute("caged") ~= "true" then
|
if target:get_attribute("caged") ~= "true" then
|
||||||
minetest.chat_send_player(warden_name,"This player is not caged")
|
return false, "This player is not caged."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- get release position from config or return
|
-- get release position from config or return
|
||||||
local releasepos = minetest.setting_get_pos("release_coordinate")
|
local releasepos = minetest.setting_get_pos("release_coordinate")
|
||||||
if not releasepos then
|
if not releasepos then
|
||||||
minetest.chat_send_player(warden_name, "No release point set...")
|
return false, "No release point set..."
|
||||||
return
|
|
||||||
end
|
end
|
||||||
-- get target's original privs from table and restore them
|
-- get target's original privs from table and restore them
|
||||||
local original_privs = priv_table[target_name]
|
local original_privs = priv_table[target_name]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user