v2.0: You can now specify groups of players. Use commas to separate players: e.g. /freeze you,me
This commit is contained in:
parent
ed1e738665
commit
0097cb1710
153
init.lua
153
init.lua
@ -3,96 +3,100 @@ minetest.register_chatcommand("antigravity", {
|
||||
description = "Gives that person antigravity",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
minetest.chat_send_player(name, "Target locked...FIRE! Direct hit!")
|
||||
player:set_physics_override({
|
||||
gravity = -0.1
|
||||
})
|
||||
end,
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({gravity = -0.1})
|
||||
minetest.chat_send_player(name, "Gave antigravity to " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("freeze", {
|
||||
params = "<person>",
|
||||
description = "Sets speed+jump to 0. Can't move unless teleported or blocks removed under them",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
minetest.chat_send_player(name, "Target locked...FIRE! Direct hit!")
|
||||
player:set_physics_override({
|
||||
jump = 0,
|
||||
speed = 0
|
||||
})
|
||||
end,
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({jump = 0, speed = 0})
|
||||
minetest.chat_send_player(name, "Froze " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("jump",{
|
||||
params = "<person>",
|
||||
description = "Gives that person huge jump boost, usually killing them.",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
minetest.chat_send_player(name, "Target locked...FIRE! Direct hit!")
|
||||
player:set_physics_override({
|
||||
jump = 1000
|
||||
})
|
||||
end
|
||||
func = function(name, param)
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({jump = 1000})
|
||||
minetest.chat_send_player(name, "Gave sumperjump to " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("fast",{
|
||||
params = "<person>",
|
||||
description = "Gives that person a lot of speed",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
minetest.chat_send_player(name, "Target locked...FIRE! Direct hit!")
|
||||
player:set_physics_override({
|
||||
speed = 10
|
||||
})
|
||||
end
|
||||
func = function(name, param)
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({speed = 10})
|
||||
minetest.chat_send_player(name, "Gave superspeed to " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("controls",{
|
||||
params = "<person>",
|
||||
description = "Gives that person very quirky controls, resulting in a literally uncontrollable character. Use with caution!",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
minetest.chat_send_player(name, "Target locked...FIRE! Direct hit!")
|
||||
player:set_physics_override({
|
||||
speed = -1.0
|
||||
})
|
||||
end
|
||||
func = function(name, param)
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({speed = -1})
|
||||
minetest.chat_send_player(name, "Gave antispeed to " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("glide",{
|
||||
params = "<person>",
|
||||
description = "Anti-fall damage. Slows your descent.",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
minetest.chat_send_player(name, "Target locked...FIRE! Direct hit!")
|
||||
player:set_physics_override({
|
||||
jump = 0.3,
|
||||
gravity = 0.1
|
||||
})
|
||||
end
|
||||
func = function(name, param)
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({jump = 0.3, gravity = 0.1})
|
||||
minetest.chat_send_player(name, "Gave glidability to " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
@ -100,22 +104,15 @@ minetest.register_chatcommand("reset",{
|
||||
params = "<person>",
|
||||
description = "Resets gravity, eye offset, visual size and whether they are invisible",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(param)
|
||||
if player == nil then
|
||||
player = minetest.get_player_by_name(name)
|
||||
end
|
||||
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
player:set_properties({
|
||||
visual_size = {x=1, y=1, z=1}
|
||||
})
|
||||
minetest.chat_send_player(param, "Your gravity has been reset! FREEDOM!")
|
||||
player:set_physics_override({
|
||||
speed = 1.0,
|
||||
gravity = 1.0,
|
||||
jump = 1.0
|
||||
})
|
||||
|
||||
|
||||
end,
|
||||
func = function(name, param)
|
||||
if param == nil then
|
||||
param = name
|
||||
end
|
||||
players = string.split(param,",");
|
||||
for i=1,#players do
|
||||
local currplayer = minetest.get_player_by_name(players[i]);
|
||||
currplayer:set_physics_override({jump = 1, gravity = 1, speed = 1})
|
||||
minetest.chat_send_player(name, "Reset physics of " .. players[i])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user