[Mod] No PVP Zone [nopvpzone]

Post Reply
User avatar
AiTechEye
Member
Posts: 892
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

[Mod] No PVP Zone [nopvpzone]

by AiTechEye » Post

Version: 1
License: CC0
Depends: none

No pvp zone
If you don't want fighting players in spawn or something like that

set the position and radius in init.lua

Code: Select all

local pos={x=0,y=0,z=0}
local rad=500

minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
	local pos1=player:getpos()
	local r=math.sqrt((pos.x-pos1.x)*(pos.x-pos1.x) + (pos.y-pos1.y)*(pos.y-pos1.y)+(pos.z-pos1.z)*(pos.z-pos1.z))
	if hitter and hitter:is_player() and hitter:get_player_name()~=player:get_player_name()
	and r and not (r==math.huge or r==-math.huge or r~=r) and r<rad then
		return true
	end
end)
Attachments
ByAiTechEye-nopvpzone.zip
(780 Bytes) Downloaded 46 times

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] No PVP Zone [nopvpzone]

by azekill_DIABLO » Post

wow, it's an handy mod !

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] No PVP Zone [nopvpzone]

by ManElevation » Post

humm...use ful
My Public Mods! Discord: Rottweiler Games#3368

User avatar
Linuxdirk
Member
Posts: 2713
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] No PVP Zone [nopvpzone]

by Linuxdirk » Post

I wonder if it"s possible the other way round, too. Having a non PVP world and defining a PVP zone.

User avatar
AiTechEye
Member
Posts: 892
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] No PVP Zone [nopvpzone]

by AiTechEye » Post

just to change the r<rad to r>rad

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] No PVP Zone [nopvpzone]

by azekill_DIABLO » Post

Linuxdirk wrote:I wonder if it"s possible the other way round, too. Having a non PVP world and defining a PVP zone.
An arena like zone? That an interesting concept... i seriously need a server :\

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] No PVP Zone [nopvpzone]

by ManElevation » Post

azekill_DIABLO wrote:
Linuxdirk wrote:I wonder if it"s possible the other way round, too. Having a non PVP world and defining a PVP zone.
An arena like zone? That an interesting concept... i seriously need a server :\
yea u can do that...
AiTechEye wrote:just to change the r<rad to r>rad
My Public Mods! Discord: Rottweiler Games#3368

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] No PVP Zone [nopvpzone]

by azekill_DIABLO » Post

ManElevation wrote: yea u can do that...
AiTechEye wrote:just to change the r<rad to r>rad
But i read that already little potato :P why do you think i say it?

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] No PVP Zone [nopvpzone]

by ManElevation » Post

azekill_DIABLO wrote:
ManElevation wrote: yea u can do that...
AiTechEye wrote:just to change the r<rad to r>rad
But i read that already little potato :P why do you think i say it?
im dumb
My Public Mods! Discord: Rottweiler Games#3368

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] No PVP Zone [nopvpzone]

by azekill_DIABLO » Post

no you're just the head in the moon :D

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests