Skip to content
Snippets Groups Projects
Commit 0b5f1875 authored by PilzAdam's avatar PilzAdam
Browse files

Make sure that coordinates passed to /teleport are actual numbers

parent a75afb85
No related branches found
No related tags found
No related merge requests found
......@@ -272,6 +272,9 @@ minetest.register_chatcommand("teleport", {
local teleportee = nil
local p = {}
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
p.x = tonumber(p.x)
p.y = tonumber(p.y)
p.z = tonumber(p.z)
teleportee = minetest.get_player_by_name(name)
if teleportee and p.x and p.y and p.z then
minetest.chat_send_player(name, "Teleporting to ("..p.x..", "..p.y..", "..p.z..")")
......@@ -302,6 +305,9 @@ minetest.register_chatcommand("teleport", {
local p = {}
local teleportee_name = nil
teleportee_name, p.x, p.y, p.z = string.match(param, "^([^ ]+) +([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
p.x = tonumber(p.x)
p.y = tonumber(p.y)
p.z = tonumber(p.z)
if teleportee_name then
teleportee = minetest.get_player_by_name(teleportee_name)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment