mirror of
https://github.com/minetest-mods/teleport-request.git
synced 2025-01-08 14:07:28 +01:00
commit
1174be55a5
36
init.lua
36
init.lua
@ -77,16 +77,24 @@ local function parti2(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Teleport Request System
|
-- Teleport Request System
|
||||||
|
function clear_tpr_list(name)
|
||||||
|
if tpr_list[name] then
|
||||||
|
tpr_list[name] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function clear_tphr_list(name)
|
||||||
|
if tphr_list[name] then
|
||||||
|
tphr_list[name] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function tpr_send(sender, receiver)
|
function tpr_send(sender, receiver)
|
||||||
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
if minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
-- Write name values to list and clear old values.
|
-- Write name values to list and clear old values.
|
||||||
tpr_list[receiver] = sender
|
tpr_list[receiver] = sender
|
||||||
-- Teleport timeout delay
|
-- Teleport timeout delay
|
||||||
minetest.after(timeout_delay, function(name)
|
minetest.after(timeout_delay, clear_tpr_list, receiver)
|
||||||
if tpr_list[name] then
|
|
||||||
tpr_list[name] = nil
|
|
||||||
end
|
|
||||||
end, sender)
|
|
||||||
if receiver == "" then
|
if receiver == "" then
|
||||||
minetest.chat_send_player(sender, S("Usage: /tpr <Player name>"))
|
minetest.chat_send_player(sender, S("Usage: /tpr <Player name>"))
|
||||||
return
|
return
|
||||||
@ -117,11 +125,7 @@ function tpr_send(sender, receiver)
|
|||||||
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
tpr_list[receiver] = sender
|
tpr_list[receiver] = sender
|
||||||
-- Teleport timeout delay
|
-- Teleport timeout delay
|
||||||
minetest.after(timeout_delay, function(name)
|
minetest.after(timeout_delay, clear_tpr_list, receiver)
|
||||||
if tpr_list[name] then
|
|
||||||
tpr_list[name] = nil
|
|
||||||
end
|
|
||||||
end, sender)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -130,11 +134,7 @@ function tphr_send(sender, receiver)
|
|||||||
-- Write name values to list and clear old values.
|
-- Write name values to list and clear old values.
|
||||||
tphr_list[receiver] = sender
|
tphr_list[receiver] = sender
|
||||||
-- Teleport timeout delay
|
-- Teleport timeout delay
|
||||||
minetest.after(timeout_delay, function(name)
|
minetest.after(timeout_delay, clear_tphr_list, receiver)
|
||||||
if tphr_list[name] then
|
|
||||||
tphr_list[name] = nil
|
|
||||||
end
|
|
||||||
end, sender)
|
|
||||||
if receiver == "" then
|
if receiver == "" then
|
||||||
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
|
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
|
||||||
return
|
return
|
||||||
@ -164,11 +164,7 @@ function tphr_send(sender, receiver)
|
|||||||
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
if not minetest.check_player_privs(sender, {tp_admin = true}) then
|
||||||
tphr_list[receiver] = sender
|
tphr_list[receiver] = sender
|
||||||
-- Teleport timeout delay
|
-- Teleport timeout delay
|
||||||
minetest.after(timeout_delay, function(name)
|
minetest.after(timeout_delay, clear_tphr_list, receiver)
|
||||||
if tphr_list[name] then
|
|
||||||
tphr_list[name] = nil
|
|
||||||
end
|
|
||||||
end, sender)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user