diff --git a/Addons/Admin/admin.lua b/Addons/Admin/admin.lua index 5bea0a1d..d6d446b4 100644 --- a/Addons/Admin/admin.lua +++ b/Addons/Admin/admin.lua @@ -209,5 +209,6 @@ end) function Admin.bring(player,by_player) local player = Game.get_player(player) local _player = Game.get_player(by_player) + if not player or not _player then return end player.teleport(_player.surface.find_non_colliding_position('player',_player.position,32,1),_player.surface) end \ No newline at end of file diff --git a/Addons/Admin/inventory-search.lua b/Addons/Admin/inventory-search.lua index ccdc1d0c..db16b272 100644 --- a/Addons/Admin/inventory-search.lua +++ b/Addons/Admin/inventory-search.lua @@ -49,16 +49,18 @@ function search_player(player) for category,items in pairs(_root_tree) do for _,_inventory in pairs(inventorys) do local inventory = player.get_inventory(_inventory) - for _,item in pairs(items) do - local found = inventory.remove(item) - if found > 0 then take_action(player,item,category) end + if inventory then + for _,item in pairs(items) do + local found = inventory.remove(item) + if found > 0 then take_action(player,item,category) end + end end end end end Event.register(defines.events.on_tick,function(event) - if (game.tick%1800) == 0 then + if (game.tick%900) == 0 then local players = game.connected_players if #players == 0 then return end local player = players[math.random(#players)]