Sunday, January 6, 2008

Delayed Death after Getting Shot

By: Lord Jesus

This cheat comes to us by way of an idea from blogger, person. Here is an excerpt of his comment to Super "Kill Me" on Demand in which he proposed the idea:

    I have a suggestion... Maybe there could be a client side delay so that when the tank detects that it has been shot, it will let you live for just a little longer, giving you a short time in which you could kill your killer before you died. Like for example. I get in a fight with a shock waver. I wait for him to land, but am hit before he lands. Instead of exploding, I would have 2 seconds to kill him first.

The delayed death cheat can also be useful for cheaters with slow connections and/or moderate to high lag since the delay can possibly be attributed to lag. Some administrators, though, may kick players who lag or seem to lag until they are able to fix the problem especially if other players are complaining about it.

Being that I'm not a software developer, this may look a bit rough; however, it works. Suggestions to clean it up or to make it easier are always welcome.

Anyway, I found in my experiments that setting the delay to 2.0f seemed a little long. It would be easily noticed, and you would be singled out shortly for cheating. In this example, I use 1.0f which turns out to be a little closer to two seconds than it does one. You can adjust that value to suit your liking. Perhaps, you can shorten it to make it less noticeable yet still give you just enough time to pop off a shot or two at the player who shot you. Additionally, my idea was to have a countdown on the display. Being that the time is short, I decided to go simply with "Death imminent" as a quick warning for you to get your shot(s) off before you blow up.

I didn't include a delay for Thief. The idea is to shoot a person who actually shot you. I also didn't include a delay for Steamroller; however, implementing a delay for that as well wouldn't be difficult.

All of the changes that we will make will be in the file, playing.cxx.

At the beginning, of playing.cxx, you will see a section for "system includes":

// system includes
#ifdef _WIN32
#include
#include
#include
#include
#else
#include
#include
#include
#include
#include
#endif
#include

At the end of that, add "int deathStart;" so that the section now reads like this:

// system includes
#ifdef _WIN32
#include
#include
#include
#include
#else
#include
#include
#include
#include
#include
#endif
#include
int deathStart;

Next, search for "destructCountdown" and you will find these lines:

float pauseCountdown = 0.0f;
float destructCountdown = 0.0f

Just below the "destructCountdown" line, add this new line:

float deathCountdown = 0.0f;

The lines should now read like this:

float pauseCountdown = 0.0f;
float destructCountdown = 0.0f;
float deathCountdown = 0.0f;

Search for "destructCountdown" again, and you will find this section:

static void updateDestructCountdown(float dt)
{
if (!myTank) {
destructCountdown = 0.0f;
}
if (destructCountdown > 0.0f && !myTank->isAlive()) {
destructCountdown = 0.0f;
hud->setAlert(1, NULL, 0.0f, true);
}
if (destructCountdown > 0.0f) {
const int oldDestructCountdown = (int)(destructCountdown + 0.99f);
destructCountdown -= dt;
if (destructCountdown <= 0.0f) {
// now actually destruct
gotBlowedUp( myTank, SelfDestruct, myTank->getId() );

hud->setAlert(1, NULL, 0.0f, true);
} else if ((int)(destructCountdown + 0.99f) != oldDestructCountdown) {
// update countdown alert
char msgBuf[40];
sprintf(msgBuf, "Self Destructing in %d", (int)(destructCountdown + 0.99f));
hud->setAlert(1, msgBuf, 1.0f, false);
}
}
return;
}

Below that, add these lines:

static void updateDeathCountdown(float dt)
{
if (!myTank) {
deathCountdown = 0.0f;
}
if (deathCountdown > 0.0f && !myTank->isAlive()) {
deathCountdown = 0.0f;
hud->setAlert(1, NULL, 0.0f, true);
}
if (deathCountdown > 0.0f) {
const int oldDeathCountdown = (int)(deathCountdown + 0.99f);
deathCountdown -= dt;
if (deathCountdown <= 0.0f) {
// blow up my tank and then reset
// deathCountdown & deathStart back to zero
gotBlowedUp(myTank,GotShot,deathStart);
deathCountdown = 0.0f;
deathStart = 0;

hud->setAlert(1, NULL, 0.0f, true);
} else if ((int)(deathCountdown + 0.99f) != oldDeathCountdown) {
// update countdown alert
char msgBuf[40];
sprintf(msgBuf, "Death imminent");
hud->setAlert(1, msgBuf, 1.0f, false);
}
}
return;
}

Search for "destructCountdown" one more time, and you will find this section:

// update the countdowns
updatePauseCountdown(dt);
updateDestructCountdown(dt);

Below that, add "updateDeathCountdown(dt);" so that the section now reads like this:

// update the countdowns
updatePauseCountdown(dt);
updateDestructCountdown(dt);
updateDeathCountdown(dt);

Now, search for "used later", and you will find this section:

// used later
float waterLevel = World::getWorld()->getWaterLevel();

if (hit) {
// i got shot! terminate the shot that hit me and blow up.
// force shot to terminate locally immediately (no server round trip);
// this is to ensure that we don't get shot again by the same shot
// after dropping our shield flag.
if (hit->isStoppedByHit())
serverLink->sendEndShot(hit->getPlayer(), hit->getShotId(), 1);

FlagType* killerFlag = hit->getFlag();
bool stopShot;

if (killerFlag == Flags::Thief) {
if (myTank->getFlag() != Flags::Null) {
serverLink->sendTransferFlag(myTank->getId(), hit->getPlayer());
}
stopShot = true;
}
else {
stopShot = gotBlowedUp(myTank, GotShot, hit->getPlayer(), hit);
}

if (stopShot || hit->isStoppedByHit()) {
Player* hitter = lookupPlayer(hit->getPlayer());
if (hitter) hitter->endShot(hit->getShotId());
}
}
// if not dead yet, see if i'm sitting on death

Just after the comments at the beginning of the "if (hit)" section, add these lines:

// skip this if the Death Counter is counting
if (deathCountdown > 0.0f) return;

The section should now read like this:

if (hit) {
// i got shot! terminate the shot that hit me and blow up.
// force shot to terminate locally immediately (no server round trip);
// this is to ensure that we don't get shot again by the same shot
// after dropping our shield flag.

// skip this if the Death Counter is counting
if (deathCountdown > 0.0f) return;

Next, notice these lines in particular in the "if (hit)" section:

else {
stopShot = gotBlowedUp(myTank, GotShot, hit->getPlayer(), hit);
}

Replace "stopShot = gotBlowedUp(myTank, GotShot, hit->getPlayer(), hit);" with these lines:

deathCountdown = 1.0f;
deathStart = hit->getPlayer();

// imminent death alert
char msgBuf[40];
sprintf(msgBuf, "Death imminent");
hud->setAlert(1, msgBuf, 1.0f, false);

The section should now read like this:

else {
deathCountdown = 1.0f;
deathStart = hit->getPlayer();

// imminent death alert
char msgBuf[40];
sprintf(msgBuf, "Death imminent");
hud->setAlert(1, msgBuf, 1.0f, false);
}

The entire section after your changes should now look like this:

// used later
float waterLevel = World::getWorld()->getWaterLevel();

if (hit) {
// i got shot! terminate the shot that hit me and blow up.
// force shot to terminate locally immediately (no server round trip);
// this is to ensure that we don't get shot again by the same shot
// after dropping our shield flag.

// skip this if the Death Counter is counting
if (deathCountdown > 0.0f) return;

if (hit->isStoppedByHit())
serverLink->sendEndShot(hit->getPlayer(), hit->getShotId(), 1);

FlagType* killerFlag = hit->getFlag();
bool stopShot;

if (killerFlag == Flags::Thief) {
if (myTank->getFlag() != Flags::Null) {
serverLink->sendTransferFlag(myTank->getId(), hit->getPlayer());
}
stopShot = true;
}
else {
deathCountdown = 1.0f;
deathStart = hit->getPlayer();

// imminent death alert
char msgBuf[40];
sprintf(msgBuf, "Death imminent");
hud->setAlert(1, msgBuf, 1.0f, false);
}

if (stopShot || hit->isStoppedByHit()) {
Player* hitter = lookupPlayer(hit->getPlayer());
if (hitter) hitter->endShot(hit->getShotId());
}
}
// if not dead yet, see if i'm sitting on death

I realize that the HUD alert is redundant. I noticed that there was a delay in the alert so I added it in the above section, as well, so that it would display more quickly.

What we've established so far is the creation of a couple of values, deathCountdown and deathStart, which we will use for our countdown, and we set their defaults (e.g., deathCountdown = 0.0f). We also added the the code for the actual countdown and time keeping. Next, we initiate the countdown when we get shot by setting deathCountdown to 1.0f, and we display an alert for "Death imminent". We also retain the identity of the player who initially shot us and started the countdown by setting the value of deathStart to represent the identity of that player so that we can use it later for blowing up when the countdown completes. We skip the "if (hit)" section if there is already a countdown in progress so that we don't start a new countdown for each shot that hits us once a countdown has already started (i.e., we ignore all other shots that may hit us after the countdown begins). When the countdown finishes, we blow up (and as a result lose a point, and the killer gets his or her point), and the countdown values, deathCountdown and deathStart, are then set back to 0.0f and 0, respectively.

Notice that we use "return" to skip the "if (hit)" section. We do that since using a line such as "stopShot = true" when deathCountdown > 0.0f will get us kicked for wrong end shot detections. Essentially, the server will kick us if we are ending other players' shots that hit us without our tank blowing up. That technique of avoiding getting blown up was utilized by cheaters of yore, and it was known as end shot cheating. I know that because I, myself, used to be one of the culprits long ago. Anyway, it is better to ignore a shot altogether rather than try to end it without blowing up. That's why god mode cheating works and end shot cheating no longer does.

This next part is left over from when I was experimenting with a previous revision of this cheat. The idea was to bypass blowing up until a countdown had finished. It may not be necessary (I haven't tried it without it); but, this cheat works with it in place. So, if it ain't broke, don't fix it :P If anyone wants to experiment with it, let us know how it worked.

Search for "tank && (tank->getTeam() == ObserverTeam" and you will find this section:

static bool gotBlowedUp(BaseLocalPlayer* tank,
BlowedUpReason reason,
PlayerId killer,
const ShotPath* hit, int phydrv)
{
if (tank && (tank->getTeam() == ObserverTeam || !tank->isAlive()))
return false;

Change "(tank && (tank->getTeam() == ObserverTeam || !tank->isAlive()))" to this:

((tank && (tank->getTeam() == ObserverTeam || !tank->isAlive()) || deathCountdown > 0.0f))

Yeah, I know it's "fugly". Anyway, the section should now read like this:

static bool gotBlowedUp(BaseLocalPlayer* tank,
BlowedUpReason reason,
PlayerId killer,
const ShotPath* hit, int phydrv)
{
if ((tank && (tank->getTeam() == ObserverTeam || !tank->isAlive()) || deathCountdown > 0.0f))
return false;

Save the file, compile your new client, and you're finished. Thank you to blogger, person, for bringing this idea to us.

As always...

Have fun!

>:)

**********

Related posts:

Instant Self Destruct
Ultimate Pausing

Thursday, January 3, 2008

Using God Mode with Choose Who Kills You

By: Lord Jesus

With Choose Who Kills You and Super "Kill Me" on Demand, you could not use god mode if you had either or both cheats enabled. Here's a simple edit that will now allow you to have the best of both worlds. You can drive around in god mode and only blow up when you initiate killMe (Choose Who Kills You) or SuperkillMe (Super "Kill Me" on Demand). I was considering making this an additional update to Super "Kill Me" on Demand; however, I decided to make it a separate entry for the benefit of those who choose not to use god mode.

First, let's revisit Classic God Mode. In the God Mode cheat, we added this line in several locations within playing.cxx:

// skip this if i'm alive
if (myTank->isAlive()) return;

So that it will not interfere with killMe and/or SuperkillMe, we change it to this:

// skip this if i'm alive and we have not initiated getting killed
if (myTank->isAlive() && killMe == 0 && SuperkillMe == 0) return;

If you do not use both dead-on-demand cheats, you can edit the above to match which cheat you are using. Basically, we skip the check to see if we should be dead if we are alive AND killMe and SuperkillMe are zero (i.e., we haven't selected to be killed by someone). If we have initiated a "Kill Me", then we continue with the checks and we are allowed to blow up.

When you've completed your edits, save your file, compile your client, and ...

Have fun!

**********

Related posts:

Classic God Mode
Choose Who Kills You
Super "Kill Me" on Demand

Jump Fix for DUB Pillbox

By: Lord Jesus

Some of you may have noticed that you can no longer cheat on DUB Pillbox by jumping on the no-jumping server (see Flying Without Wings for information about jumping on no-jump servers). In addition to updating to a newer version server which prevents sending flags to teammates (or someone on the other team, for that matter) or observers, jump velocity was set to zero. The fix for that is to use a custom value if the server value is set to zero or less. Here, we use 19. You can experiment to find a value that most suits your liking.

To do that, let's go to LocalPlayer.cxx. Search for "newVelocity[2] = BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY)", and you will find this section:

// add jump velocity (actually, set the vertical component since you
// can only jump if resting on something)
const float* oldVelocity = getVelocity();
float newVelocity[3];
newVelocity[0] = oldVelocity[0];
newVelocity[1] = oldVelocity[1];
if (flag == Flags::Wings) {
newVelocity[2] = BZDB.eval(StateDatabase::BZDB_WINGSJUMPVELOCITY);
} else if (flag == Flags::Bouncy) {
const float factor = 0.25f + ((float)bzfrand() * 0.75f);
newVelocity[2] = factor * BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY);
} else {
newVelocity[2] = BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY);
}

In particular, look at these lines:

} else {
newVelocity[2] = BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY);
}

Just below "} else {", add this line:

if(BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY) <=0 ) BZDB.setFloat(StateDatabase::BZDB_JUMPVELOCITY, 19);

The edited section should now read like this:

} else {
if(BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY) <=0 ) BZDB.setFloat(StateDatabase::BZDB_JUMPVELOCITY, 19);
newVelocity[2] = BZDB.eval(StateDatabase::BZDB_JUMPVELOCITY);
}

Save the file, compile your client, and you're ready once more to raise hell on DUB Pillbox. Yes, now you can start dropping flags on towers again. For added laughs, be sure to check out Flying Without Wings and Guided Bullets ;) Also be sure to check out Teleport Behind Somebody (handy when someone on the other team has your flag).

I wouldn't be surprised if DUB Pillbox and/or other servers tweak various other server values in attempts to thwart cheating. We'll update here as necessary, so stay tuned ;)

Again...

dj28: "Have fun pissing people off and ruining their fun."

>:)

**********

Related posts:

Wings Gravity Fix for BloodBath
Flying Without Wings
Guided Bullets
Teleport Behind Somebody
Teleport in FRONT of your opponent.

Tuesday, January 1, 2008

Super "Kill Me" on Demand

By: Lord Jesus

Got an annoying teammate that needs to be kicked (if the server kicks for team kills)? Perhaps that annoying teammate simply needs calibration with a point reduction... Or, how would you like to be able to hook up your buddies with some mad points?

Here's a modification to Choose Who Kills You brought to you by a collaboration between blogger,Someone, and BZFlag Cheat's newest team member, NightMare.

With "Choose Who Kills You", you enter in your command to be killed by another player on demand (e.g., "/k"). The getting killed ends after you blow up and the point is transferred. Let's say, though, that you would like to do it over and over again without having to enter the command manually each and every time. One way might be to set up a macro such as ctrl+k to enter "." + /k + [Enter] to facilitate rapid keystroke entries. Another way might be to set up a key command and select victims similar to the way in which one uses "k" to silence or "unsilence" other players. There are a variety of ways which are possible. After all, there are usually more than one way to skin a cat, as the old saying goes.

The technique that we will use here is to set up a command for it. A separate command is used to terminate the automatic suicide, as it were. Additionally, this particular method works separately from killMe, so you can use either one without conflict. The example that we use here will show lines of code for both. The single killMe is optional, of course, but highly recommended :)

Before we begin, let's review some limitations. This method described here (as well as single killMe) will NOT work if you:
    1. have god mode enabled. This is highly important. If you can toggle god mode, ensure that it is toggled off. Otherwise, you will need to build without the god mode cheat or nothing will happen when you try to use the Super killMe (or single killMe, for that matter). UPDATE: See Using God Mode with Choose Who Kills You if you want to use (or would like to continue to use) god mode.

    2. are an observer. Note, though, that you can choose to be killed by an observer. You just can't be killed while YOU are an observer.

    3. have not yet spawned (e.g., when you first join a server).

    4. are dead. For the automatic Super killMe, I strongly recommend that you utilize Respawn Instantly.

Additionally, I have noticed that commonly at least one player on a server is not affected by either killMe or Super killMe. So, if you go to try it out and it doesn't work on the first victim, try some others just to be sure. Also, if a victim leaves the server during the automatic Super killMe (e.g., getting kicked for team killing, just simply leaving, and so on), then the killed message will reflect that you have been killed by the server. This occurs when you are killed by an unknown player (a player who has signed off is a player that no longer exists).

playing.cxx

Let's begin now by going back to playing.cxx. Do you remember where we added "int killMe"? Let's add another one so that the section looks like this (from the beginning of the file):

/* bzflag
* Copyright (c) 1993 - 2006 Tim Riker
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the license found in the file
* named COPYING that should have accompanied this file.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

// interface header
#include "playing.h"

// system includes
#ifdef _WIN32
#include
#include
#include
#include
#else
#include
#include
#include
#include
#include
#endif
#include
int killMe;
int SuperkillMe;

Next, search for "used later", and you will find this section:

// used later
float waterLevel = World::getWorld()->getWaterLevel();

if (hit) {
// i got shot! terminate the shot that hit me and blow up.

Look at the second line:

float waterLevel = World::getWorld()->getWaterLevel();

Below that, let's add our lines of code:

if (killMe)
{
gotBlowedUp(myTank,GotShot,killMe);
killMe = 0;
}

if (SuperkillMe)
{
gotBlowedUp(myTank,GotShot,SuperkillMe);
}

Look at the line below the addition above:

if (message.length() > 0) {

Add "else" at teh beginning of the line so that it now reads like this:

else if (message.length() > 0) {

The edited section should now look like this:

// used later
float waterLevel = World::getWorld()->getWaterLevel();

if (killMe)
{
gotBlowedUp(myTank,GotShot,killMe);
killMe = 0;
}

if (SuperkillMe)
{
gotBlowedUp(myTank,GotShot,SuperkillMe);
}
else if (message.length() > 0) {

if (hit) {
// i got shot! terminate the shot that hit me and blow up.

Notice that in the killMe section you see "killMe=0" but SuperkillMe does not have a corresponding line. The line resets killMe so that the process of getting blown up doesn't keep going and going. This allows you to have single use killMe. Since we want the automatic killMe (i.e., SuperkillMe) to keep going, there is no line resetting that value back to 0.

UPDATE: As mentioned previously, this cheat would continue the SuperkillMe even after the player signs off or gets kicked. Thus, the killer is then unknown and the killed message is "Killed by the server", and you would have to use your command to end it (such as /ks) to stop the SuperkillMe. Here's a simple fix to end the SuperkillMe automatically when the player no longer on the server.

Let's continue with playing.cxx and search for "Killed by the server". You will will find this section:

} else {
// 1-4 are messages sent when the player dies because of someone else
if (reason >= GotShot && reason <= GenocideEffect) {
Player *killerPlayer = lookupPlayer(killer);
if (!killerPlayer) {
blowedUpNotice = "Killed by the server";
} else {

Notice this line: blowedUpNotice = "Killed by the server";

After that line, add this line:

SuperkillMe = 0;

The section should now look like this:

} else {
// 1-4 are messages sent when the player dies because of someone else
if (reason >= GotShot && reason <= GenocideEffect) {
Player *killerPlayer = lookupPlayer(killer);
if (!killerPlayer) {
blowedUpNotice = "Killed by the server";
SuperkillMe = 0;
} else {

At this point, we are finished with editing playing.cxx.

ComposeDefaultKey.cxx

Next, let's go to setting up the actual commands. For this we go to ComposeDefaultKey.cxx. Do you recall where we put "extern int killMe;"? Search for "MAX_MESSAGE_HISTORY (20)", and you will come to this section:

#define MAX_MESSAGE_HISTORY (20)

MessageQueue messageHistory;
unsigned int messageHistoryIndex = 0;


static bool isWordCompletion(const BzfKeyEvent& key)

Notice the line "unsigned int messageHistoryIndex = 0;". Below that, we will add our lines of code:

extern int killMe;
extern int SuperkillMe;

The edited section should look like this:

#define MAX_MESSAGE_HISTORY (20)

MessageQueue messageHistory;
unsigned int messageHistoryIndex = 0;
extern int killMe;
extern int SuperkillMe;

static bool isWordCompletion(const BzfKeyEvent& key)

Next, let's set up our commands. Here, we use "/k" for a single killMe, and we use "/kk" for SuperkillMe. Keep in mind that you are free to use any command that you desire. For example, if you prefer /killme over /k, then edit that line accordingly. Search for "if (sendIt) {", and you will see this section:

if (sendIt) {
std::string message = hud->getComposeString();
if (message.length() > 0) {
const char* cmd = message.c_str();
if (LocalCommand::execute(cmd)) {
;
} else if (serverLink) {

Notice the line "std::string message = hud->getComposeString();". Below that, we will add our lines of code:

if(message=="/kk") {
const Player *someOther = LocalPlayer::getMyTank()->getRecipient();
if (someOther)
{
SuperkillMe = someOther->getId();
}
}

else if(message=="/ks") {
SuperkillMe = 0;
}

else if(message=="/k") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
killMe = Other->getId();
}
}

The next line after our addition is "if (message.length() > 0) {". Let's add "else" in front of that so that the line now reads like this:

else if (message.length() > 0) {

The section after our change should now read like this:

if (sendIt) {
std::string message = hud->getComposeString();

if(message=="/kk") {
const Player *someOther = LocalPlayer::getMyTank()->getRecipient();
if (someOther)
{
SuperkillMe = someOther->getId();
}
}

else if(message=="/ks") {
SuperkillMe = 0;
}

else if(message=="/k") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
killMe = Other->getId();
}
}

else if (message.length() > 0) {
const char* cmd = message.c_str();
if (LocalCommand::execute(cmd)) {
;
} else if (serverLink) {
char messageBuffer[MessageLen];

In the example above, we used "/ks" as the command to terminate the automatic getting killed on demand, or SuperkillMe. When we enter the command "/ks", SuperkillMe is set to 0, and automatic getting killed is over until we initiate it again.

After you make your changes, save your files, compile your new client, and you're done. Watching dead or paused players rack up points or team kills can be quite amusing... as well as observers going on killing sprees :P

In the immortal words of dj28:

"Have fun pissing people off and ruining their fun."

>:)

**********

Related posts:

Choose Who Kills You
Using God Mode with Choose Who Kills You

Monday, December 31, 2007

Guided Bullets

Ok this code is pretty nice, just lock onto your opponent and it shoots in the direction they're going or right at them pretty accurately. I didn't create this code, but I'm not sure who gave it to me but here it is:


You might have trouble if you have guided lasers.

In src/bzflag/playing.cxx find:

// see if it's inside lock-on angle (if we're trying to lock-on)
if (a <>getFlag() == Flags::GuidedMissile) // am i locking on?
tankHasShotType(myTank, Flags::GuidedMissile)) &&
player[i]->getFlag() != Flags::Stealth && // can't lock on stealth
!player[i]->isPaused() && // can't lock on paused
!player[i]->isNotResponding() && // can't lock on not responding
d < besttarget =" player[i];" bestdistance =" d;" lockedon =" true;">getFlag() == Flags::GuidedMissile) // am i locking on?

To:

(1 // am i locking on?

In src/bzflag/LocalPlayer.cxx find:

// Set _shotsKeepVerticalVelocity on the server if you want shots
// to have the same vertical velocity as the tank when fired.
// keeping shots moving horizontally makes the game more playable.
firingInfo.shot.vel[2] = 0.0f;

Add this after it:

if (getTarget()) {
const Player * targ = getTarget();
double myx = LocalPlayer::getMyTank()->getPosition()[0];
double myy = LocalPlayer::getMyTank()->getPosition()[1];
double myz = LocalPlayer::getMyTank()->getPosition()[2] +
LocalPlayer::getMyTank()->getMuzzleHeight();
double hisx = targ->getPosition()[0];
double hisy = targ->getPosition()[1];
double hisz = targ->getPosition()[2] + targ->getMuzzleHeight();
double hisvx = targ->getVelocity()[0];
double hisvy = targ->getVelocity()[1];
double hisvz = targ->getVelocity()[2];
double deltax = hisx - myx;
double deltay = hisy - myy;
double distance = hypotf(deltax,deltay)- BZDBCache::tankRadius;
// - BZDB.eval(StateDatabase::BZDB_MUZZLEFRONT);
if (distance <= 0) distance = 0; double shotspeed = BZDB.eval(StateDatabase::BZDB_SHOTSPEED)*( LocalPlayer::getMyTank()->getFlag() == Flags::Laser ?
BZDB.eval(StateDatabase::BZDB_LASERADVEL) :
LocalPlayer::getMyTank()->getFlag() == Flags::RapidFire ?
BZDB.eval(StateDatabase::BZDB_RFIREADVEL) :
LocalPlayer::getMyTank()->getFlag() == Flags::MachineGun ?
BZDB.eval(StateDatabase::BZDB_MGUNADVEL) : 1);
double errdistance = 1.0;
float tx, ty, tz;
for (int tries=0 ; errdistance > 0.05 && tries < t =" (float)distance" omega="fabs(targ-">getAngularVelocity());
double sx,sy;
if ((targ->getStatus() & PlayerState::Falling) fabs(omega)
< sx="t*hisvx;" sy="t*hisvy;" hisspeed =" hypotf(hisvx," alfa =" omega" r =" hisspeed" dx =" r" dy2 =" r" beta =" atan2(dy2,">getAngularVelocity() >
0 ? 1 : -1);
double gamma = atan2(hisvy, hisvx);
double rho = gamma+beta;
sx = hisspeed * t * cos(rho);
sy = hisspeed * t * sin(rho);
}
tx=(float)hisx+(float)sx;
ty=(float)hisy+(float)sy;
tz=(float)hisz+(float)hisvz*t;
if (targ->getStatus() & PlayerState::Falling)
tz += 0.5f * BZDBCache::gravity * t * t;
if (tz < 0) tz = 0;
double distance2 = hypotf(tx - myx, ty - myy);
errdistance = fabs(distance2-distance) / (distance + ZERO_TOLERANCE);
distance = distance2;
}
float projpos[3];
projpos[0] = tx; projpos[1] = ty; projpos[2] = tz;
float heading = atan2f(projpos[1] - myy, projpos[0] - myx);
firingInfo.shot.vel[0] = cosf(heading) *
BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.vel[1] = sinf(heading) *
BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.vel[2] = sinf(atan2f(projpos[2]-myz,
hypotf(projpos[1]-myy,
projpos[0]-myx)))*BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.pos[0] = myx;
firingInfo.shot.pos[1] = myy;
firingInfo.shot.pos[2] = myz;
}

There you go.

-NightMare

Choose your tank size

Ok this is posted in a comment by "person" but "someone" is the one who came up with this cheat I just think it should be posted so more people can see it and don't have to go looking through comments to find it so here it is.

At top of src/bzflag/CommandsImplementation.cxx:

extern float sizeCheat;
class SizeCommand : LocalCommand {
public:
SizeCommand();
bool operator() (const char *commandLine);
};
static SizeCommand sizeCommand;
SizeCommand::SizeCommand() : LocalCommand("/size") {}
bool SizeCommand::operator() (const char *commandLine)
{
sizeCheat = atof(commandLine+6);
return true;
}

At top of src/bzflag/Player.cxx:

#include "LocalPlayer.h"
float sizeCheat = 1.0f;
Find:
else if (effectFlag == Flags::Narrow) {
dimensionsTarget[1] = 0.001f;
}

Add this after:

if (id == LocalPlayer::getMyTank()->getId())
{
dimensionsTarget[0] *= sizeCheat;
dimensionsTarget[1] *= sizeCheat;
}

And that should be it. Now just type /size .1 to /size 1. You must either be killed or pick up or drop a flag for the size to change. Sizes range from 0.0 (Can't be shot by a bullot) to 1.0 (Normal tank size). Sometimes just a /size .7 is nice to give yourself an "edge" =].

-NightMare

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

Shot prediction.

This will draw a line on your radar to predict where your shots will go. Its almost exactly perfect. It doesn't work on all servers for some reason, but it should work on most. It is very helpful for 3 shot no jump servers. This code was found through a chat between mrmolez and someone else. So here it is for everyone else to see lol.

Open RadarRenderer.cxx
Find:

//draw world weapon shots

Add this right before it:

FiringInfo myInfo(*myTank, 0);
if (myInfo.flagType != Flags::ShockWave) {
if (!BZDB.isTrue(StateDatabase::BZDB_SHOTSKEEPVERTICALV))
myInfo.shot.vel[2] = 0.0f;
myInfo.flagType = Flags::Laser;
myInfo.lifetime /= 100;
const float cs = colorScale(myInfo.shot.pos[2], muzzleHeight);
glColor3f(1.0f * cs, 1.0f * cs, 1.0f * cs);
LocalShotPath myPath(myInfo);
myPath.radarRender();
}

Let me know how this works for you guys. If you don't like it just take it out lol.

-NightMare

Sunday, December 30, 2007

Choose Who Kills You

Ok this is a very very powerful cheat. With this cheat you send a PM to the player saying "/kill" and you will instantly be killed by that person. It is very useful and funny when you do it to teammates and they get booted for TKing or their score drops immedietly.
In src/bzflag/playing.cxx:
Add to top:

int killMe;

Find:

// used later
float waterLevel = World::getWorld()->getWaterLevel();

Add this after:

if (killMe)
{
gotBlowedUp(myTank,GotShot,killMe);
killMe = 0;
}

In src/bzflag/composeDefaultKey.cxx:
Add to top:

extern int killMe;

Find:

else if (message.length() > 0) {

Add this before that:

else if(message=="/kill") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{ killMe = Other->getId();
}
}

And that is it. Now type /kill in a messege to someone and you will be killed by them. Make sure you do NOT have god mode on when you try to do this otherwise it won't work. Also there is usually 1 random player everytime you log into a server that the code doesn't work against. But other than that one player it should work against everyone else. Let me know if this code works for you guys.

-NightMare

Monday, September 24, 2007

Clientquery spoofing

Here's something somebody showed me a long time ago, but I haven't put it up until now. Do people keep recognizing your client as a cheat client because of the "clientquery" command? This will make your client appear to be the same as others, or you can make it say whatever you want.

In buildDate.cxx find these lines of code:

#ifdef HAVE_SDL
appVersionStream << "-SDL";
#endif
appVersion = appVersionStream.str();

and put this line of code right after it:

appVersion = "2.0.8.20060513-MAINT-W32VC71";

This makes your client look like the regular, Windows 2.0.8 version. Of course, you could even change appVersion to be anything you want, like "A BZFLAG CHEAT CLIENT, PUNK!" and if I remember correctly, it may not filter out swear words.
So that's the cheat. So stop bugging me Nightmare.
-phasmophage

Monday, September 17, 2007

No Gravity

By: Phasmophage
Okay, this is a very useless cheat, but because randomdude wants it, I thought I'd post it. =]

We definitely want this cheat to be toggleable. So in playing.cxx, add a line near the beginning (it doesn't matter where, as long as it's not in a function or anything) that says this:

bool bCheatGravity = false;

Now, open LocalPlayer.cxx and put this line of code near the top.

extern bool bCheatGravity;

This will let us use the variable we declared in playing.cxx.

Now, also in LocalPlayer.cxx find these lines:


newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;
lastSpeed = speed;
} else {
newVelocity[2] += BZDBCache::gravity * dt;

And replace them with this:

if(bCheatGravity && oldVelocity[2] <= 0.0)newVelocity[2] = 0;
else newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;
lastSpeed = speed;
} else {
//newVelocity[2] += BZDBCache::gravity * dt;
if(bCheatGravity && oldVelocity[2] <= 0.0 )newVelocity[2] = 0;
else newVelocity[2] += BZDBCache::gravity * dt;

Now, to add the toggle function, open up ComposeDefaultKey.cxx and add this line near the top:

extern bool bCheatGravity;

And add these lines where your other commands are:

if(message=="/gravity")
{
bCheatGravity = !bCheatGravity;
LocalPlayer *myTank = LocalPlayer::getMyTank();
const float * oldVel = myTank->getVelocity();
float newVelocity[3];
newVelocity[0] = oldVel[0];
newVelocity[1] = oldVel[0];
newVelocity[2] = 0;
myTank->setVelocity(newVelocity);
}

If you don't know where to put this, look for these lines and put it above it:

if (message.length() > 0) {
const char* cmd = message.c_str();
if (LocalCommand::execute(cmd)) {
;
} else if (serverLink) {


and put an "else" in front of " if (message.length() > 0) {"

That's all there is to it. It's pretty useless, I know. But it is funny to see a tank in midair not moving. Which reminds me, you'll need your wings cheat working if you want to drive around in the air.
Hope this is what you were looking for randomdude. ;)
-phaz

Sunday, September 16, 2007

Super Jump

By: Phasmophage
In winged fights, it's hard to catch up with people that are above you, and are continuously jumping. So here's a cheat that will amplify your jump speed by a factor of 8 (or whatever you want it to be, just change it) if you type "/jump".
Add these lines of code in composeDefaultKey.cxx before other commands (See "Quick Guide to Toggling Cheats and Wallwalking"):

if (message=="/jump"){
LocalPlayer *myTank = LocalPlayer::getMyTank();
const float* oldVelocity = myTank->getVelocity();
float newVelocity[3];
newVelocity[0] = oldVelocity[0];
newVelocity[1] = oldVelocity[1];
newVelocity[2] = BZDB.eval(StateDatabase::BZDB_WINGSJUMPVELOCITY);
newVelocity[2] *= 8;
myTank->setVelocity(newVelocity);
}

You will probably want to have your wings cheat turned on when you use this, as you may continue to soar until you are kicked. If you're going too fast, make sure you have you're wings cheat turned on and jump. This will slow you down to regular jump speed.
Questions? Is this working for you? Leave a comment.
-Phasmophage

Protect against "/send"

By: Phasmophage
"/send" is fun, but it can be horrible if it is used against you. So here's a cheat that will send the flag right back to the person who sent it to you.
In playing.cxx, find these lines of code:

static void handleFlagTransferred( Player *fromTank, Player *toTank, int flagIndex)
{
Flag f = world->getFlag(flagIndex);

fromTank->setFlag(Flags::Null);
toTank->setFlag(f.type);

if ((fromTank == myTank) || (toTank == myTank))
updateFlag(myTank->getFlag());

and put this line of code right under it to send the flag back:

if(toTank == myTank)
serverLink->sendTransferFlag(myTank->getId(), fromTank->getId());

Or you can add this line instead to immediately drop it:
if(toTank == myTank)
serverLink->sendDropFlag(myTank->getPosition());

You'll probably want to make this cheat toggleable (see "Quick Guide to Toggling Cheats and Wallwalking").
-Phaz

Send a flag

By: Someone (but I had this one too, before ^_^)
What this cheat will do is simulate your flag being stolen by someone and thus sent to them, causing them to drop their flag, and pick up yours. You can send people bad flags, or OO and force them inside buildings with this cheat.
To do this, edit composeDefaultKey.cxx and add these lines of code:

if(message=="/send") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
serverLink->sendTransferFlag(LocalPlayer::getMyTank()->getId(),Other->getId());
}
}

In front of your other slash commands. (See previous tutorials)
And that's it. PM "/send" to anybody to send them the flag.

Monday, September 10, 2007

Teleport Behind Somebody

By:Phasmophage
Okay then, this is my first original post in quite a while. Most of the new cheats have been posted by Someone.

Are you tired of having to catch up with others to get a good shot at them? Do you wish that you could just appear behind someone (not the contributor Someone), and automatically aim at them? Well now you can! What this cheat will allow you to do is teleport behind somebody (Kind of like what I heard Agent Smith used to be able to do) by sending them a special private message (Using the period key) like "/behind" or "/b".
To do this, we will need to edit the "composeDefaultKey.cxx" in the directory "/src/bzflag/". Now what you'll need to do is find this line of code:

if (message.length() > 0) {

and change it to this:

else if (message.length() > 0) {

and put this above it:

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));
}
}

You can change the command "/behind" to anything you want. You may want to make it shorter. I also don't think that the "setStatus" functions really do anything important, so you may want to get rid of those, but they don't do any harm anyway.

If you're really into coding, what you can do, like I've done, is instead of having the "Other" player be the recipient of a message, you can make it the closest enemy through using the "findBestTarget()" function in TargetingUtils. You may also want to bind this action to a key, making it quicker to use. I won't go into the details on this, but for one method of binding keys, see Someone's comment on "Quick Guide to Toggling Cheats and Wallwalking". This method doesn't work for me, so I replace some commands I don't use, like "w" for "toggle console".

Questions? Comments? If I missed anything, or if you have any ideas on improvement *cough* Someone *cough*, post a comment.
Have fun with this one.
-phasmophage
aka phaz