C++ Help? menu

User Tag List

Thread: C++ Help?

Results 1 to 1 of 1
  1. #1
    B14d3r11's Avatar Sergeant Major
    Reputation
    9
    Join Date
    Jan 2007
    Posts
    179
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C++ Help?

    This script is supposed to:

    Check if player is GM Level D1
    then open a code input
    (Player inputs Tplayer name)
    Checks if Tplayer is a valid character
    Checks if Tplayer is online
    Checks if Tplayer is in same party as player
    then teleports to Tplayer.

    Does my script do all that or does it no check to see if player is in the same party?

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #ifdef WIN32
    #pragma warning(disable:4305)        // warning C4305: 'argument' : truncation from 'double' to 'float'
    #endif
    
    #define ITEM_ID     123456
    #define GM_LEVEL    'D1'
    
    class SCRIPT_DECL GMPorter : public GossipScript
    {
    public:
    
        void GossipHello(Object* pObject, Player* Plr, bool AutoSend);
        void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char* Code);
        void GossipEnd(Object* pObject, Player* Plr);
        void Destroy()
        {
            delete this;
        }
    };
    
    void GMPorter::GossipHello(Object* pObject, Player* Plr, bool AutoSend)
    {
        GossipMenu* Menu;
        objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    
        //Check to see if the player has the appropriate GM level
        if(Plr->GetSession()->CanUseCommand(GM_LEVEL))
            Menu->AddItem(0, "Port To Player", 1, 1);
        Menu->AddItem(0, "[Exit]", 0);
    
        if(AutoSend)
            Menu->SendTo(Plr);
    }
    
    void GMPorter::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char* Code)
    {
        GossipMenu* Menu;
    
        switch(IntId)
        {
        case 0:      //End Gossip
            Plr->Gossip_Complete();
            break;
    
        case 1:      //Port to Player
            {
                    //No name entered
                    if(!Code)
                    {
                        Plr->BroadcastMessage("%s You have not entered a name to port to!", MSG_COLOR_RED);
                        Plr->Gossip_Complete();
                    }
    
                    Player* pPlayer = objmgr.GetPlayer(Code, false);
    
                    //Can't find the player entered
                    if(!pPlayer)
                    {
                        Plr->BroadcastMessage("%s Player is not online or could not be found.", MSG_COLOR_RED);
                        Plr->Gossip_Complete();
                    }
    
                    //If player has a group
                    if(pPlayer->GetGroup() != NULL)
                    {
                        Plr->BroadcastMessage("%s Player has a group, thus you cannot teleport to him.", MSG_COLOR_RED);
                        Plr->Gossip_Complete();
                    }
    
                    else
                    {
                        float XLoc = pPlayer->GetPositionX();
                        float YLoc = pPlayer->GetPositionY();
                        float ZLoc = pPlayer->GetPositionZ();
                        float OLoc = pPlayer->GetOrientation();
                        uint32 Map = pPlayer->GetMapId();
    
                        Plr->EventTeleport(Map, XLoc, YLoc, ZLoc);
                        Plr->SetOrientation(OLoc);
                        Plr->BroadcastMessage("%s You have been successfully teleported to %s .", MSG_COLOR_RED, pPlayer->GetName());
                        Plr->Gossip_Complete();
                    }
            }break;
        }
    };
    
    void GMPorter::GossipEnd(Object* pObject, Player* Plr)
    {
        GossipScript::GossipEnd(pObject, Plr);
    };
    
    void SetupGMPorter(ScriptMgr* mgr)
    {
        GossipScript* gs = (GossipScript*) new GMPorter();
        mgr->register_item_gossip_script(ITEM_ID, gs);
    };

    C++ Help?

Similar Threads

  1. Help WoW Fish-Bot
    By Eliteplague in forum World of Warcraft General
    Replies: 2
    Last Post: 12-10-2024, 05:46 PM
  2. HELP: Gold Scam Exploit
    By GoldDragon in forum World of Warcraft General
    Replies: 11
    Last Post: 01-23-2007, 07:26 PM
  3. Banner Ad Redesign help
    By Matt in forum Community Chat
    Replies: 57
    Last Post: 07-08-2006, 08:40 PM
  4. Hit points and talent points? Please help
    By hankusdankus in forum World of Warcraft General
    Replies: 6
    Last Post: 05-04-2006, 02:00 PM
  5. bot help
    By xwhitedeathx in forum World of Warcraft General
    Replies: 3
    Last Post: 05-01-2006, 03:50 AM
All times are GMT -5. The time now is 09:29 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search