Skip to content

Instantly share code, notes, and snippets.

@DDuarte
Created April 13, 2012 16:53
Show Gist options
  • Select an option

  • Save DDuarte/2378319 to your computer and use it in GitHub Desktop.

Select an option

Save DDuarte/2378319 to your computer and use it in GitHub Desktop.
BG teleport plr (exploit)
// Find if the player left our start zone; if so, teleport it back
// TODO: This could be a little "expensive", we might want to only run this every X seconds (using diff)
float dist = GetStartMaxDist();
if (dist > 0.0f)
{
float x[2], y[2], z[2], o[2];
GetTeamStartLoc(TEAM_ALLIANCE, x[TEAM_ALLIANCE], y[TEAM_ALLIANCE], z[TEAM_ALLIANCE], o[TEAM_ALLIANCE]);
GetTeamStartLoc(TEAM_HORDE, x[TEAM_HORDE], y[TEAM_HORDE], z[TEAM_HORDE], o[TEAM_HORDE]);
uint32 mapId = GetMapId();
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
{
uint32 team = plr->GetBGTeam();
float dist = plr->GetDistance(x[team], y[team], z[team]);
if (dist >= GetStartMaxDist())
{
sLog->outError("BATTLEGROUND: Sending %s back to start location (possible exploit)", plr->GetName());
plr->TeleportTo(mapId, x[team], y[team], z[team], o[team]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment