Forum
 
Go Back   D3scene > Hot Games > WoW forum > WoW Support

Help with C++

This is a discussion on Help with C++ within the WoW Support forum part of the WoW forum category; hello, i want to use this code to make a guard attack anyone who toggles pvp, i am making only ...

Welcome on D3scene.com! Make sure to register - it's free and very quick! You have to register before you can post and participate in our discussions with 35000 other registered members. Downloads, user profiles and some forums can only be seen by registered members. After you create your free account you will be able to customize many options, you will have the full access to new hacks, latest cheats and last but not least will see no advertisements at all. We would love to see you around in our community!
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-10-2008, 08:13 PM
Wannabe Member
 
Join Date: Mar 2008
Posts: 23
Reputation: 1
Rep Power: 1
Arthur1265 is an unknown quantity at this point
Help with C++

hello, i want to use this code to make a guard attack anyone who toggles pvp, i am making only 1 mall for both alliance and horde.. and even though making it a sanctuary doesnt stop all pvp (/pvp still toggles) i want to add some guards... however i have NO idea on how to compile.. and let alone how to attach the script to a npc.. please please help. any help would be appreciated. Thanks in advance.

heres the code

Code:
#include "StdAfx.h"
void OnEnterCombat(Player *pPlayer, Unit *pTarget); //Function Header
extern "C" SCRIPT_DECL uint32 _exp_get_version()
{
    return MAKE_SCRIPT_VERSION(SCRIPTLIB_VERSION_MAJOR, SCRIPTLIB_VERSION_MINOR);
}

extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
     ::sScriptMgr.register_hook(SERVER_HOOK_EVENT_ON_ENTER_COMBAT, OnEnterCombat);
}
#ifdef WIN32

BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
{
    return TRUE;
}

#endif

#define NOPVPGUARD 1 //ID for the anti PVP creature
#define MAX_DISTANCE 70.0 //Distance they must be within for the guard to agro
#define KILL_SPELL 5 //The spell used when they get agro - death touch
#define UNIT_INSTANT true //Instant cast spell? true or false
unsigned Zones[4] = { 33,440,618,3523, }; //STV,Tanaris,winterspring,netherstorm
void OnEnterCombat(Player *pPlayer, Unit *pTarget)
{
    bool InZone = false;
    for (int C = 0; C < 4; C++) 
        {
        if (pPlayer->GetZoneId() == Zones[C]) {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());
    if (dist <= MAX_DISTANCE)
        {
        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);
        }
}
Reply With Quote
D3scene
Welcome to D3scene - probably the best location for all Gamers.

To participate in our friendly environment you have to register. After completing registration you will have full access to all threads and features. We care about members and try to make your stay as pleasant as possible. We are unique with the following feature for members - you will not see a single Advertisement!


The best: registration is completely free. It will not cost you a single penny or harm you in any way. You will lose nothing except 1 minute of your time. So why not register? We would be happy to see you around!
  #2  
Old 07-13-2008, 02:33 AM
skhouri10's Avatar
So.... Whats up???
 
Join Date: Nov 2007
Location: Silvermoon in Sunfury Spire
Posts: 343
Reputation: 143
Rep Power: 1
skhouri10 will become famous soon enoughskhouri10 will become famous soon enough
Send a message via MSN to skhouri10
i have no idea how to either lol. Do u mind if i ask u where u learn this from?
Reply With Quote
  #3  
Old 07-14-2008, 10:26 AM
Dougle101's Avatar
Advanced Hacker
 
Join Date: Jun 2007
Location: In my Virtual Reality
Posts: 483
Reputation: 38
Rep Power: 2
Dougle101 is on a distinguished road
Send a message via AIM to Dougle101 Send a message via MSN to Dougle101
Would be done by saving it as a script and putting it in the script folder, then it depends on what server you are running, Ascent or Mangos?
Reply With Quote
  #4  
Old 08-13-2008, 09:51 PM
tauren224's Avatar
Guru
 
Join Date: Jan 2008
Location: Beyond the Sunwell
Posts: 94
Reputation: 12
Rep Power: 1
tauren224 is on a distinguished road
This is pretty off-topic but, skhouri10, is your sig made at Pivot? xD
Reply With Quote
D3scene
Welcome to D3scene - probably the best location for all Gamers.

To participate in our friendly environment you have to register. After completing registration you will have full access to all threads and features. We care about members and try to make your stay as pleasant as possible. We are unique with the following feature for members - you will not see a single Advertisement!


The best: registration is completely free. It will not cost you a single penny or harm you in any way. You will lose nothing except 1 minute of your time. So why not register? We would be happy to see you around!
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 01:37 PM.


vBulletin style developed by Transverse Styles
Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.

»About D3scene »Navigation