View Full Version: A Simple Cheatmaking Tut

CheatSync.net Forums > Tutorials > A Simple Cheatmaking Tut



Title: A Simple Cheatmaking Tut
Description: For the new advanced codemaking.


Durka Durka Mahn - November 4, 2006 05:33 PM (GMT)
Ok, we will first start off with this code, I will explain what it does:

CODE
#cheat Hit Down to Car Hop!
if(press & CTRL_DOWN)
{
setfloat(pcar + 0x00000148, +0.2);
}


Of course as you know

#cheat Hit Down to Car Hop!

Is the code name.

The
if(press & CTRL_DOWN)

Declares an if/then. This means if something in the game happens, it will do something.

What I have up there says if you hit down on the D-Pad ONE time, it will start running some code.

if(
is the begginning of the new code.

press means you hit it ONE time.

This can also be changed to-
buttons- If held it will repeat, like turbo.
pressslow- If held it will repeat slowly
pressmed- If held it will repeat at a medium pace
pressfast- If held it will repeat at a fast pace

then you would seperate that with an '&' sign.

Now you would put in the button you want to operate with, like-
CTRL_DOWN

This can also be-
CODE
 CTRL_SELECT     CTRL_LTRIGGER     CTRL_HOME
 CTRL_START      CTRL_RTRIGGER     CTRL_VOLUP
 CTRL_UP         CTRL_TRIANGLE     CTRL_VOLDOWN
 CTRL_RIGHT      CTRL_CIRCLE       CTRL_SCREEN
 CTRL_DOWN       CTRL_CROSS        CTRL_NOTE
 CTRL_LEFT       CTRL_SQUARE


Then you will close with a ).

Now for the next part.

In the old CD, you would simply do-
#cheat Cheatname
setchar(add, val);

Now we can use what I just explained in the old code, allowing us to execute something everytime we hit a button.

Now, we are going to do the next step.

First off, you MUST have a { and a }, meaning what will be going on if the button is pressed.

so, start off with

