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


(adsbygoogle = window.adsbygoogle || []).push({});

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-
02-04-2015, 04:57 PM #56
OPCode
Banned
    
template<typename T>
class Memory
// # Storing / Loading blocks of data into / from the currently active memory pool. Only supported for images loaded on the same machine. # //
// # Written by Bitwise # //
{
public:
Memory<T>(int dwAddress) : m_dwAddress(dwAddress)
{
m_value = strstr(typeid(T).name, "*") ? (T)(m_dwAddress) : *(T*)(m_dwAddress);
}
~Memory() : m_dwAddress(0), m_value(0) {}
T operator=(T value)
{
if(!strncmp(typeid(T).name, "const", 5))
{
printf("ERROR:\n\tCannot cast data type with identifer Constant.\n");
return 0;
}
!strncmp(typeid(T).name, "char *", 6) ? strncpy((T)(m_dwAddress), m_value = (T)value, strlen((T)(m_dwAddress))) : strstr(typeid(T).name, "*") ? (T)(m_dwAddress) = m_value = value : *(T*)(m_dwAddress) = m_value = value;
return m_value;
}
T Update() { return m_value = strstr(typeid(T).name, "*") ? (T)(m_dwAddress) : *(T*)(m_dwAddress); }
bool operator==(T cmpValue) {!strncmp(typeid(T).name, "char *", 6)?return !strcmp((T)Update(), (T)cmpValue) : return Update() == cmpValue; }
bool operator!=(T cmpValue) {!strncmp(typeid(T).name, "char *", 6)?return strcmp((T)Update(), (T)cmpValue) != 0 : return Update() != cmpValue; }
bool operator!() { return !Update(); }
bool operator>(T cmpValue) { !strncmp(typeid(T).name, "char *", 6)?return strcmp((T)Update(), (T)cmpValue) > 0 : return Update() > cmpValue; }
bool operator>=(T cmpValue) { !strncmp(typeid(T).name, "char *", 6)?return strcmp((T)Update(), (T)cmpValue) >= 0 : return Update() >= cmpValue; }
bool operator<(T cmpValue) { !strncmp(typeid(T).name, "char *", 6)?return strcmp((T)Update(), (T)cmpValue) < 0 : return Update() < cmpValue; }
bool operator<=(T cmpValue) { !strncmp(typeid(T).name, "char *", 6)?return strcmp((T)Update(), (T)cmpValue) <= 0 : return Update() <= cmpValue; }
T operator[](unsigned char index) { return strstr(typeid(T).name, "*")?m_value = (T)((m_dwAddress) + (index * sizeof(T))):m_value = *(T*)((m_dwAddress) + (index * sizeof(T)));}
// Only support's arrays with data types (no objects)
private:
static int m_dwAddress;
T m_value;
};


Use this instead of that obsolete "ReadInt" crap. If you don't know how to use it, you shouldn't be compiling anything in C++ until you learn more...

EDIT:
Fine, an example of using it outside a console...
    
int dwInt = 0x3F800000;
printf("Hexadecimal: %08X\nSingle Precision: %f\n\n", dwInt, Memory<float>(*&dwInt).m_value);


Output;

    
Hexadecimal: 3F800000
Single Precision: 1.0


02-06-2015, 11:12 PM #57
Boliberrys
^^ Sexy ^^
Originally posted by Lebigkilleur View Post
I just took the SC58 address and I are update with IDA Smile


Can you help me update them? I want to know how to update them by my own :3
02-07-2015, 04:02 AM #58
LBK
Little One
Originally posted by Boliberrys View Post
Can you help me update them? I want to know how to update them by my own :3


Give me your skype on pm Smile
02-07-2015, 05:18 AM #59
Boliberrys
^^ Sexy ^^
Check my signature xD
Originally posted by Lebigkilleur View Post
Give me your skype on pm Smile
02-10-2015, 06:16 AM #60
nice Smile
03-06-2015, 09:55 PM #61
A_Gen_Fiasco
Bounty hunter
Originally posted by OLDSCHOOLMODZHD View Post
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




This is what you use on your mod menu??
03-17-2015, 07:16 PM #62
For the little troll that reversed HudElem_Alloc for AW was trying to keep it private, so here's how to fix the huds for AW.

    
struct opd_s{
int sub;
int toc;
};

opd_s ParseAddr(int Address){
opd_s Result = { Address, 0x994F68 };
return Result;
}

game_hudelem_s* HudElem_Alloc(int Client, int Team = 0){ // For an all client element, set Client to 0x5FF
game_hudelem_s* elem;
for (int i = 0; i < 1024; i++){
if (elem->elem.type == 0) break;
elem = (game_hudelem_s*)(0x1810570 + (i * 0xBC));
}
((void(*)(game_hudelem_s*))&ParseAddr(0x316240))(elem); //HudElem_SetDefaults
elem ->team = Team;
elem ->clientNum = Client;
elem ->archived = true;
return elem ;
}

The following user thanked Ambition sG for this useful post:

Swaqq
03-17-2015, 07:37 PM #63
iMoD1998
Pokemon Trainer
Originally posted by Ambition
For the little troll that reversed HudElem_Alloc for AW was trying to keep it private, so here's how to fix the huds for AW.

    
struct opd_s{
int sub;
int toc;
};

opd_s ParseAddr(int Address){
opd_s Result = { Address, 0x994F68 };
return Result;
}

game_hudelem_s* HudElem_Alloc(int Client, int Team = 0){ // For an all client element, set Client to 0x5FF
game_hudelem_s* elem;
for (int i = 120; i < 1024; i++) //If it doesn't work, set I to 0 instead of 120;
{
if (elem->elem.type == 0) break;
elem = (game_hudelem_s*)(0x1810570 + (i * 0xBC));
}
((void(*)(game_hudelem_s*))&ParseAddr(0x316240))(elem); //HudElem_SetDefaults
elem ->team = Team;
elem ->clientNum = Client;
elem ->archived = true;
return elem ;
}


rekt m80
03-22-2015, 08:07 PM #64
SC58
Former Staff
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.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo