Monday, December 31, 2007

Teleport in FRONT of your opponent.

This is just like the /behind code down below where you teleport behind them, only with this code you will teleport in front of them. Kind of a dumb code but fun to mess with people.
Open src/bzflag/composeDefaultKey.cxx:
Find your /behind cheat that you have. It should Look like this:

else if(message=="/behind") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() int(PlayerState::Teleporting));
const float* pos = Other->getPosition();
const float* dir = Other->getForward();
const float* vel = Other->getVelocity();
float newpos[3];
float newvel[3];
newpos[0] = pos[0] - 10 * dir[0];
newpos[1] = pos[1] - 10 * dir[1];
newpos[2] = pos[2] + 0.01;
newvel[0] = vel[0];
newvel[1] = vel[1];
newvel[2] = vel[2];
LocalPlayer::getMyTank()->move(newpos, Other->getAngle());
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() & ~int(PlayerState::Teleporting));
}
}

Then directly below that add this:

else if(message=="/front") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() int(PlayerState::Teleporting));
const float* pos = Other->getPosition();
const float* dir = Other->getForward();
const float* vel = Other->getVelocity();
float newpos[3];
float newvel[3];
newpos[0] = pos[0] + 10 * dir[0];
newpos[1] = pos[1] + 10 * dir[1];
newpos[2] = pos[2] + 0.01;
newvel[0] = vel[0];
newvel[1] = vel[1];
newvel[2] = vel[2];
LocalPlayer::getMyTank()->move(newpos, TargetingUtils::getTargetAzimuth(newpos , pos ));
}
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() & ~int(PlayerState::Teleporting));
}

And that is all. Like I said, it is stupid but fun to mess with people when you teleport behind then in front back in forth. Credit for this goes to Phaz =].

-NightMare

No comments: