Im trying to figure out how to allow a player to deconstruct only his own buildings in a defined timespan.
Code: Select all
script.on_event(defines.events.on_marked_for_deconstruction, function(event)
local player = game.players[event.player_index]
if not player.admin and ConvertMinutes(player.online_time) < ANTIGRIEF_TIMER then
event.entity.cancel_deconstruction("player")
end
end