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-05-2014, 06:48 PM #11
Hmm thinking to getting into the world of coding....^_^
11-13-2014, 11:56 AM #12
xReaperv3
Bounty hunter
Updated G_GivePlayerWeapon

    
opd_s Add_Ammo_t = { 0x30D198, 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 = { 0x3670E8, TOC };
void(*G_GivePlayerWeapon)(int* G_Client, int weaponIndex, char modelIndex) = (void(*)(int*, int, char))&G_GivePlayerWeapon_t;

opd_s BG_FindWeaponIndexForName_t = { 0x1662DC, 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 SwitchToWeapon(int clientIndex, int weaponIndex)
{
char buf[100];
Com_sprintf(buf, 100, "a %i \"", weaponIndex, "\"");
SV_GameSendServerCommand(clientIndex, buf);
}

void GiveWeapon(int clientIndex, const char* Weapon)
{
int weaponIndex = GetWeaponIndex(Weapon);
G_GivePlayerWeapon((int*)G_Client(clientIndex), weaponIndex, 0);
Add_Ammo((int*)G_Entity(clientIndex), weaponIndex, 0, 9999, 1);
SwitchToWeapon(clientIndex, weaponIndex);
}

The following user thanked xReaperv3 for this useful post:

Arrow_Modz
11-18-2014, 04:03 PM #13
Updated Enjoy Smile
11-18-2014, 04:06 PM #14
Originally posted by xReaperv3 View Post
~snip~


You do realize that switch to weapon with the "" are doing nothing right for a string to be used you have to put %s where its going to be along with %i for integers.
11-18-2014, 04:13 PM #15
Geo
Don't Believe The Title
This has helped various people and seeing as the other thread is based around C# I thought this would be more useful sticky'd :p

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

Boliberrys, OLDSCHOOLMODZHD
11-18-2014, 07:16 PM #16
Akaipwn
Do a barrel roll!
Originally posted by OLDSCHOOLMODZHD View Post
Welcome and feel free to post yours below Smile
TOC:
0x994EA0
Some Addresses
    
Sv_GameSendServerCommand = 0x42A09C, //set dvar = q, iPrintln = f, iPrintlnBold = c, blur = i _, Visions = J, swap weapon = a, PlaySound = h,
cbuf_addtext = 0x38777C,
LocalName = 0x2892C60,
Com_Sprintf = 0x4C2BA8,
G_Spawn = 0x363668,
G_GetWeaponIndexForName = 0x368188,
G_SetModel = 0x36241C,
G_SoundAlliasIndex = 0x4CA80,
G_GivePlayerWeapon = 0x3670E8,
Add_Ammo = 0x30D198,
BG_FindWeaponIndexForName = 0x1662DC,
SetClientViewAngles = 0x2F1688,
G_FindConfigstringIndex = 0x470C0,
SV_ExecuteClientCommand = 0x42865C,

//Huds
G_HudElems = 0x176E6E8,
Hudelem_Size = 0xBC,
G_LocalizedStringIndex = 0x4C938,
HudElem_Alloc = 0x309A98,
Scr_PrecacheShader = 0x33BA64,
G_MaterialIndex = 0x47210,
level_locals_t = 0x179D700,
leveltime = level_locals_t + 0x4C0,

//Dvars
Dvar_GetBool = 0x4BA750,
Dvar_GetString = 0x4BA898,

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) + Offsets::ButtonMonitoring) == 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




Any possibility that you could find Player_Die or G_DamageClient and all the needed offsets for it to function correctly?
11-18-2014, 07:28 PM #17
Boliberrys
^^ Sexy ^^
Wow pretty nice thread!
OldSchool, one question. Is there a way to create SPRX using Visual Studio 2012?
Thanks again for your post!
Originally posted by OLDSCHOOLMODZHD View Post
Welcome and feel free to post yours below Smile
TOC:
0x994EA0
Some Addresses
    
Sv_GameSendServerCommand = 0x42A09C, //set dvar = q, iPrintln = f, iPrintlnBold = c, blur = i _, Visions = J, swap weapon = a, PlaySound = h,
cbuf_addtext = 0x38777C,
LocalName = 0x2892C60,
Com_Sprintf = 0x4C2BA8,
G_Spawn = 0x363668,
G_GetWeaponIndexForName = 0x368188,
G_SetModel = 0x36241C,
G_SoundAlliasIndex = 0x4CA80,
G_GivePlayerWeapon = 0x3670E8,
Add_Ammo = 0x30D198,
BG_FindWeaponIndexForName = 0x1662DC,
SetClientViewAngles = 0x2F1688,
G_FindConfigstringIndex = 0x470C0,
SV_ExecuteClientCommand = 0x42865C,

//Huds
G_HudElems = 0x176E6E8,
Hudelem_Size = 0xBC,
G_LocalizedStringIndex = 0x4C938,
HudElem_Alloc = 0x309A98,
Scr_PrecacheShader = 0x33BA64,
G_MaterialIndex = 0x47210,
level_locals_t = 0x179D700,
leveltime = level_locals_t + 0x4C0,

//Dvars
Dvar_GetBool = 0x4BA750,
Dvar_GetString = 0x4BA898,

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) + Offsets::ButtonMonitoring) == 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


11-18-2014, 07:54 PM #18
RatchetBooty
Former Staff
Originally posted by Akaipwn View Post
Any possibility that you could find Player_Die or G_DamageClient and all the needed offsets for it to function correctly?


You only need Player_Die or G_DamageClient and it's parameters. The parameters for Player_Die are:

void player_die ( gentity_t * self,
gentity_t * inflictor,
gentity_t * attacker,
int damage,
int meansOfDeath
)
So basically you would use G_Entity for the first 3, then you would put the amount of damage you want impacted onto the enemy as an interger and then you would put the meansofdeath. You'd have to player with the means of death. Means of death means how they died. So let's say you put 1, that would show that you knifed them. 2 would show that you shot them and so on. You'd try finding the one that shows headshot or just a normal kill which is 9 I'm pretty sure.
11-18-2014, 10:24 PM #19
Originally posted by RatchetBooty View Post
~snip~

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

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo