mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2024-10-27 10:49:34 +01:00
Update init.lua
This commit is contained in:
parent
be7441143a
commit
abbcd56a6b
10
init.lua
10
init.lua
@ -68,7 +68,7 @@ local function tpc_send(player,coordinates)
|
|||||||
local pname = minetest.get_player_by_name(player)
|
local pname = minetest.get_player_by_name(player)
|
||||||
|
|
||||||
if posx==nil or posy==nil or posz==nil or string.len(posx) > 6 or string.len(posy) > 6 or string.len(posz) > 6 then
|
if posx==nil or posy==nil or posz==nil or string.len(posx) > 6 or string.len(posy) > 6 or string.len(posz) > 6 then
|
||||||
minetest.chat_send_player(pname, "Usage: /tpc <x,y,z>")
|
minetest.chat_send_player(player, "Usage: /tpc <x,y,z>")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ local function tpc_send(player,coordinates)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if posx > 32765 or posx < -32765 or posy > 32765 or posy < -32765 or posz > 32765 or posz < -32765 then
|
if posx > 32765 or posx < -32765 or posy > 32765 or posy < -32765 or posz > 32765 or posz < -32765 then
|
||||||
minetest.chat_send_player(pname, "Error: Invalid coordinates.")
|
minetest.chat_send_player(player, "Error: Invalid coordinates.")
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -90,13 +90,13 @@ local function tpc_send(player,coordinates)
|
|||||||
-- In future release we'll actually query the player who owns the area, if they're online, and ask for their permission.
|
-- In future release we'll actually query the player who owns the area, if they're online, and ask for their permission.
|
||||||
local protected = minetest.is_protected(target_coords)
|
local protected = minetest.is_protected(target_coords)
|
||||||
if protected then
|
if protected then
|
||||||
minetest.chat_send_player(pname, "Error: These coordinates are within a protected area.")
|
minetest.chat_send_player(player, "Error: These coordinates are within a protected area.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_player(pname, 'Teleporting to '..posx..','..posy..','..posz)
|
minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
|
||||||
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
minetest.sound_play("tps_portal", {pos = target_coords, gain = 1.0, max_hear_distance = 10})
|
||||||
pname:setpos(target_coords, false)
|
pname:setpos(target_coords)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tpr_deny(name)
|
local function tpr_deny(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user