Fixed messages

This commit is contained in:
ezhh 2016-07-03 18:05:46 +01:00
parent 16b1bfd697
commit 7ad4a37f29

113
init.lua
View File

@ -7,113 +7,129 @@ minetest.register_privilege("unglitched", {description = "Not very glitchy...",
--prevents player from changing speed/direction and jumping. --prevents player from changing speed/direction and jumping.
local function freeze(name, param) local function freeze(name, param)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(param)
if player == nil then local privs=minetest.get_player_privs(param)
minetest.chat_send_player(name,"Player does not exist") privs.frozen=true
return minetest.set_player_privs(param,privs)
end player:set_physics_override({jump = 0, speed = 0})
local privs=minetest.get_player_privs(param)
privs.frozen=true
minetest.set_player_privs(param,privs)
player:set_physics_override({jump = 0, speed = 0})
minetest.chat_send_player(param, "Cursed by an admin! You are now frozen!")
end end
minetest.register_chatcommand("freeze", { minetest.register_chatcommand("freeze", {
params = "<person>", params = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Prevent player movement.", description = "Prevent player movement.",
func = freeze func = function(name, param)
local player = minetest.get_player_by_name(param)
if player == nil then
minetest.chat_send_player(name,"Player does not exist")
return
end
freeze(name, param)
minetest.chat_send_player(param, "Cursed by an admin! You are now frozen!")
minetest.chat_send_player(name, "Curse successful!")
end
}) })
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
if minetest.get_player_privs(name).frozen then if minetest.get_player_privs(name).frozen then
freeze(name,name) freeze(name,name)
end end
end) end)
--prevents player from jumping. --prevents player from jumping.
local function hobble(name, param) local function hobble(name, param)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(param)
if player == nil then local privs=minetest.get_player_privs(param)
minetest.chat_send_player(name,"Player does not exist") privs.hobbled=true
return minetest.set_player_privs(param,privs)
end player:set_physics_override({jump = 0})
local privs=minetest.get_player_privs(param)
privs.hobbled=true
minetest.set_player_privs(param,privs)
player:set_physics_override({jump = 0})
minetest.chat_send_player(param, "Cursed by an admin! No more jumping!")
end end
minetest.register_chatcommand("hobble", { minetest.register_chatcommand("hobble", {
params = "<person>", params = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Prevent player jumping.", description = "Prevent player jumping.",
func = hobble func = function(name, param)
local player = minetest.get_player_by_name(param)
if player == nil then
minetest.chat_send_player(name,"Player does not exist")
return
end
hobble(name,param)
minetest.chat_send_player(param, "Cursed by an admin! No more jumping!")
minetest.chat_send_player(name, "Curse successful!")
end
}) })
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
if minetest.get_player_privs(name).hobbled then if minetest.get_player_privs(name).hobbled then
hobble(name,name) hobble(name,name)
end end
end) end)
--reduces player movement speed --reduces player movement speed
local function slowmo(name, param) local function slowmo(name, param)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(param)
if player == nil then
minetest.chat_send_player(name,"Player does not exist")
return
end
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(param)
privs.slowed=true privs.slowed=true
minetest.set_player_privs(param,privs) minetest.set_player_privs(param,privs)
player:set_physics_override({speed = 0.3}) player:set_physics_override({speed = 0.3})
minetest.chat_send_player(param, "Cursed by an admin! You feel sloooooow!")
end end
minetest.register_chatcommand("slowmo", { minetest.register_chatcommand("slowmo", {
params = "<person>", params = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Reduce player movement speed.", description = "Reduce player movement speed.",
func = slowmo func = function(name, param)
local player = minetest.get_player_by_name(param)
if player == nil then
minetest.chat_send_player(name,"Player does not exist")
return
end
slowmo(name,param)
minetest.chat_send_player(param, "Cursed by an admin! You feel sloooooow!")
minetest.chat_send_player(name, "Curse successful!")
end
}) })
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
if minetest.get_player_privs(name).slowed then if minetest.get_player_privs(name).slowed then
slowmo(name,name) slowmo(name,name)
end end
end) end)
--disable sneak glitch for the player. --disable sneak glitch for the player.
local function noglitch(name, param) local function noglitch(name, param)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(param)
if player == nil then
minetest.chat_send_player(name,"Player does not exist")
return
end
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(param)
privs.unglitched=true privs.unglitched=true
minetest.set_player_privs(param,privs) minetest.set_player_privs(param,privs)
player:set_physics_override({sneak = false}) player:set_physics_override({sneak = false})
minetest.chat_send_player(param, "Cursed by an admin! You feel less glitchy...")
end end
minetest.register_chatcommand("noglitch", { minetest.register_chatcommand("noglitch", {
params = "<person>", params = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Disable sneak glitch for a player.", description = "Disable sneak glitch for a player.",
func = noglitch func = function(name, param)
local player = minetest.get_player_by_name(param)
if player == nil then
minetest.chat_send_player(name,"Player does not exist")
return
end
noglitch(name, param)
minetest.chat_send_player(param, "Cursed by an admin! You feel less glitchy...")
minetest.chat_send_player(name, "Curse successful!")
end
}) })
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
if minetest.get_player_privs(name).unglitched then if minetest.get_player_privs(name).unglitched then
noglitch(name,name) noglitch(name,name)
end end
end) end)
@ -121,11 +137,11 @@ end)
minetest.register_chatcommand("setfree",{ minetest.register_chatcommand("setfree",{
params = "<person>", params = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Reset player movement.", description = "Reset player movement.",
func = function(name, param) func = function(name, param)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(param)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(param)
@ -136,5 +152,6 @@ minetest.register_chatcommand("setfree",{
minetest.set_player_privs(param,privs) minetest.set_player_privs(param,privs)
player:set_physics_override({jump = 1, speed = 1, sneak = true}) player:set_physics_override({jump = 1, speed = 1, sneak = true})
minetest.chat_send_player(param, "The curse is lifted. You have been set free!") minetest.chat_send_player(param, "The curse is lifted. You have been set free!")
minetest.chat_send_player(param, "The curse is lifted.")
end, end,
}) })