forked from minetest-mods/mesecons
Sanity checks for commandblock commands.
This commit is contained in:
parent
63a18f1a51
commit
e45a2a511e
|
@ -16,6 +16,9 @@ minetest.register_chatcommand("tell", {
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param)
|
minetest.chat_send_player(name, "Invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if not minetest.env:get_player_by_name(target) then
|
||||||
|
minetest.chat_send_player(name, "Invalid target: " .. target)
|
||||||
|
end
|
||||||
minetest.chat_send_player(target, name .. " whispers: " .. message)
|
minetest.chat_send_player(target, name .. " whispers: " .. message)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -38,7 +41,12 @@ minetest.register_chatcommand("hp", {
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param)
|
minetest.chat_send_player(name, "Invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.get_player_by_name(target):set_hp(value)
|
local player = minetest.env:get_player_by_name(target)
|
||||||
|
if player then
|
||||||
|
player:set_hp(value)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name, "Invalid target: " .. target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user