Well couldn't you just make the zone a sanctuary? Or are you into more disciplinary solutions :P.
Well I wrote a script with the OnKillPlayer hook, which means that the victim has to die first :/ because I don't think there is a hook for OnAttack with snares, sheep, etc... Well this one revives the victim and kills the killer, but its after the victim has died.. so, hope you use it! :P
Code:
//Anti-PvP Script
//Created by Cyanide for Kaato
#include "StdAfx.h"
#include "Setup.h"
#define kmapid YOURMAPIDHERE
void AntiPvp(Player * pPlayer, Player * pVictim)
{
if(pPlayer->GetMapId() == kmapid && pVictim->GetMapId() == kmapid)//Make sure that they both are on the same map, you can change it if you want.
{
pPlayer->KillPlayer();
pPlayer->BroadcastMessage("|cffFF0000You have been caught killing %s in a non-PvP area. You have been killed as a punishment. Any further PvP in this area will result in a ban.|r", pVictim->GetName());//Feel free to edit.
pVictim->ResurrectPlayer();
pVictim->BroadcastMessage("|cff00FF00%s has killed you in a non-PvP zone, and they have been killed as a punishment, and you have been revived. If %s continues to attack you, please report him/her.|r", pPlayer->GetName(), pPlayer->GetName());//Feel free to edit.
}
else
{
return;
}
}
void SetupAntiPvP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void *) AntiPvp);
}