From ae5975e674122148f979a211bcf82094c5d0a206 Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 10 Oct 2012 19:46:12 +0000 Subject: Added an option to disable/enable PVP on a per world basis git-svn-id: http://mc-server.googlecode.com/svn/trunk@944 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ClientHandle.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/ClientHandle.cpp') diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index f019fd862..f526432b4 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -887,6 +887,15 @@ void cClientHandle::HandleUseEntity(int a_TargetEntityID, bool a_IsLeftClick) { virtual bool Item(cEntity * a_Entity) override { + if (a_Entity->GetWorld()->IsPVPEnabled() == false) + { + // PVP is disabled + if (a_Entity->IsA("cPlayer") && Instigator->IsA("cPlayer")) + { + // Player is hurting another player which is not allowed when PVP is disabled so ignore it + return true; + } + } if (a_Entity->IsA("cPawn")) { reinterpret_cast(a_Entity)->TakeDamage(Damage, Instigator); -- cgit v1.2.3