Hi,
Im trying to access Player::getMPoints(); in my gossip script but it keeps telling me that its not a member of player.
Declared in player.h:
Code:
uint32 getMPoints();
uint32 mPoints;
Declared in player.cpp:
Code:
uint32 Player::getMPoints()
{
return mPoints;
}
Declared in CharacterHandler.cpp:
Code:
QueryResult* res;
res = CharacterDatabase.Query("SELECT points FROM points WHERE guid='%u'", _player->GetGUID());
_player->mPoints = res->Fetch()->GetUInt32();
_player->BroadcastMessage("You have a total of %u points.", _player->mPoints);
Gossip script:
Code:
void GossipHello(Object* pObject, Player* plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7245, plr);
Menu->AddItem( 0, "You have " << plr->getMPoints() << " points.");
if(AutoSend)
Menu->SendTo(plr);
}
---------- Post added at 10:53 PM ---------- Previous post was at 10:35 PM ----------
it wont link and create the DLL.
In visual studio the code shows red, cant include Setup.h, unresolved variable(s) etc (For 1 script only) but i can compile it with no errors.
Code:
#include "Setup.h"
class Manager : public GossipScript
{
public:
void GossipHello(Object* pObject, Player* plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 7245, plr);
Menu->AddItem( 0, "You have points");
if(AutoSend)
Menu->SendTo(plr);
}
void GossipSelectOption(Object* pObject, Player* plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
switch (IntId)
{
case 0:
GossipHello(pObject, plr, true);
break;
}
};
void SetupTrainerScript(ScriptMgr * mgr)
{
GossipScript * Managert = new Manager();
mgr->register_gossip_script(75555, Managert);
}
};