AntumDeluge wrote:Is it possible to create a PVP area using this mod, leaving the rest of the map non-PVP? I'm sorry, I haven't been able to try it out to see for myself yet. My guess is that it is not possible as PVP seems to be an engine setting for the entire map.
is this what u are looking?
https://github.com/taikedz/pvp_areas/bl ... r/init.lua
if that dosent work than check out this code
Code: Select all
minetest.register_privilege("pvp", {description = "Enables pvp.", give_to_singleplayer = true})
minetest.register_on_player_receive_fields(function(player, formname, fields)
localname = player:get_player_name()
if privs.pvp then
pvptable[localname] = 1
minetest.chat_send_player(localname,
"PvP was enabled for "..localname)
player:hud_remove(pvpdisabled)
})
return
else
pvptable[localname] = 0
minetest.chat_send_player(localname,
"PvP was disabled for "..localname)
player:hud_remove(pvpenabled)
return
end
end
end)
if minetest.setting_getbool("enable_pvp") then
if minetest.register_on_punchplayer then
minetest.register_on_punchplayer(
function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage, pvp)
if not hitter:is_player() then
return false
end
local localname = player:get_player_name()
local hittername = hitter:get_player_name()
if pvptable[localname] == 1 and pvptable[hittername] == 1 then
return false
else
minetest.chat_send_player(localname,
"The player "..hittername.." is trying to attack you.")
minetest.chat_send_player(hittername,
"The player "..localname.." does not have PvP activated.")
return true
end
end)
end
end
i havent tested the code so idk if it works, but you shouldt need to do many fixes to make it work
use this code and the privilege areas.
like ruben said define the area were u want the pvp
Code: Select all
on_enter = {
grant = {"pvp"}
},
on_leave = {
take = {"pvp"}