Code: Select all
function not_deconstruct(event)
local player = game.players[event.player_index]
if player.online_time > 60*60*60*4 then return end
player.clean_cursor()
event.entity.cancel_deconstruction(player.force)
player.print{"msg.not_deconstruct"}
end
Code: Select all
script.on_event(defines.events.on_marked_for_deconstruction, function(event)
not_deconstruct(event)
end)
I can not reproduce this error, and not understand why player_index = nil. Do you have any guesswork?
No mods