PDA

View Full Version : [C++] Anti PVP Script - Kick Players for PVP in Neutral Zones



EzMaN
03-01-10, 10:18 PM
I know some players were looking for something like this, (its actually on our AUDB SVN Project :P )

This will simply kick players when they kill another player in a non pvp zone. You can actually modify this so that it can kick as soon as a players PVP Flag goes active.


/* Modified Script of AntiPvP script for Banned Zones */
/* Original Author Unknown */
/* Modified By WHOS / Tekkeryole */
/* Coded for Aspire HearthStone */
/* Compatible with r1080+ */


#include "StdAfx.h"
#include "Setup.h"

#define MALL_ZONES 2

static uint32 MallZones[MALL_ZONES] = {394, 0};

void EventKillHandler(PlayerPointer pPlr, PlayerPointer pVictim)
{
AreaTable * at = dbcArea.LookupEntry(pPlr->GetMapMgr()->GetAreaID(pPlr->GetPositionX(), pPlr->GetPositionY()));
for(uint32 i = 0; i < MALL_ZONES; i++)
{
if( at && at->ZoneId == MallZones[i] )
{
char onkick[1024];
snprintf((char*)onkick, 1024, "%s was kicked from the server for PvPing in the mall.", pPlr->GetName());
sWorld.SendWorldText(onkick);
pPlr->BroadcastMessage("You were kicked for PvPing in the mall.");
pPlr->Kick(5000);
return;
}
}
}
void SetupAntiPvPAtMall(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &EventKillHandler);
}


##EDIT##

Arc Emu Users use this script:




/* Modified Script of AntiPvP script for Banned Zones */
/* Original Author Unknown */
/* Modified By WHOS / Tekkeryole */
/* Coded for Arc Emu */
/* Compatible with latest Revisions */


#include "StdAfx.h"
#include "Setup.h"

#define MALL_ZONES 2

static uint32 MallZones[MALL_ZONES] = {394, 0};

void EventKillHandler(Player* pPlr, Player* pVictim)
{
AreaTable * at = dbcArea.LookupEntry(pPlr->GetMapMgr()->GetAreaID(pPlr->GetPositionX(), pPlr->GetPositionY()));
for(uint32 i = 0; i < MALL_ZONES; i++)
{
if( at && at->ZoneId == MallZones[i] )
{
char onkick[1024];
snprintf((char*)onkick, 1024, "%s was kicked from the server for PvPing in the mall.", pPlr->GetName());
sWorld.SendWorldText(onkick);
pPlr->BroadcastMessage("You were kicked for PvPing in the mall.");
pPlr->Kick(5000);
return;
}
}
}
void SetupAntiPvPAtMall(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &EventKillHandler);
}



credits to tekkeryole

DoPeT
09-01-10, 05:07 PM
Cool script.

Cocain
27-03-10, 06:27 AM
The diffrence between ArcEmu scripts & Trinity scripts are mostly the pointers, which you have editted correctly.

But when you do not want them to PvP in a certain zone, you better work with defines. Or a restricted area.


Good job on releasing.

Xees
08-04-10, 02:25 PM
very nice +rep

Zylo360
18-06-10, 11:45 AM
Nice script man :)
you seem skilled :) i wonder if you could make a anti GM Power well PvP flagged Ula/script
iv ben lookin for one ALL day :( could ya help me out? Thanks

Dimman
18-06-10, 04:42 PM
Nice script man :)
you seem skilled :) i wonder if you could make a anti GM Power well PvP flagged Ula/script
iv ben lookin for one ALL day :( could ya help me out? Thanks

Look closer nexttime 383
& he didnt make it, it was made by "tekkeryole"

Zylo360
18-06-10, 04:49 PM
ok. my bad thanks