Jump to content

[Help] groups


Guest tra1nee

Recommended Posts

I need to make a loop through all group members to apply an auras on them.

how could i do this?

Player *plr = m_caster->getVictim();

Group *grp = plr->GetGroup();

for(itr = grp->m_memberSlots.begin(); itr != grp->m_memberSlots.end(); ++itr)

{

...

}

this is looping through group::memberslots struct, so i can get players guid only.

so... is there a better way to loop through group, or can i get players by theyr guids?

EDIT: main question would be: How to get players by they guid`s?, and i mean Player *player = get by guid or sth

thanks in advance

Link to comment
Share on other sites

Player *plr = m_caster->getVictim();

if(Group *pGroup = plr->GetGroup())
{
      for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
     {
               Player* pGroupGuy = itr->getSource();
               if(!pGroupGuy)
                   continue;

              // Add aura here (prolly by pGroupGuy->CastSpell( pGroupGuy, id, true/false);

      }
}

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use