MMOCoin

Likes Likes:  0
Results 1 to 2 of 2

Thread: C++

  1. #1
    Senior Sergeant
    MikExV™'s Avatar
    Join Date
    Feb 2010
    Location
    Ohio
    Posts
    117
    Post Thanks / Like
    Rep Power
    17
    Reputation
    35

    C++

    When I compile I get this error
    Code:
    1>------ Build started: Project: ExtraScripts, Configuration: Release Win32 ------
    1>Compiling...
    1>Bag Stone.cpp
    1>..\..\..\..\..\Bag Stone.cpp(1) : warning C4627: '#include "StdAfx.h"': skipped when looking for precompiled header use
    1>        Add directive to 'Setup.h' or rebuild precompiled header
    1>..\..\..\..\..\Bag Stone.cpp(10) : error C2470: 'Stone' : looks like a function definition, but there is no parameter list; skipping apparent body
    1>..\..\..\..\..\Bag Stone.cpp(22) : error C2653: 'Stone' : is not a class or namespace name
    1>..\..\..\..\..\Bag Stone.cpp(22) : error C2146: syntax error : missing ';' before identifier 'GossipHello'
    1>..\..\..\..\..\Bag Stone.cpp(22) : error C2182: 'Bag' : illegal use of type 'void'
    1>..\..\..\..\..\Bag Stone.cpp(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>..\..\..\..\..\Bag Stone.cpp(27) : warning C4508: 'GossipHello' : function should return a value; 'void' return type assumed
    1>..\..\..\..\..\Bag Stone.cpp(40) : error C2653: 'Stone' : is not a class or namespace name
    1>..\..\..\..\..\Bag Stone.cpp(40) : error C2146: syntax error : missing ';' before identifier 'GossipSelectOption'
    1>..\..\..\..\..\Bag Stone.cpp(40) : error C2182: 'Bag' : illegal use of type 'void'
    1>..\..\..\..\..\Bag Stone.cpp(40) : error C2086: 'int Bag' : redefinition
    1>        ..\..\..\..\..\Bag Stone.cpp(22) : see declaration of 'Bag'
    1>..\..\..\..\..\Bag Stone.cpp(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>..\..\..\..\..\Bag Stone.cpp(66) : error C2143: syntax error : missing ';' before '}'
    1>..\..\..\..\..\Bag Stone.cpp(71) : error C2039: 'Gossip_Compelete' : is not a member of 'Player'
    1>        c:\wowserver\compile\trunk\src\arcemu-world\Player.h(906) : see declaration of 'Player'
    1>..\..\..\..\..\Bag Stone.cpp(77) : error C2065: 'i' : undeclared identifier
    1>..\..\..\..\..\Bag Stone.cpp(83) : warning C4508: 'GossipSelectOption' : function should return a value; 'void' return type assumed
    1>..\..\..\..\..\Bag Stone.cpp(84) : error C2059: syntax error : '}'
    1>..\..\..\..\..\Bag Stone.cpp(84) : error C2143: syntax error : missing ';' before '}'
    1>..\..\..\..\..\Bag Stone.cpp(84) : error C2059: syntax error : '}'
    1>..\..\..\..\..\Bag Stone.cpp(86) : error C2653: 'Teleporter' : is not a class or namespace name
    1>..\..\..\..\..\Bag Stone.cpp(87) : error C2143: syntax error : missing ';' before '{'
    1>..\..\..\..\..\Bag Stone.cpp(87) : error C2447: '{' : missing function header (old-style formal list?)
    1>..\..\..\..\..\Bag Stone.cpp(93) : error C2061: syntax error : identifier 'Teleporter'
    1>Build log was saved at "file://c:\WoWServer\HighRate Core\trunk\src\scripts\projects\2003_int_release\BuildLog.htm"
    1>ExtraScripts - 20 error(s), 3 warning(s)
    ========== Build: 0 succeeded, 1 failed, 5 up-to-date, 0 skipped ==========
    The Script Im trying to compile is
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #ifdef WIN32
    #pragma warning(disable:4305)
    #endif
    
    #define STONEID 6948
    
    class SCRIPT_DECL Bag Stone : 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 Bag Stone::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
              {
              if(Plr->CombatStatus.IsInCombat()) 
                {          
              Plr->BroadcastMessage("You are in combat!");   
              return;
              }
    GossipMenu *Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
    {
    Menu->AddItem(7,"To The Mall", 1);
    Menu->AddItem(3,"Use Hearthstone", 2);
    Menu->AddItem(3,"Custom Instances", 3);
    Menu->AddItem(4,"Teach me all Flight Paths!", 5);
    if(AutoSend)
    Menu->SendTo(Plr);
    }}
    
    void Bag Stone::GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
            GossipMenu * Menu;
            switch(IntId)
    {
            case 0:
            GossipHello(pObject, Plr, true);
            break;
    
            case 2:
                {
                    Plr->CastSpell(Plr, 8690, 0);
                    Plr->Gossip_Complete();
                }
                break;
    
            case 1:
                {
                    Plr->EventTeleport(0, -9276.238281, -2288.817627, 67.916161);
                    Plr->Gossip_Complete();
                }
                break;
    
            case 3:
                {
                    Menu->AddItem(2,"This Function Is Currently Disabled, We appoligize for any inconvenience", 4)
                }
                break;
    
            case 4:
                {
                    Plr->Gossip_Compelete();
                }
                break;
    
            case 5:
                {
                  Plr->SetTaximask(i, 0xFFFFFFFF);
                  Plr->Gossip_Complete();
                }
                break;
    
    }
                 }
           }
           
          void Teleporter::GossipEnd(Object * pObject, Player* Plr)
          {
              GossipScript::GossipEnd(pObject, Plr);
          }
           
          void Teleporter(ScriptMgr * mgr)
          {
              GossipScript * gs = (GossipScript*) new Teleporter();
              mgr->register_gossip_script(112230, gs);
          }
    I made the script when i got bored, im new to C++ Thats why im asking for h3lp I have tried every thing I could think of!




    › See More: C++

    Just got my pc back



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Grunt
    Sdyess94's Avatar
    Join Date
    Jan 2009
    Posts
    36
    Post Thanks / Like
    Rep Power
    18
    Reputation
    60

    Register to remove this ad
    Firstly, function names can't have spaces. So things like
    Code:
     void Bag Stone
    should be something like
    Code:
     void Bag_Stone
    The rest I'd have to look over tomorrow when I get home.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •