I've been busy making an overly hacked multli-hack for AssaultCube, so i thought i'd share some of the features. I think this tutorial is fairly noob-friendly.
Teleporting
Code:
float px[5]; // change the [5] to how many Tele slots you want !
float py[5];
float pz[5];
void telesave(int j)
{
px[j] = player1->o.x;
py[j] = player1->o.y;
pz[j] = player1->o.z;
}
void teleload(int x)
{
vec tele (px[x], py[x], pz[x]);
player1->newpos = tele;
}
COMMAND(telesave, ARG_1INT); // Type in console -> telesave 1 to save in slot 1
COMMAND(teleload, ARG_1INT);
Fly Hack - Funny online
Code:
void flyhack(){
player1->spectatemode = SM_FLY;}
// to turn off -->player1->spectatemode = SM_NONE;
// ---- player1->state=CS_ALIVE;
COMMAND(flyhack, ARG_NONE);
Teleport Health -> Player
Code:
void gethealth() // Put this in drawhud for it to auto-gather health
{
loopv(ents)
{
entity &e = ents[i];
if (e.type==I_HEALTH) // Change this to I_AMMO, I_HELMET, etc for armor and ammo
{
e.x = player1->o.x;
e.y = player1->o.y;
e.z = player1->o.z;
}
}
}
COMMAND(gethealth, ARG_NONE);
Set Health/Armor (Single Player only)
Code:
void sethealth(int inthealth) // can also set frags, score, deaths, etc.
{
player1->health = inthealth;
}
COMMAND(sethealth, ARG_1INT); // type sethealth 999 to sethealth to 999
void setarmor(int intarmor)
{
player1->armour = intarmor;
}
No Recoil/Spread
Go to weapon.cpp --> void weapon::attackphysics(vec &from, vec &to)
Find this code
Code:
if(spread>1)
{
#define RNDD (rnd(spread)-spread/2)*f
vec r(RNDD, RNDD, RNDD);
to.add(r);
#undef RNDD
}
// kickback & recoil
if(recoiltest)
{
owner->vel.add(vec(unitv).mul(recoil/dist).mul(owner->crouching ? 0.75 : 1.0f));
owner->pitchvel = min(powf(shots/(float)(recoilincrease), 2.0f)+(float)(recoilbase)/10.0f, (float)(maxrecoil)/10.0f);
}
else
{
owner->vel.add(vec(unitv).mul(recoil/dist).mul(owner->crouching ? 0.75 : 1.0f));
owner->pitchvel = min(powf(shots/(float)(g.recoilincrease), 2.0f)+(float)(g.recoilbase)/10.0f, (float)(g.maxrecoil)/10.0f);
}
And comment out, or delete.
Tele-Nade Kill (Dont know if it works on MultiP
Code:
void telenadekill(int m)
{
particle_fireball(5, players[m]->o);
particle_trail(17, 500,player1->o, players[m]->o);
int damage = guns[GUN_GRENADE].damage;
hit(damage, players[m], player1, vec(), GUN_GRENADE, true, 0);
}
COMMAND(telenadekill, ARG_1INT); // Type in telenadekill and then the CN number and it will teleport a nade to them.
hudonlyf("\fRTele-Nading %s", players[m]->name);
If you want to add output msgs then...
Code:
hudonlyf("\fRTele-Nading %s", players[m]->name);
The "\fR" changes the color of the text, The list of colours are on AC Website.
the "%s", are where variables are inputted S = String, F = Float, d = Number (ithink).
Then you put the variable after the comma.
If you wanted a message to say the health, name and x pos of a player it would be
Code:
hudonlyf("PlayerName: %s PlayerHealth : %d Player X Pos : %f", players[m]->name, players[m]->health, players[m]->o.x);
That should do for now, Hope this helps someone. I've actually got hundreds more hacks than this, but obviously i want my own hack to be unique so i'll keep the more advanced features
Type b0ta1m AC into youtube [PM me on this if you have an idea for a feature. or you want some help]