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-
03-22-2015, 11:14 PM #65
Originally posted by SC58 View Post
You must login or register to view this content.

Here is SV_GameSendServerCommand Reversed.

It's pretty cool to use like this in .sprx just hook the function and then the game will call it from your sprx instead of the function in EBOOT, you could also add a dump command to log all the command it sends in the function pretty neat stuff you can do with this or any function you wanna reverse to do this with.


You didn't have to reverse this. You could of just hooked it with hookFunctionStart. Also, what's up with people creating new structure object arrays for this opd_s shit. You could reduce so much with just this

    int ParseAddress(int Address){
return (Address << 16) & TOC;
}


and than you'd use it like this

    void(*SV_SendServerCommand)(int clientNum, svscmd_type type, const char * fmt, ...) = (void(*)(int, svscmd_type, const char *, ...))ParseAddress(0x44173Cool Man (aka Tustin);
04-06-2015, 08:49 AM #66
OLDSCHOOLMODZHD is very rude even when ask him a simple question e call you then deletes you off skype a to all who are tinking about buy this menu from his he is not gonna update after 1.11 he pritve message me and and told me on ngu after deleting me on skype not cool guys watch out
04-06-2015, 04:18 PM #67
LBK
Little One
Originally posted by cant
OLDSCHOOLMODZHD is very rude even when ask him a simple question e call you then deletes you off skype a to all who are tinking about buy this menu from his he is not gonna update after 1.11 he pritve message me and and told me on ngu after deleting me on skype not cool guys watch out


This is not the place to discuss this ...
04-09-2015, 04:16 AM #68
Originally posted by SC58 View Post
You must login or register to view this content.

Here is SV_GameSendServerCommand Reversed.

It's pretty cool to use like this in .sprx just hook the function and then the game will call it from your sprx instead of the function in EBOOT, you could also add a dump command to log all the command it sends in the function pretty neat stuff you can do with this or any function you wanna reverse to do this with.


It's good too see someone finally fully reverse it without failing, but it could use optimisation.
You must login or register to view this content.
EDIT: Excuse the typo's, I'm on my phone. You should get the point anyway
Last edited by Bitwise ; 04-09-2015 at 04:20 AM.

The following 2 users say thank you to Bitwise for this useful post:

RouletteBoi, SC58
06-21-2015, 04:53 PM #69
JBoyJr
Gobble
Can anyone help me install it if its ps4, I'm a noob and know nothing about modding. Thanks
06-21-2015, 04:54 PM #70
Toxic
former staff
Originally posted by JBoyJr View Post
Can anyone help me install it if its ps4, I'm a noob and know nothing about modding. Thanks


Really Not Happy or Sad?

The following user thanked Toxic for this useful post:

Bitwise
06-21-2015, 04:56 PM #71
JBoyJr
Gobble
yeh, Idk much, i don't even know if I could put this stuff on a usb.
06-22-2015, 07:18 PM #72
Xavier Hidden
Are you high?
Hard core codes. The scripts here look so god dayum hard to learn. You gotta have lots of time on your hands to grasp these. And you guys must be kidding about the usb thing right? This is no cfg shit. You need a signed firmware to use this. ofw's are all unsigned. hehe I kno some things now..
07-02-2015, 01:18 PM #73
what do you do with the codes

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo