Outdoor PvP Custom

Hi all,

i have a problem of pointer in my outdoor pvp custom…

void OutdoorPvPOU::ResurrectSystem(TeamId team)
{
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
{
if ((*itr)->isDead())
{
(*itr)->TeleportTo(SPAWN[(*itr)->GetTeamId()].map,SPAWN[(*itr)->GetTeamId()].x,SPAWN[(*itr)->GetTeamId()].y,SPAWN[(*itr)->GetTeamId()].z,SPAWN[(*itr)->GetTeamId()].o,0);
(*itr)->ResurrectPlayer(100,false);
}
}
}

error: base operand of “->” is not a pointer

I tried several functions to designate the players in area, but I get this error every time

You know the solution?

Thanks for advance

Sorry for my bad english

typedef std::set PlayerSet;

So (*itr) is a number.

Obviously 123->isDead()

wont work…

You need to get the player.

Player* player = sObjectAccessor->FindPlayer((*itr)); // finds player by guid. (*itr) is the guid
if(!player)
continue; // player not found, skip it
Then use player->isDead() and so on.

Exactly, thanks for help /emoticons/default_smile.png

now I can not with the creatures…

for (CreatureSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) { if (Creature* creature = sObjectMgr->GetCreatureData(*itr)) { creature->RemoveAurasDueToSpell(SPELL_HONNOR); } }

Try

for (CreatureSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) { if (Creature* creature = sObjectAccessor->FindCreature(*itr)) { creature->RemoveAurasDueToSpell(SPELL_HONNOR); } }

FindCreature isnt coded. Its just in the header.

Use sObjectAccessor->FindUnit(*itr)
Then if you need to, use ToCreature() on the recieved unit (if it isnt NULL)
and check if the result is not NULL before using.