From aa772124b38bb27b519bc561a50a412c8025f2b6 Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Wed, 9 Sep 2015 07:41:11 -0400 Subject: [PATCH] Update init.lua Check if the player exists before doing warp queue. --- init.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 259e75a..c723453 100644 --- a/init.lua +++ b/init.lua @@ -46,15 +46,17 @@ do_warp_queue = function() local t = minetest.get_us_time() for i = table.getn(warps_queue),1,-1 do local e = warps_queue[i] - if e.p:getpos().x == e.pos.x and e.p:getpos().y == e.pos.y and e.p:getpos().z == e.pos.z then - if t > e.t then - warp(e.p, e.w) + if e.p:getpos() then + if e.p:getpos().x == e.pos.x and e.p:getpos().y == e.pos.y and e.p:getpos().z == e.pos.z then + if t > e.t then + warp(e.p, e.w) + table.remove(warps_queue, i) + end + else + minetest.sound_stop(e.sh) + minetest.chat_send_player(e.p:get_player_name(), "You have to stand still for " .. warps_freeze .. " seconds!") table.remove(warps_queue, i) end - else - minetest.sound_stop(e.sh) - minetest.chat_send_player(e.p:get_player_name(), "You have to stand still for " .. warps_freeze .. " seconds!") - table.remove(warps_queue, i) end end if table.getn(warps_queue) == 0 then