• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ House currency

elkingahmed

New Member
Joined
May 31, 2012
Messages
116
Reaction score
2
im trying to change the currency of the house to gold nuggets from talkactions.cpp and its giving me this error {const is protected}

the code before edit:
Code:
    if((uint32_t)g_game.getMoney(player) < house->getPrice() || !g_game.removeMoney(player, house->getPrice()))
    {
        player->sendCancel("You do not have enough money.");
        g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        return false;
    }

after:
Code:
       if(player->__getItemTypeCount(2157, -1) < house->getPrice() || !g_game.removeItemOfType(player, 2157, house->getPrice(), -1))
        {
                player->sendCancel("You do not have enough gold nuggets.");
                g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
                return false;
        }

error:
In file included from talkaction.h:23:0,
from talkaction.cpp:18:
player.h: In static member function 'static bool TalkAction::houseBuy(Creature*, const string&, const string&)':
player.h:1107:20: error: 'virtual uint32_t Player::__getItemTypeCount(uint16_t, int32_t) const' is protected
virtual uint32_t __getItemTypeCount(uint16_t itemId, int32_t subType = -1) const;
^
talkaction.cpp:562:43: error: within this context
if(player->__getItemTypeCount(2157, -1) < house->getPrice() || !g_game.removeItemOfType(player, 2157, house->getPrice(), -1))
^

thanks in advance :)
 
C++:
if(player->getItemTypeCount(2157) < house->getPrice() || !player->removeItemOfType(2157, house->getPrice()) {
   player->sendCancel("You do not have enough gold nuggets.");
   g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
   return false;
}
 
C++:
if(player->getItemTypeCount(2157) < house->getPrice() || !player->removeItemOfType(2157, house->getPrice()) {
   player->sendCancel("You do not have enough gold nuggets.");
   g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
   return false;
}
Code:
talkaction.cpp: In static member function 'static bool TalkAction::houseBuy(Crea                                                                                        ture*, const string&, const string&)':
talkaction.cpp:562:12: error: 'class Player' has no member named 'getItemTypeCou                                                                                        nt'
if(player->getItemTypeCount(2157) < house->getPrice() || !player->removeItemOfT                                                                                        ype(2157, house->getPrice()) {
            ^
talkaction.cpp:562:67: error: 'class Player' has no member named 'removeItemOfTy                                                                                        pe'
if(player->getItemTypeCount(2157) < house->getPrice() || !player->removeItemOfT                                                                                        ype(2157, house->getPrice()) {
                                                                   ^
talkaction.cpp:562:109: error: expected ')' before '{' token
if(player->getItemTypeCount(2157) < house->getPrice() || !player->removeItemOfT                                                                                        ype(2157, house->getPrice()) {
                                                                                                                                                                                                     ^
talkaction.cpp:568:44: warning: suggest braces around empty body in an 'if' stat                                                                                        ement [-Wempty-body]
  house->setOwnerEx(player->getGUID(), true);
                                            ^
 
Back
Top