if (Map* map = sMapMgr->FindMap(MAP_ID, 0))
{
PlayerList players = map->GetPlayers();
for (PlayerList::iterator itr = players.begin(); itr != players.end(); itr++)
{
if (itr->getSource()->GetZoneId() == ZONE_ID)
{
// itr->getSource() (player) is in yout zone
}
}
}
MAP_ID is the continent where ZONE_ID is.
Not sure about PlayerList, if not compiling, change for MapRefManager and include MapRefManager.h
This can cause huge diff if not used wisely and correctly.
A better solution would be to do a ZoneScript and each time OnPlayerEnterZone gets called you push the GUID to a std::list/std::map (GuidSet) and when OnPlayerLeaveZone you just remove it, so you would have them all saved and could get the players by calling ObjectAccessor::FindPlayer(guid)
if you want to do this in php, then you will have to write like small query in mysql to get zones of online players, then you will be able to give them presents.
First of all, you can use query like Zze said:
select * from characters where zone='ZONE_ID’Then, you will have to write script to handle your needs:
if ($playerzone == zone_number)
{ //piece of code to give presents }
else
{ //brackets without data will just do nothing, but they still needed }
could also make use of a switch/case statment if theres more then one zone you want to trigger, and specific triggers. However I dont think OP was talking about php. /emoticons/default_wacko.png