Antigrief
Posted: Mon Jan 23, 2017 1:22 pm
Hey there!
Im trying to figure out how to allow a player to deconstruct only his own buildings in a defined timespan.
now i wanted to compare the building owner (event.entity.last_user.name) to the player which is trying to deconstruct, but i am always getting the name of the actual player which is trying to deconstruct it. any idea how i can do this?
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