Hendrik Langer 3 years ago
parent
commit
402af59a76
  1. 1
      init.lua
  2. 22
      nopvp.lua

1
init.lua

@ -19,6 +19,7 @@ dofile(creative_regions.modpath.."/chatcommands.lua")
dofile(creative_regions.modpath.."/items.lua") dofile(creative_regions.modpath.."/items.lua")
dofile(creative_regions.modpath.."/mod_areas.lua") dofile(creative_regions.modpath.."/mod_areas.lua")
dofile(creative_regions.modpath.."/arena.lua") dofile(creative_regions.modpath.."/arena.lua")
dofile(creative_regions.modpath.."/nopvp.lua")
dofile(creative_regions.modpath.."/vehicles.lua") dofile(creative_regions.modpath.."/vehicles.lua")

22
nopvp.lua

@ -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…
Cancel
Save