{

Then hit enter.

Now we go to this part-
setfloat(pcar + 0x00000148, +0.2);

This means when down is pressed, the Z speed (up and down) will go up by 0.2, making us pop into the air.

setfloat is used to have decimals.

You can also use-

setchar
setshort
setint

Now, (pcar refers to the beggining of addresses that have to do with the car. You need a + sign right after this!

Now, 0x00000148 is the address from pcar, this is what the cheat will be editing.

Then we would use a , followed by what we are editing the address to. This time it is +0.2, which means add 0.2 to whatever is already there, not make it 0.2.

And there you have it! Go start making cheats!
If you have any further questions please post in this topic.

xFinch713x - November 4, 2006 05:47 PM (GMT)
sweet tut, just what u wanted, but..., what if i wanted to have multiple buttons pressed, such as... hold L, then press or tap UP to make money go up? how would i do that?

Krossfire - November 4, 2006 07:32 PM (GMT)
QUOTE (xFinch713x @ Nov 4 2006, 05:47 PM)
sweet tut, just what u wanted, but..., what if i wanted to have multiple buttons pressed, such as... hold L, then press or tap UP to make money go up? how would i do that?

Why would you want multiple buttons? Pressign one button is good enough, no need to make cheats complicated...

xFinch713x - November 4, 2006 08:17 PM (GMT)
well, in car, down is honk, and sometimes you need to honk in a mission, get my point?

Krossfire - November 4, 2006 08:20 PM (GMT)
QUOTE (xFinch713x @ Nov 4 2006, 08:17 PM)
well, in car, down is honk, and sometimes you need to honk in a mission, get my point?

Errr..okay

Waterbottle - November 4, 2006 09:42 PM (GMT)
I'll make a small tut for one of my cheats to make stuff clearer for everyone.. It's more complex than DDM's but if you understand his then mine shouldn't be to hard.

Full Code:
CODE

#cheat Bouncy!
BounceAmount = 0.8;
rot = getfloat(0x09fc73f0);
setfloat(pplayer + 0x4E4, 150.0);//health
if(getshort(pplayer+0x1C8)!=0x1020) {
setfloat(pplayer+0x148,BounceAmount);
setshort(pplayer+0x1c8, 0x1020);
if(ystick < -0.5) {
   setfloat(pplayer+0x140,getfloat(pplayer+0x10));
   setfloat(pplayer+0x144,getfloat(pplayer+0x14));
   }
}
if(xstick < -0.5) rot += 2;
if(xstick > 0.5) rot -= 2;
setfloat(pplayer, cos(rot)); setfloat(pplayer+0x4, sin(rot));
setfloat(pplayer+0x10, -sin(rot)); setfloat(pplayer+0x14, cos(rot));
setfloat(0x09fc73f0, rot);


#cheat Bouncy!
Name of cheat

BounceAmount = 0.8;
A variable declaration. Basically means it saves the value 0.8 somewhere so tjhat whenever I type BounceAmount again it will give the number 0.8.

rot = getfloat(0x09fc73f0);
I need to store the players rotation so I can rotate it. I chose to save it to 0x09fc73f0. This is just another variable declaration which gives the variable rot the value of what I saved the players rotation as.

setfloat(pplayer + 0x4E4, 150.0);
Set the players health to full.

if(getshort(pplayer+0x1C8)!=0x1020) {
An if statement just like in DDM's tut, what it checks the value in pplayer+0x1c8.
pplayer basically means the start of the player part of memory.
If that value is 0x1020 then that means that the player is om the ground or are touching a building.

setfloat(pplayer+0x148,BounceAmount);
Sets the Z speed of the player (like DDM did to the car in his tutorial) to the value of BounceAmount (remember we declared BounceAmount to be 0.8 at start. So writing 0.8 instead of BounceAmount would produce the same thing.

setshort(pplayer+0x1c8, 0x1020);
Set the value that stores wheter or not the player is in air to 0x1020. This is needed becouse if the player isn't in air editing the Z speed won't have an effect.

if(ystick < -0.5) {
another if statement inside the other if statement. What this check is if the stick is pushed upwards (at the same time as you are on the ground, as the last if statement checked)

setfloat(pplayer+0x140,getfloat(pplayer+0x10));
This sets the players X speed to the value of pplayer+0x10. pplayer+0x10 stores sin of the players rotation, if you have had some more advanced math at school you should understand why we do this, else you'll just have to live with that we do it (to lazy to try and explain).

setfloat(pplayer+0x144,getfloat(pplayer+0x14));
same thing as last one, just that pplayer+0x14 stores cos of the players rotation and pplayer+0x144 is Y speed.

if(xstick < -0.5) rot += 2;
if(xstick > 0.5) rot -= 2;
if you move the analogstick left or right modify the rotation which we loaded from memory at the start of the code.

setfloat(pplayer, cos(rot)); setfloat(pplayer+0x4, sin(rot));
setfloat(pplayer+0x10, -sin(rot)); setfloat(pplayer+0x14, cos(rot));
Make the rotation affect the player, using cos and sin functions. Again if you know the math and understand how code amking works this shouldn't be any problem understanding.

setfloat(0x09fc73f0, rot);
Then Finally save the variable storing the rotation so we can use it again next time.

Magical Trevor - November 5, 2006 12:24 PM (GMT)
i just made a simple money modifier:

#cheat Money Modifier
if ((pressmed & CTRL_UP&&getint(0x08bde55c)<999999999))
{
setint(0x08bde55c, getint(0x08bde55c)+1000);
}
if ((pressmed & CTRL_RIGHT&&getint(0x08bde55c)<999999999))
{
setint(0x08bde55c, getint(0x08bde55c)+2000);
}
if ((pressmed & CTRL_DOWN&&getint(0x08bde55c)>000000000))
{
setint(0x08bde55c, getint(0x08bde55c)-1000);
}
if ((pressmed & CTRL_LEFT&&getint(0x08bde55c)>000000000))
{
setint(0x08bde55c, getint(0x08bde55c)-2000);
}

LEFT: money goes down by 2000
RIGHT: money goes up by 2000
UP: money goes up by 1000
DOWN: money goes down my 1000

(yes i know its been made)

emcp - November 15, 2006 10:04 PM (GMT)
Is there a way to set a cheat to certain type of vehicle or to a certain vehicle

thanks
(all new to this thing)

Waterbottle - November 15, 2006 10:21 PM (GMT)
if(getshort(pcar+0x58)==180)
{
//something
}

would mkae somehitng happen only if you are in a bobcat

yazoo - November 16, 2006 01:55 PM (GMT)
how about replicating the button cheats, for example slow down the game play but not allowing the game know you cheated, how would the code be done then?

emcp - January 6, 2007 02:51 PM (GMT)
wat are the co-ordinates addresses
thanks

DoteStudios - January 6, 2007 08:58 PM (GMT)
Thanks to you guys here are the first pmg car for vcs, a yellow and black lamborghini, and a black pimp sentinel:

CODE
#cheat Black Lamborghini
if(getshort(pcar+0x58)==270)
{
  setfloat(pcar+0x450,  0,  -1.2566371,  0);
  setfloat(pcar+0x480,  0,  -1.2566371,  0);
  setfloat(pcar+0x4b0,  0,  -1.2566371,  0);
  setfloat(pcar+0x4e0,  0,  -1.2566371,  0);
{
  setshort(pcar+0x3b6,  0,  0);
{
   static money;
static wasin;
if(!money) money = getint(0x08bde560);
if (pcar)
{
  wasin = true;
 speed = (sqrt(getfloat(pcar + 0x140) * getfloat(pcar + 0x140) + getfloat(pcar + 0x144) * getfloat(pcar + 0x144)))*100;
 setint(0x08bde55c,  speed,  speed);
 setchar(0x8BAEDB8,  '%',  'd',  0);
 setchar(0x8BAEDC0,  '%',  'd',  0);
}
else
{  if(wasin)
 {
 setchar(0x8BAEDB8,  '%',  '0',  '8',  'd',  '$',  0);
 setchar(0x8BAEDC0,  '$',  '%',  '0',  '8',  'd',  0);
 setint(0x08bde55c,  money,  money);
 wasin = false;
 }
 money = getint(0x08bde560);
{
  setchar(pcar+0x00000224, 0x00, 0x00, 0x00);
  setchar(pcar+0x00000228, 0x00, 0x00, 0x00);
}

#cheat Orange Lamborghini
if(getshort(pcar+0x58)==270)
{
  setfloat(pcar+0x450,  0,  -1.2566371,  0);
  setfloat(pcar+0x480,  0,  -1.2566371,  0);
  setfloat(pcar+0x4b0,  0,  -1.2566371,  0);
  setfloat(pcar+0x4e0,  0,  -1.2566371,  0);
{
  setshort(pcar+0x3b6,  0,  0);
{
   static money;
static wasin;
if(!money) money = getint(0x08bde560);
if (pcar)
{
 wasin = true;
 speed = (sqrt(getfloat(pcar + 0x140) * getfloat(pcar + 0x140) + getfloat(pcar + 0x144) * getfloat(pcar + 0x144)))*100;
 setint(0x08bde55c,  speed,  speed);
 setchar(0x8BAEDB8,  '%',  'd',  0);
 setchar(0x8BAEDC0,  '%',  'd',  0);
}
else
{  if(wasin)
 {
 setchar(0x8BAEDB8,  '%',  '0',  '8',  'd',  '$',  0);
 setchar(0x8BAEDC0,  '$',  '%',  '0',  '8',  'd',  0);
 setint(0x08bde55c,  money,  money);
 wasin = false;
 }
 money = getint(0x08bde560);
{
  setchar(pcar+0x00000224, 0xff, 0x66, 0x00);
  setchar(pcar+0x00000228, 0xff, 0x66, 0x00);
}


#cheat Sentinel XTREME
if(getshort(pcar+0x58)==274)
{
  setfloat(pcar+0x450,  0,  -1.2566371,  0);
  setfloat(pcar+0x480,  0,  -1.2566371,  0);
  setfloat(pcar+0x4b0,  0,  -1.2566371,  0);
  setfloat(pcar+0x4e0,  0,  -1.2566371,  0);
{
  setshort(pcar+0x3b6,  0,  0);
{
  static rotation;
  if (rotation == 0)
  {
  rotation = 360;
  }
  spin = tan(rotation);
  setfloat(pcar + 0x644,  spin,  spin,  spin,  spin);
  rotation = rotation - 1;
  if (rotation == 1)
  {rotation = 360;}
  if (buttons & CTRL_CIRCLE && !(buttons & CTRL_LTRIGGER)) {
  //calculate speed
  speed = sqrt(getfloat(pcar + 0x140) * getfloat(pcar + 0x140) + getfloat(pcar + 0x144) * getfloat(pcar + 0x144));
  //if speed is lower than max speed for NOS accelerate
  if(speed<1.8) {
  setfloat(pcar+0x140,  getfloat(pcar+0x140)-getfloat(pcar+0x4)*0.005);
  setfloat(pcar+0x144,  getfloat(pcar+0x144)+getfloat(pcar)*0.005);
  }
  }
  //Power Brake if vehicle is on ground
  if(buttons & CTRL_SQUARE && getshort(pcar+0x1c8)==0) setfloat(pcar+0x140,  0,  0);
{
  setchar(pcar+0x00000224, 0x00, 0x00, 0x00);
  setchar(pcar+0x00000228, 0x00, 0x00, 0x00);
{
  static money;
static wasin;
if(!money) money = getint(0x08bde560);
if (pcar)
{
 wasin = true;
 speed = (sqrt(getfloat(pcar + 0x140) * getfloat(pcar + 0x140) + getfloat(pcar + 0x144) * getfloat(pcar + 0x144)))*100;
 setint(0x08bde55c,  speed,  speed);
 setchar(0x8BAEDB8,  '%',  'd',  0);
 setchar(0x8BAEDC0,  '%',  'd',  0);
}
else
{  if(wasin)
 {
 setchar(0x8BAEDB8,  '%',  '0',  '8',  'd',  '$',  0);
 setchar(0x8BAEDC0,  '$',  '%',  '0',  '8',  'd',  0);
 setint(0x08bde55c,  money,  money);
 wasin = false;
 }
 money = getint(0x08bde560);
}


P.S. Ignore the ERROR sign when you turn it on. The cars include lambo doors (thanks to vettefan88), nitrous (thanks to Waterbottle), the speed-o-meter(thanks to Waterbottle), and the spinners (thanks to vettefan88). I am not posting this on CS because I couldn't have made this without the mods help. The only thing I did was set the codes only to work on the infernus and the sentinel xs, make my own orange and black colors, and split each cheat (which was easy).

The Lamborghini's have a speed-o-meter, Lamborghini doors, black and orange color, and indeflatable tires. The Sentinel has a speed-o-meter, Lamborghini doors, black and orange color, nitrous, and indeflatable tires.

user posted image
user posted image
user posted image

Tommy - January 7, 2007 02:17 AM (GMT)
Good Job. ^_^

Guest - February 19, 2007 01:23 AM (GMT)
QUOTE (Waterbottle @ Nov 15 2006, 10:21 PM)
if(getshort(pcar+0x58)==180)
{
//something
}

would mkae somehitng happen only if you are in a bobcat

does the numbers 180 represent the car number?...

vettefan88 - February 19, 2007 01:50 AM (GMT)
QUOTE (Guest @ Feb 19 2007, 01:23 AM)
QUOTE (Waterbottle @ Nov 15 2006, 10:21 PM)
if(getshort(pcar+0x58)==180)
{
//something
}

would mkae somehitng happen only if you are in a bobcat

does the numbers 180 represent the car number?...

yep.
180 represents the bobcat.

if you in CD, go to the car spawner, and the number that appears to the left of a vehicle name is the vehicles number.

VCSaddiction - March 24, 2007 05:56 PM (GMT)
would there be a way to change the inside car color?

Freestyle - July 2, 2007 12:08 PM (GMT)
yeah, I did it a while back I might try to find it again.

roydude1 - January 18, 2009 03:44 PM (GMT)
im trying to make a car spawner (yes it is alredy made) i know its made, but i want to make one. it would only spawn one car, the one i want. here is what i have=
#cheat spawn police cheetah!! (press down)
if(press & CTRL_DOWN)
{
spawn(pcar = 0x98a2fee)
}




Hosted for free by InvisionFree