#define NOPVPGUARD 55555 <-- npc idCode:void OnEnterCombat(Player *pPlayer, Unit *pTarget); //Function Header #define NOPVPGUARD 55555 #define MAX_DISTANCE 70.0 #define KILL_SPELL 5 #define UNIT_INSTANT true #define ZONE 530 // void OnEnterCombat(Player *pPlayer, Unit *pTarget) { bool InZone = false; if (pPlayer->GetZoneId() == ZONE) {InZone = true;} if (InZone == false) {return;} Creature *pCreature = pPlayer->GetMapMgr()->GetSqlIdCreature(NOPVPGUARD); if (!pCreature) {return;} //No creature found, handle gracefully and return float dist = pCreature->CalcDistance(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()); Unit *pUnit = (Unit *)pPlayer; //Cast the pointer to a Unit object pCreature->GetAIInterface()->AttackReaction(pUnit,0,0); //Attack! (not sure about the second and third params here, set to 0 to be safe if (KILL_SPELL != NULL) pCreature->CastSpell(pUnit,KILL_SPELL,UNIT_INSTANT); } void SetupOnEnterCombat(ScriptMgr * mgr) { mgr->register_hook(SERVER_HOOK_EVENT_ON_ENTER_COMBAT, (void*) OnEnterCombat); }
#define ZONE 530 <-- map
u need to fix some stuff cos OnEnterCombat doesnt work
i got the script from ascenemu ages ago








Reply With Quote

?
