Forum > Serverside Modding

[SOLVED] [C++] Set PvP FFA when player enter map

<< < (3/5) > >>

bizzlesnaff:
No, nothing happened. And also nothing print out in the console..

Rochet2:
Try use the override keyword.
In this case you happened to write the OnMapChanged hook wrong in the new script of yours as well.
Correct the hook name to OnMapChanged and it should start triggering again.

bizzlesnaff:
Okay..I've no Idea whats going on..:D First..it work. The player is ffa flaged, but only if he don't move. If he start walking he lose the ffa flag and get just pvp flaged...that's so weird..:(

edit:
I've tried to disable this part:

--- Code: ---printf("Executing timed eventn");

// disabled to prevent a new pvp flag
//_Plr->SetPvP(true);  

_Plr->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);

--- End code ---

Yeah...it also not work...the player is now, after he start moving, unflaged..:(

Rochet2:
Try using this hook instead.
https://github.com/TrinityCore/TrinityC ... #L766-L767

The FFA flags are updated on zone update, which might trigger when you start moving (makes you change the zone specific channels and stuff):
You still need the timed event since the hook triggers before the flag setting etc work is done by core normal code.

bizzlesnaff:
I did anything wrong, I'm sure..


--- Code: ---
class OnMapEnter : public PlayerScript
{
public:
OnMapEnter() : PlayerScript("OnMapEnter") { }

void OnUpdateZone(Player* player, uint32, uint32)
{
if (player->GetMapId() == 9999)
{
printf("UPDATE ZONEn");
Teleport* tele = new Teleport(player);
player->m_Events.AddEvent(tele, player->m_Events.CalculateTime(FIRST_TELEDELAY));
}

}
};

--- End code ---

That's not working.:(

edit:

this is working, but only in one zone..if I change the zone, the player is just pvp flaged..


--- Code: ---class OnMapEnter : public PlayerScript
{
public:
OnMapEnter() : PlayerScript("OnMapEnter") { }

void OnUpdateZone(Player* player, uint32, uint32)
{
if (player->GetMapId() == 9999)
{
printf("UPDATEZONEn");
Teleport* tele = new Teleport(player);
player->m_Events.AddEvent(tele, player->m_Events.CalculateTime(FIRST_TELEDELAY));
}

}
void OnMapChanged(Player* player)
{
if (player->GetMapId() == 9999)
{
printf("ONMAPCHANGEn");
Teleport* tele = new Teleport(player);
player->m_Events.AddEvent(tele, player->m_Events.CalculateTime(FIRST_TELEDELAY));
}
}
};

--- End code ---

sec. edit:

The "UPDATE ZONE" print, never appears in the console..:/

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version