Post: Advanced Warfare C++ Script Thread
11-05-2014, 04:48 AM #1
(adsbygoogle = window.adsbygoogle || []).push({});
Welcome and feel free to post yours below Smile
TOC:
0x994F68
Some Addresses
    
Updating...

Client Functions:

Fair Aimbot
    
namespace Aimbot
{
int G_Client(int clientIndex) {return Offsets::G_Client + ( clientIndex * Offsets::G_Client_Size ); }
int G_Entity(int clientIndex) {return Offsets::G_Entity + ( clientIndex * Offsets::G_Entity_Size ); }

bool CheckTeam(int Client, int OtherClient)
{
int Attacker = *(int*)(G_Client(Client) + Offsets::Team);
int Victim = *(int*)(G_Client(OtherClient) + Offsets::Team);
if(Attacker == Victim)
{
return true;
}
else
{
return false;
}
}

float GetStance(int client)
{
if(*(int*)(G_Client(client) + 0x5A) == 262144 || *(int*)(G_Client(client) + 0x5A) == 393216)
{
return 24;//crouched
}
else if(*(int*)(G_Client(client) + 0x5A) == 655360 || *(int*)(G_Client(client) + 0x5A) == 52428Cool Man (aka Tustin)
{
return 42;//prone
}
else if(*(int*)(G_Client(client) + 0x5A) == 0 || *(int*)(G_Client(client) + 0x5A) == 131072)
{
return -3;//standing
}
}

bool CheckIfLiving(int client)
{
if(*(int*)(G_Entity(client) + Offsets::Health) != 0)
{
return true;
}
else return false;
}

bool ClientIsInGame(int clientIndex)
{
if(*(int*)G_Client(clientIndex) != 0)
return true;
else return false;
}

struct Vec3
{
float x, y, z;
};

Vec3 Difference;
Vec3 GetVec(Vec3 Attacker, Vec3 Target)
{
Difference.x = (Target.x - Attacker.x);
Difference.y = (Target.y - Attacker.y);
Difference.z = (Target.z - Attacker.z);
return Difference;
}

float dx, dy, dz;
float Get3dDistance( Vec3 c1, Vec3 c2 )
{
float dx = c2.x - c1.x;
float dy = c2.y - c1.y;
float dz = c2.z - c1.z;

return sqrt((float)((dx * dx) + (dy * dy) + (dz * dz)));
}

Vec3 vec;
Vec3 GetPlayerOrigin(int Client)
{
vec = *(Vec3*)(G_Client(Client) + Offsets::Origin);
return vec;
}

Vec3 VecV;
Vec3 GetPlayerOriginVictim(int Client)
{
VecV = *(Vec3*)(G_Client(Client) + Offsets::Origin);
VecV.z -= GetStance(Client);
return VecV;
}

int Nearest;
int GetNearestPlayer(int Client)
{
float MaxDistance = 99999999;
for (int i = 0; i < 12; i ++)
{
Vec3 Attacker = GetPlayerOrigin(Client);
Vec3 Vic = GetPlayerOrigin(i);
float ActualDistance = Get3dDistance(Attacker, Vic);
if ((i != Client) && CheckIfLiving(i) && ClientIsInGame(i))
{
if(cstrcmp(Func:Happyvar_GetString("ui_gametype"), "dm") == 0)
{
if (ActualDistance < MaxDistance)
{
Nearest = i;
MaxDistance = ActualDistance;
}
}
else
{
if(!CheckTeam(Client, i))
{
if (ActualDistance < MaxDistance)
{
Nearest = i;
MaxDistance = ActualDistance;
}
}
}
}
}
return Nearest;
}

float angles[3];
float* vectoangles(Vec3 Angles)
{
float forward;
float yaw, pitch;
float PI = 3.1415926535897931;
if (Angles.x == 0 && Angles.y == 0)
{
yaw = 0;
if (Angles.z > 0) pitch = 90.00;
else pitch = 270.00;
}
else
{
if (Angles.x != -1) yaw = (float)(atan2((double)Angles.y, (double)Angles.x) * 180.00 / PI);
else if (Angles.y > 0) yaw = 90.00;
else yaw = 270;
if (yaw < 0) yaw += 360.00;

forward = (float)sqrt((double)(Angles.x * Angles.x + Angles.y * Angles.y));
pitch = (float)(atan2((double)Angles.z, (double)forward) * 180.00 / PI);
if (pitch < 0) pitch += 360.00;
}
angles[0] = -pitch;
angles[1] = yaw;
angles[2] = 0;

return angles;
}

opd_s Setangles_t = { Offsets::SetClientViewAngles, TOC };
void(*SetClientViewAnlges)(int Ent, float* Angles) = (void(*)(int , float*))&Setangles_t;

void SetViewAngles(int Client)
{
int Victim = GetNearestPlayer(Client);
float* Angles = vectoangles(GetVec(GetPlayerOrigin(Client), GetPlayerOriginVictim(Victim)));
SetClientViewAnlges(G_Entity(Client), Angles);
}
};


Health Bar
    
// add these to your spawn huds:
Vars::ClientHUD[i].HealthBar = HUDS::SetShader(i, 88, 202, 15, 210, 400, 0, 0, 0, 0, 0);
Vars::ClientHUD[i].HealthBar1 = HUDS::SetShader(i, 88, 200, 11, 211, 402, 0, 255, 255, 255, 0);
void HealthBar(int client)
{
if(!Vars::Client[client].HealthBar)
{
HUDS::FadeOverTime(Vars::ClientHUD[client].HealthBar, 100, 0, 0, 0, 160);
HUDS::FadeOverTime(Vars::ClientHUD[client].HealthBar1, 100, 255, 255, 255, 160);
Func::iPrintlnBold(client, "Health bar: [ ^2Enabled ^7]");
Vars::Client[client].HealthBar = true;
}
else
{
HUDS::FadeOverTime(Vars::ClientHUD[client].HealthBar, 100, 0, 0, 0, 0);
HUDS::FadeOverTime(Vars::ClientHUD[client].HealthBar1, 100, 255, 255, 255, 0);
Func::iPrintlnBold(client, "Health bar: [ ^1Disabled ^7]");
Vars::Client[client].HealthBar = false;
}
}

void DoHealthBar(int client)
{
int Health = *(int*)(G_Entity(client) + Offsets::Health);
if(Vars::Client[client].HealthSet != Health)
{
HUDS::ScaleWidth(Vars::ClientHUD[client].HealthBar1, (Health * 2));
Vars::Client[client].HealthSet = Health;
}
}


Third Person
    
void ThirdPerson(int client)
{
if(!Vars::Client[client].ThirdPerson)
{
SetDvar(client, "4 1");
iPrintlnBold(client, "ThirdPerson: [ ^2Enabled ^7]");
Vars::Client[client].ThirdPerson = true;
}
else
{
SetDvar(client, "4 0");
iPrintlnBold(client, "ThirdPerson: [ ^1Disabled ^7]");
Vars::Client[client].ThirdPerson = false;
}
}


Button monitoring
    
namespace Buttons //Credits to Zim Zam Bim Bam
{
enum Buttons
{
L1 = 526336,
L2 = 32768,
L3 = 8194,
R1 = 1,
R2 = 16384,
R3 = 67108868,
Cross = 1024,
Square = 48,
Crouch = 512,
Prone = 256,
Start = 8388608,
};

bool DetectBtn(int client, int Buttons)
{
if (*(int*)(G_Client(client) + 0x3DB4) == Buttons)
return true;
else return false;
}
};

G_GivePlayerWeapon
    
opd_s Add_Ammo_t = { Offsets::Add_Ammo, TOC };
void(*Add_Ammo)(int* G_Entity, unsigned int WeaponIndex, char WeaponModel, int Count, int FillClip) = (void(*)(int*, unsigned int, char, int, int))&Add_Ammo_t;

opd_s G_GivePlayerWeapon_t = { Offsets::G_GivePlayerWeapon, TOC };
void(*G_GivePlayerWeapon)(int* G_Client, int WeaponIndex, char ModelIndex) = (void(*)(int*, int, char))&G_GivePlayerWeapon_t;

opd_s BG_FindWeaponIndexForName_t = { Offsets::BG_FindWeaponIndexForName, TOC };
void(*BG_FindWeaponIndexForName)(int buffer, const char* Weapon) = (void(*)(int, const char*))&BG_FindWeaponIndexForName_t;

int GetWeaponIndex(const char* Weapon)
{
BG_FindWeaponIndexForName(0x1100000, Weapon);
return *(int*)0x1100000;
}

void GiveWeapon(int Client, const char* Weapon, int Akimbo = 0)
{
int Index = GetWeaponIndex(Weapon);
G_GivePlayerWeapon((int*)G_Client(Client), Index, Akimbo);
Add_Ammo((int*)G_Entity(Client), Index, 0, 9999, 1);
char buf[100];
Com_sprintf(buf, 100, "a %i \"", Index, "\"");
SV_GSSC(Client, buf);
}



SV_GameSendServerCommand
    
opd_s SV = { Offsets::Sv_GameSendServerCommand, TOC };
void(*svgssc)(int client, int type, char* cmd) = (void(*)(int, int, char*))&SV;
#pragma region SV_GameSendServerCommand
void SV_GSSC(int client, char* command)
{
svgssc(client, 0, command);
}

void iPrintlnBold(int client, char* text)
{
char buf[100];
Com_sprintf(buf, 100, "c \"%s%s", text, "\"");
SV_GSSC(client, buf);
}

void iPrintln(int client, char* text)
{
char buf[100];
Com_sprintf(buf, 100, "f \"%s%s", text, "\"");
SV_GSSC(client, buf);
}

void SetBlur(int client, int BlurAmount)
{
char buf[100];
Com_sprintf(buf, 100, "i _ %i", BlurAmount);
SV_GSSC(client, buf);
}

void SetVision(int client, char* Vision)
{
char buf[100];
Com_sprintf(buf, 100, "J \"%s%s", Vision, "\"");
SV_GSSC(client, buf);
}

void SetDvar(int client, char* Dvar)
{
char buf[100];
Com_sprintf(buf, 100, "q \"%s%s", Dvar, "\"");
SV_GSSC(client, buf);
}
#pragma endregion



Game Functions:


Dvar_GetString
    
opd_s Dvar_GetString_t = { Offsets:Happyvar_GetString, TOC };
const char*(*Dvar_GetString)(const char* Dvar) = (const char*(*)(const char*))&Awesome facevar_GetString_t;


Dvar_GetBool
    
opd_s Dvar_GetBool_t = { Offsets:Happyvar_GetBool, TOC };
bool(*Dvar_GetBool)(const char* Dvar) = (bool(*)(const char*))&Awesome facevar_GetBool_t;


Com_Sprintf
    
opd_s Com_sprintf_t = { Offsets::Com_Sprintf, TOC };
int(*Com_sprintf)(char *dest, int size, const char *fmt, ...) = (int(*)(char* , int, char const *, ...))&Com_sprintf_t;


G_FindConfigstringIndex
    
opd_s G_FindConfigstringIndex_t = { Offsets::G_FindConfigstringIndex, TOC };
int(*G_FindConfigstringIndex)(const char *name, int start, int max, int create, const char *errormsg) = (int(*)(const char*, int, int, int, const char*))&G_FindConfigstringIndex_t;

int G_MaterialIndex(const char *name)
{
return G_FindConfigstringIndex(name, 0xD95, 0x190, 1, "material");
}

int G_LocalizedStringIndex(const char *name)
{
return G_FindConfigstringIndex(name, 0x217, 0x28A, 1, "localized string");
}




Hud Elements
    
union hudelem_color_t
{
struct
{
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
};
int rgba;
};

struct hudelem_s
{
int Active;
int font;
int alignOrg;
int alignScreen;
float x;
float y;
float z;
int type;
float FontScale;
int FromFontScale;
int FontScaleStartTime;
int FontScaleTime;
hudelem_color_t color;
hudelem_color_t fromColor;
int fadeStartTime;
int fadeTime;
int label;
int Width;
int Height;
int MaterialIndex;
int fromWidth;
int fromHeight;
int moveStartTime;
int moveTime;
float fromX;
float fromY;
int fromAlignOrg;
int fromAlignScreen;
int scaleStartTime;
int scaleTime;
int time;
int duration;
float value;
int text;
float sort;
hudelem_color_t glowColor;
int fxBirthTime;
int fxLetterTime;
int fxDecayStartTime;
int fxDecayDuration;
int soundID;
int unknown;
int flags;
};

struct game_hudelem_s
{
hudelem_s elem;
int ClientNum;
int team;
int archived;
int showInKillcam;
};

opd_s G_LocalizedStringIndex_t = { Offsets::G_LocalizedStringIndex, TOC };
int(*G_LocalizedStringIndex)(const char* Text) = (int(*)(const char*))&G_LocalizedStringIndex_t;

game_hudelem_s* HudElem_Alloc()
{
for (int i = 120; i < 1024; i++)
{
game_hudelem_s* elem = (game_hudelem_s*)(Offsets::G_HudElems + (i * 0xBC));
if (!elem->elem.type) return elem;
}
return (game_hudelem_s*)-1;
}

int GetLevelTime()
{
return *(int*)0x179D5C0;
}

game_hudelem_s* SetShader(int clientIndex, int Shader, int Width, int Height, float X, float Y, int Allign = 0, unsigned char R = 0, unsigned char G = 0, unsigned char B = 0, unsigned char A = 0)
{
game_hudelem_s* elem = HudElem_Alloc();
elem->ClientNum = clientIndex;
elem->elem.type = 4;
elem->elem.MaterialIndex = Shader;
elem->elem.Width = Width;
elem->elem.Height = Height;
elem->elem.x = X;
elem->elem.y = Y;
elem->elem.alignOrg = Allign;
elem->elem.color.r = R;
elem->elem.color.g = G;
elem->elem.color.b = B;
elem->elem.color.a = A;
elem->elem.Active = 1;
return elem;
}

game_hudelem_s* SetText(int clientIndex, const char* Text, int Font, float FontScale, float X, float Y, int Allign, float Sort, unsigned char R = 0, unsigned char G = 0, unsigned char B = 0, unsigned char A = 0, unsigned char glowR = 0, unsigned char glowG = 0, unsigned char glowB = 0, unsigned char glowA = 0)
{
game_hudelem_s* Elem = HudElem_Alloc();
Elem->ClientNum = clientIndex;
Elem->elem.type = 1;
Elem->elem.font = Font;
Elem->elem.FontScale = FontScale;
if (Allign != 0)
{ Elem->elem.alignOrg = 5; Elem->elem.alignScreen = Allign; Elem->elem.x = X; Elem->elem.y = Y; }
else
{ Elem->elem.x = X; Elem->elem.y = Y; }
Elem->elem.color.r = R;
Elem->elem.color.g = G;
Elem->elem.color.b = B;
Elem->elem.color.a = A;
Elem->elem.glowColor.r = glowR;
Elem->elem.glowColor.g = glowG;
Elem->elem.glowColor.b = glowB;
Elem->elem.glowColor.a = glowA;
Elem->elem.text = G_LocalizedStringIndex(Text);
Elem->elem.Active = 1;
return Elem;
}

void ChangeText(game_hudelem_s* elemIndex, const char* Text)
{
elemIndex->elem.Text = G_LocalizedStringIndex(Text);
}

void MoveOverTime(game_hudelem_s* elemIndex, int time, float X, float Y)
{
elemIndex->elem.FromX = elemIndex->elem.x;
elemIndex->elem.FromY = elemIndex->elem.y;
elemIndex->elem.MoveStartTime = GetLevelTime();
elemIndex->elem.MoveTime = time;
elemIndex->elem.x = X;
elemIndex->elem.y = Y;
}

void MoveShaderXY(game_hudelem_s* elemIndex, float X, float Y)
{
elemIndex->elem.x = X;
elemIndex->elem.y = Y;
}

void ScaleOverTime(game_hudelem_s* elemIndex, int time, int width, int height)
{
elemIndex->elem.FromHeight = elemIndex->elem.Height;
elemIndex->elem.FromWidth = elemIndex->elem.Width;
elemIndex->elem.ScaleStartTime = GetLevelTime();
elemIndex->elem.ScaleTime= time;
elemIndex->elem.Width = width;
elemIndex->elem.Height = height;
}

void FontScaleOverTime(game_hudelem_s* elemIndex, float FontSize, int time)
{
elemIndex->elem.FromFontScale = elemIndex->elem.FontScale;
elemIndex->elem.FontScale = FontSize;
elemIndex->elem.FontScaleTime = time;
elemIndex->elem.FontScaleStartTime = GetLevelTime();
}

void SetGlow(game_hudelem_s* Text, int GlowR, int GlowG, int GlowB, int GlowA)
{
Text->elem.GlowColor.r = GlowR;
Text->elem.GlowColor.g = GlowG;
Text->elem.GlowColor.b = GlowB;
Text->elem.GlowColor.a = GlowA;
}

void FadeOverTime(game_hudelem_s* Elem, int Time, unsigned char R, unsigned char G, unsigned char B, unsigned char A)
{
Elem->elem.FromColor = Elem->elem.Color;
Elem->elem.Color.r = R;
Elem->elem.Color.g = G;
Elem->elem.Color.b = B;
Elem->elem.Color.a = A;
Elem->elem.FadeTime = Time;
Elem->elem.FadeStartTime = GetLevelTime();
}


Credits:
    
BlackPanther
SC58
BadLuckBrian
Shark
Seb


Last edited by OLDSCHOOLMODZHD ; 11-24-2014 at 09:43 PM. Reason: Updated for 1.04

The following 32 users say thank you to OLDSCHOOLMODZHD for this useful post:

Absolute Zero, Albus, BaSs_HaXoR, Boliberrys, Chinx Drugz, Defc0n_xD, Dynasty Modz, Eddie Mac, ErasedDev, Full-Evil, FusionIsDaName, iProgeny, Welsh, Jannik007, NickBeHaxing, NotALegitPlayer, ReqLobbies, SaberNGU, SC58, ScaRzModZ, smashedya, Smoky420, subkiller369, Swaqq, TheModedHacker, Tipton_Modz, top_top, TotalModzHD, xDebugKiller, xhevanlyx, zRayz-
11-18-2014, 11:57 PM #20
RatchetBooty
Former Staff
Originally posted by OLDSCHOOLMODZHD View Post
means of death
    
enum MeansOfDeath
{
MOD_UNKNOWN,
MOD_PISTOL_BULLET,
MOD_RIFLE_BULLET,
MOD_EXPLOSIVE_BULLET,
MOD_GRENADE,
MOD_GRENADE_SPLASH,
MOD_PROJECTILE,
MOD_PROJECTILE_SPLASH,
MOD_MELEE,
MOD_MELEE_ALT,
MOD_HEAD_SHOT,
MOD_MELEE_DOG,
MOD_MELEE_ALIEN,
MOD_CRUSH,
MOD_FALLING,
MOD_SUICIDE,
MOD_TRIGGER_HURT,
MOD_EXPLOSIVE,
MOD_IMPACT,
MOD_ENEGRY
}meansOfDeath_e;


credits codresearch


Sadly you can't call Player_Die or G_Damage ONLINE using RPC. Not even SetClientViewAngles. FPS and R_SetFrameFog both freeze you. So you'd have to use an sprx.
11-19-2014, 12:12 AM #21
Originally posted by RatchetBooty View Post
Sadly you can't call Player_Die or G_Damage ONLINE using RPC. Not even SetClientViewAngles. FPS and R_SetFrameFog both freeze you. So you'd have to use an sprx.


yea you can make a better rpc lol
edit: also you cant call player_die or G_Damage in sprx without reversing the function to call it your self.
11-19-2014, 12:17 AM #22
SC58
Former Staff
Originally posted by OLDSCHOOLMODZHD View Post
yea you can make a better rpc lol
edit: also you cant call player_die or G_Damage in sprx without reversing the function to call it your self.


Or you could just do it in asm in sprx or make your own custom ppc code to overwrite another function like a rpc for it.

The following user thanked SC58 for this useful post:

OLDSCHOOLMODZHD
11-19-2014, 12:45 AM #23
GIVEME-ALL
I’m too L33T
Working 100%
Your the boss
11-19-2014, 12:50 AM #24
SC58
Former Staff
Plus maybe you .sprx user's can get some use out of this.

You must login or register to view this content.
11-24-2014, 11:36 AM #25
Originally posted by SC58 View Post
Plus maybe you .sprx user's can get some use out of this.

You must login or register to view this content.


You must login or register to view this content.

Winky Winky
11-24-2014, 11:37 AM #26
Originally posted by Swiss View Post
    
namespace Buttons
{
int
L1 = 526336,
L2 = 32768,
L3 = 8194,
R1 = 1,
R2 = 16384,
R3 = 67108868,
Cross = 1024,
Square = 48,
Crouch = 512,
Prone = 256,
Start = 8388608;
};

bool ButtonPressed(int Client, int Button)
{
if (*(int*)ReadInt(0x19090B4 + (Client * 0x4180), 1) == Button)
return true;
else return false;
}


How to use:
    
if (ButtonPressed(0, Buttons::R3))
{
//
}

Credit to BlackPanther for the Button Monitoring release


Why would you do this?

    
*(int*)ReadInt(0x19090B4 + (Client * 0x4180), 1) == Button


Just do

    
*(int*)0x19090B4 + (Client * 0x4180) == Button
11-24-2014, 09:41 PM #27
Originally posted by Doctor
Why would you do this?

    
*(int*)ReadInt(0x19090B4 + (Client * 0x4180), 1) == Button


Just do

    
*(int*)0x19090B4 + (Client * 0x4180) == Button

I changed it on the main one :p
12-03-2014, 06:49 PM #28
thanks

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo