Fix TPASK
This commit is contained in:
parent
a132fadacd
commit
596878a2c6
@ -46,7 +46,8 @@ local function cmd_tpcommon(name,tname,direction)
|
|||||||
return false, "Could not find player."
|
return false, "Could not find player."
|
||||||
end
|
end
|
||||||
|
|
||||||
if tpask.requests[tname] and tpask.requests[tname].when > minetest.get_us_time() - ess_tpa_timeout * 100000 then
|
local reqs = tpask.requests[tname]
|
||||||
|
if reqs and ess_tpa_timeout > 0 and reqs.when > minetest.get_gametime() - ess_tpa_timeout then
|
||||||
return false, "There are currently pending requests regarding this player. Please wait."
|
return false, "There are currently pending requests regarding this player. Please wait."
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ local function cmd_tpcommon(name,tname,direction)
|
|||||||
minetest.chat_send_player(tname, name .. " has requested "..message..".")
|
minetest.chat_send_player(tname, name .. " has requested "..message..".")
|
||||||
minetest.chat_send_player(tname, "Run /tpaccept to accept or /tpadeny to deny.")
|
minetest.chat_send_player(tname, "Run /tpaccept to accept or /tpadeny to deny.")
|
||||||
if ess_tpa_timeout > 0 then
|
if ess_tpa_timeout > 0 then
|
||||||
minetest.chat_send_player(tname, "You have "..ess_tpa_timeout.." seconds to respond.")
|
minetest.chat_send_player(tname, string.format("You have %d seconds to respond.", ess_tpa_timeout))
|
||||||
end
|
end
|
||||||
tpask.requests[tname] = {when = minetest.get_gametime()}
|
tpask.requests[tname] = {when = minetest.get_gametime()}
|
||||||
if direction == 1 then
|
if direction == 1 then
|
||||||
@ -84,7 +85,7 @@ end
|
|||||||
local function cmd_tpaconfirm(name)
|
local function cmd_tpaconfirm(name)
|
||||||
local reqs = tpask.requests[name]
|
local reqs = tpask.requests[name]
|
||||||
local me = minetest.get_player_by_name(name)
|
local me = minetest.get_player_by_name(name)
|
||||||
if not reqs or (tpask.timeout > 0 and tpask.requests[name].when < minetest.get_gametime() - ess_tpa_timeout) then
|
if not reqs or (ess_tpa_timeout > 0 and reqs.when < minetest.get_gametime() - ess_tpa_timeout) then
|
||||||
return false, "You have no pending teleport requests."
|
return false, "You have no pending teleport requests."
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ end
|
|||||||
|
|
||||||
local function cmd_tpadeny(name)
|
local function cmd_tpadeny(name)
|
||||||
local reqs = tpask.requests[name]
|
local reqs = tpask.requests[name]
|
||||||
if not reqs or tpask.requests[name].when < minetest.get_gametime() - tpask.timeout then
|
if not reqs or reqs.when < minetest.get_gametime() - ess_tpa_timeout then
|
||||||
return false, "You have no pending teleport requests."
|
return false, "You have no pending teleport requests."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user