• 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] Just a few errors I need help with

Status
Not open for further replies.

Jameyboor

Retired Staff
Code:
Error   10      error C2039: 'isAlive' : is not a member of 'Creature'  C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   185
the method named isAlive does not exist within the Creature class, the actual method you probably want to use is : 'IsAlive()' , you forgot the capital I :)

Code:
Error   40      error C2059: syntax error : ')' C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   667
Error   43      error C2059: syntax error : ')' C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   668
Error   46      error C2059: syntax error : ')' C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   669
Error   49      error C2059: syntax error : ')' C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   674
Error   52      error C2059: syntax error : ')' C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   675
Error   55      error C2059: syntax error : ')' C:\Users\Brendans\Documents\GitHub\TrinityCore\src\server\scripts\OutdoorPvP\OutdoorPvPCA.cpp   724

the code:
Code:
 me->SummonCreature(500117, me->GetPositionX()2.0f, me->GetPositionY()7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 1000);
                                                me->SummonCreature(500117, me->GetPositionX()6.0f, me->GetPositionY()12.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 1000);
                                                me->SummonCreature(500117, me->GetPositionX()-2.0f, me->GetPositionY()2.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 1000);

                                                me->SummonCreature(500107, me->GetPositionX()2.0f, me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 1000);
                                                me->SummonCreature(500107, me->GetPositionX()6.0f, me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 1000);
You want to add a number to a return value of a method, GetPositionX, and Y here, but you don't use the addition operator ( + ).

Those are just a few, there are lots of other errors that require some attention.
 

brh11

Respected Member
Thanks so much jameyboor! The only ones that im having trouble with still is when the error says something like this,left of '->ResurrectPlayer' must point to class/struct/union/generic type Thank you so much though
 

Tommy

Founder
Because you aren't using the PlayerSet iterator correctly. This is how you would do it:

Code:
        for (PlayerSet::iterator itr = m_players[team].begin(); itr !=  m_players[team].end();)
        {
            uint64 playerGuid = *itr;
            ++itr;

            if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
                if (player->isDead)
                {
                    player->TeleportTo(SPAWN[(*itr)->GetTeamId()].map,SPAWN[(*itr)->GetTeamId()].x,SPAWN[(*itr)->GetTeamId()].y,SPAWN[(*itr)->GetTeamId()].z,SPAWN[(*itr)->GetTeamId()].o,0);
                    player->ResurrectPlayer(100, false);
                }
       }
 

brh11

Respected Member
Thank you tommy! Sorry this is my first time doing anything with iterators.Ive fixed up all the playersets,but for example in this line
Code:
(*itr)->TeleportTo(SPAWN[(*itr)->GetTeamId()].map,SPAWN[(*itr)->GetTeamId()].x,SPAWN[(*itr)->GetTeamId()].y,SPAWN[(*itr)->GetTeamId()].z,SPAWN[(*itr)->GetTeamId()].o,0);

When I go under the
Code:
(*itr)
the ( always says expression must have pointer type.I thought I declared the pointer in the statement before.Thanks for helping me :)
 

Jameyboor

Retired Staff
the iterator ( itr ) is pointing to a GUID of a player, Tommy does not use (*itr)-> to call a method of a Player object, but he first gets the object by using the FindPlayer function:
Code:
if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
creating a Player object called player by using the playGuid that was initlialized to the value the iteretator was pointing at ( *itr ) before.

if the player is valid, do this stuff with the player:
Code:
if (player->isDead)
                {
                    player->TeleportTo(SPAWN[(*itr)->GetTeamId()].map,SPAWN[(*itr)->GetTeamId()].x,SPAWN[(*itr)->GetTeamId()].y,SPAWN[(*itr)->GetTeamId()].z,SPAWN[(*itr)->GetTeamId()].o,0);
                    player->ResurrectPlayer(100, false);
                }
 

Tommy

Founder
My bad, I didn't change all of it. :/

Just replace "(*itr)->" with "player" and you'll be fine whilst in the if statement declaring the player variable.
 
Status
Not open for further replies.
Top