

// you need to read id before that and attach your program to game as hProcess, you can find them in tuttorial files
int id;
offset_pos=8;
long p_base_address_x_velocity=7697344+(id*offset_pos); //[id] player's x velocity address
if(GetAsyncKeyState(0x05)){//m4 button hotkey
ReadProcessMemory(hProcess, (void *)p_base_address_x_velocity,(void *) &p_x_v,sizeof(p_x_v),0); // this reads current speed and stores as p_x_v
xh=p_x_v+0.00007; //increase right speed by 0.00007 xh is + value
yh=p_x_v-0.00007; //increase left speed by 0.00007 yh is - value(xh and yh stands for nothing)
if(p_x_v>4.8) //dont do anything if player too speedy or too slow (cannonball speed is something like 5.5)
continue;
if(p_x_v<-4.8)
continue;
if(p_x_v<2 && p_x_v>-2)
continue;
if(GetAsyncKeyState(0x44)){//d key hotkey
if(0<p_x_v<5.5 ){ // dont speed up if speed is max
WriteProcessMemory(hProcess, (void *)p_base_address_x_velocity, (void *)&xh,sizeof(xh),0);//speed up
}}
if(GetAsyncKeyState(0x41)){//a key hotkey
if(0>p_x_v>-5.5){
WriteProcessMemory(hProcess, (void *)p_base_address_x_velocity, (void *)&yh,sizeof(yh),0);//speed up
}}}




