Hendrik Langer
3 years ago
2 changed files with 23 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||||
|
minetest.register_privilege("pvp", { |
||||
|
description = "Allow PvP", |
||||
|
give_to_singleplayer= false, |
||||
|
}) |
||||
|
|
||||
|
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage) |
||||
|
if not hitter:is_player() then |
||||
|
return false -- if this is a MOB then give Damage |
||||
|
end |
||||
|
|
||||
|
local player_name = player:get_player_name() |
||||
|
if minetest.check_player_privs(player_name, {pvp=false}) then |
||||
|
return true |
||||
|
end |
||||
|
|
||||
|
local hitter_player_name = hitter:get_player_name() |
||||
|
if minetest.check_player_privs(hitter_player_name, {pvp=false}) then |
||||
|
return true |
||||
|
end |
||||
|
|
||||
|
return false |
||||
|
end) |
Loading…
Reference in new issue