You should make container to store the player guids that sign up.
Here is a simple unthreadsafe set of functions.
Basically the idea is to just use gossip to sign up and use QueAdd(guid) to add the player by guid to the que.
The script will automatically then when the limit is reached, teleport the players to the designed location.
It will also do a check if the players actually exist etc. Do note that this is a very simple script.
You should take a look at the teleporting commands for a better view at what should be done when teleporting players.
Also this would allow them to teleport from instances, bg and so on so be wary of what you are doing.
static const uint32 maxPlayers = 50;
for (uint64 guid : queuedPlayers)
Player* player = ObjectAccessor::FindPlayer(guid);
for (uint64 guid : to_erase)
for (Player* player : players)
player->TeleportTo(map, x, y, z, o);
bool QueHas(uint64 guid)
return queuedPlayers.find(guid) != queuedPlayers.end();
void QueRemove(uint64 guid)
void QueAdd(uint64 guid)
if (queuedPlayers.size() >= maxPlayers)