• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] GetPlayer ': is not a member of' Player '

Status
Not open for further replies.

faiver

Esteemed Member
line

if (Player* plr = Player::GetPlayer(*player, itr->guid))
{
if (USE_TOKEN)
{
sprintf(msg, "Accept %s's Challenge of %u tokens", plr->GetName().c_str(), itr->amount);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_MAIN, itr->guid);
sprintf(msg, "Decline %s's Challenge of %u tokens", plr->GetName().c_str(), itr->amount);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_INFO, itr->guid);
}
else
{
sprintf(msg, "Accept %s's Challenge of %ug", plr->GetName().c_str(), itr->amount/10000);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_MAIN, itr->guid);
sprintf(msg, "Decline %s's Challenge of %ug", plr->GetName().c_str(), itr->amount/10000);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_INFO, itr->guid);
}

:/
thanks for any help
 

Tommy

Founder
line

if (Player* plr = Player::GetPlayer(*player, itr->guid))
{
if (USE_TOKEN)
{
sprintf(msg, "Accept %s's Challenge of %u tokens", plr->GetName().c_str(), itr->amount);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_MAIN, itr->guid);
sprintf(msg, "Decline %s's Challenge of %u tokens", plr->GetName().c_str(), itr->amount);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_INFO, itr->guid);
}
else
{
sprintf(msg, "Accept %s's Challenge of %ug", plr->GetName().c_str(), itr->amount/10000);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_MAIN, itr->guid);
sprintf(msg, "Decline %s's Challenge of %ug", plr->GetName().c_str(), itr->amount/10000);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, GOSSIP_SENDER_INFO, itr->guid);
}

:/
thanks for any help

I believe you're trying to think of "sObjectAccessor->FindPlayer(itr->guid)". Using snprintf is also ugly and not the best practice. I suggest using std::eek:stringstream.

Finished work:

Code:
[COLOR="#00FF00"]std::ostringstream ss;[/COLOR]
if (Player* plr = [COLOR="#00FF00"]sObjectAccessor->FindPlayer(itr->guid)[/COLOR])
{
    if (USE_TOKEN)
    {
[COLOR="#00FF00"]        ss << "Accept"
            << player->GetName() << "'s Challenge of"
            << itr->amount << " tokens";[/COLOR]
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, [COLOR="#00FF00"]ss.str().c_str()[/COLOR], GOSSIP_SENDER_MAIN, itr->guid);
[COLOR="#00FF00"]        ss.str("")
        ss << "Decline"
            << player->GetName() << "'s Challenge of"
            << itr->amount << " tokens";[/COLOR]
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, [COLOR="#00FF00"]ss.str().c_str()[/COLOR], GOSSIP_SENDER_INFO, itr->guid);
    }
    else
    {
[COLOR="#00FF00"]        ss << "Accept"
            << player->GetName() << "'s Challenge of"
            << itr->amount / 10000 << " ug";[/COLOR]
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, [COLOR="#00FF00"]ss.str().c_str()[/COLOR], GOSSIP_SENDER_MAIN, itr->guid);
[COLOR="#00FF00"]        ss.str("")
        ss << "Decline"
            << player->GetName() << "'s Challenge of"
            << itr->amount / 10000 << " ug";[/COLOR]
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, [COLOR="#00FF00"]ss.str().c_str()[/COLOR], GOSSIP_SENDER_INFO, itr->guid);
    }
 
Status
Not open for further replies.
Top