Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "data.h"
- Data data();
- //https://www.mediafire.com/folder/645ajcr0ntq4t/Modding
- //Working Status: UnTested
- //Note: Maybe Ethernet/Ethernet/Ambition sG is a fgt, a lying skid fgt.
- //Note2: Not every little thing on this pastebin is reversed, afew things I wiped up myself
- unsigned __int64 getXuidPopup()
- {
- *(__int64*)(0x83C9B258 + 0x90428) = *(__int64*)(0x83C9B258 + 0x90430);
- return *(unsigned __int64*)(0x83C9B258 + 0x90428);
- }
- //Working Status: Tested & Working
- void (*SV_LinkEntity)(int entity) = (void(__cdecl*)(int))0x824ECDF8;
- typedef enum : short
- {
- script_brushmodel = (0x834DA900 + 0xA2),
- script_model = (0x834DA900 + 0xA6),
- script_origin = (0x834DA900 + 0xA8),
- light = (0x834DA900 + 0x76)
- }random;
- void Solid(int entity)
- {
- short classId = *(short*)(entity + 0x17A);
- if(classId & *(short*)script_brushmodel || classId & *(short*)script_model || classId & *(short*)script_origin || classId & *(short*)light)
- {
- if(classId != *(short*)script_origin)
- {
- if(classId & *(short*)script_model)
- {
- *(int*)(entity + 0x11C) = 0x2080;
- SV_LinkEntity(entity);
- }
- else
- {
- *(int*)(entity + 0x11C) = 1;
- *(int*)(entity + 0x08) &= ~1;
- SV_LinkEntity(entity);
- }
- }
- else
- {
- printf("script_origin cannot be made solid (eIndex %i)\n", *(int*)entity);
- }
- }
- }
- //Working Status: Tested & Working
- int getBrushModel()
- {
- int id;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_prisionbreak"))
- id = 0x38;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_dart"))
- id = 0x6B;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_lonestar"))
- id = 0x6A;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_frag"))
- id = 0x55;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_snow"))
- id = 0x56;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_fahrenheit"))
- id = 0xA8;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_hasima"))
- id = 0x63;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_warhawk"))
- id = 0x45;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_soverign"))
- id = 0x72;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_zebra"))
- id = 0x44;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_skeleton"))
- id = 0x3A;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_chasm"))
- id = 0x49;
- if(!strcmp(Dvar_GetString("ui_mapname"),"mp_flooded") || !strcmp(Dvar_GetString("ui_mapname"),"mp_strikezone"))
- id = 0x57;
- return 0x83379A80 + (id * 0x280);
- }
- //Working Status: Tested & Working
- void (*SV_UnlinkEntity)(int entity) = (void(__cdecl*)(int))0x824ECA90;
- bool (*SV_SetBrushModel(int entity) = (bool(__cdecl*)(int))0x824D5CD0;
- void CloneScriptModelToBrushModel(int entity)
- {
- short classId = *(short*)(entity + 0x17A);
- int brushModel = getBrushModel();
- if(classId & *(short*)script_brushmodel || classId & *(short*)script_model || classId & *(short*)script_origin || classId & *(short*)light)
- {
- if(classId & *(short*)script_model && *(int*)(brushModel + 0x8C) != 0)
- {
- SV_UnlinkEntity(entity);
- *(int*)(entity + 0x8C) = *(int*)(brushModel + 0x8C); //Variable labeled "brushmodel" being spoofed to the correct value
- *(unsigned char*)(entity + 0x101) = 0x04; //Possibly
- SV_SetBrushModel(entity);
- *(int*)(entity + 0x11C) |= *(int*)(brushModel + 0x11C);
- SV_LinkEntity(entity);
- }
- else
- {
- printf("Entity must be script_model to be-able to clone to script_brushmodel (eIndex %i)\n", *(int*)(entity));
- }
- }
- }
- //Working Status: Untested
- void (*Scr_FreeHudElem)(game_hudelem_s*elem) = (void(__cdecl*)(game_hudelem_s*))0x82425648;
- void Delete(game_hudelem_s*elem)
- {
- Scr_FreeHudElem(elem);
- elem->elem.type = 0;
- }
- //Working Status: Working
- float Vec3DistanceSq(float*p1,float*p2)
- {
- float*dest[3];
- for(int i = 0; i < 3; i++) dest[i] = (p1[i]-p2[i]);
- return (dest[0]*dest[0] + dest[1]*dest[1] + dest[2]*dest[2]);
- }
- //Working Status: Working
- bool Closer(float*start, float*v1,float*v2)
- {
- float f1 = Vec3DistranceSq(start, v1), f2 = Vec3DistanceSq(start, v2);
- return (f1 < f2);
- }
- //Working Status: Untested
- void doSomeShit(int clientIndex, int r4, float*f3)//Found this lastnight, no idea what the fuck it is or does
- {
- int nextThink = *(int*)(getEntity(clientIndex) + 0x1AC);
- nextThink *= r4;
- *(int*)(getPlayerState(clientIndex) + 0x33D4) = ((nextThink + 0x32) / 0x64);
- if(*(int*)(getPlayerState(clientIndex) + 0x33D4) >= 0)
- {
- float*myOrigin[3] = { *(float*)(getPlayerState(clientIndex) + 0x1C), *(float*)(getPlayerState(clientIndex) + 0x20), *(float*)(getPlayerState(clientIndex) + 0x24) };
- *(float*)(getPlayerState(clientIndex) + 0x33DC) = (f3[2] - myOrigin[0]);
- *(float*)(getPlayerState(clientIndex) + 0x33E0) = (f3[1] - myOrigin[1]);
- *(float*)(getPlayerState(clientIndex) + 0x33E4) = (f3[0] - myOrigin[2]);
- }
- }
- //Working Status: Untested, stil need confirmation on 8/10 GSC functions inside
- bool enabled[0xC] = {true};
- void shootEffect(int clientIndex, char*effectName="explosions/grenadeExp_water")//v0.0.1 - Bitwise
- {
- while(enabled[clientIndex])
- {
- for(;;){
- desination dest;
- float*vec[3], *end[3], eye[3];
- Mod client(clientIndex, true); //Mod class, my media fire has it all
- if(Buttons(clientIndex) & BUTTON_RT)
- client.Recoil();
- Scr_AnglesToForward(*client.bit.angle, vec);
- for(int i = 0; i <= 2; i++)
- *end[i] = (vec[i]*20000);
- getTagOrigin(clientIndex, "tag_eye", eye);
- bulletTrace(eye, eye+end, true, getEntity(clientIndex));
- doEffect(effectName, *dest.Vector3);
- doEarthquake(0.3, 1, *dest.Vector3,1000);
- }
- }
- }
- typedef struct trace_t
- {
- float fraction;//0
- float normal[3];//4
- char padding[8];//0x10
- TraceHitType hitType;//0x18
- unsigned short hitId;//0x1C
- char _padding[0xC];
- };
- enum TraceHitType
- {
- None,
- entity,
- dynet_model,
- dynet_brush,
- UNKNOWN
- };
- //Working Status: Tested & Working
- unsigned short Trace_GetEntityHitId(trace_t*lel)
- {
- if(lel->hitType & dynet_model || lel->hitType & dynet_brush || lel->hitType & UNKNOWN) return 0x7FE;
- if(lel->hitType & entity) return 0x7FF;
- else return lel->hitId;
- }
- struct destination
- {
- char*name;
- unsigned int clientIndex;
- short Int16, *Int16_3[3];
- int Int32, *Int32_3[3];
- __int64 Int64, *Int64_3[3];
- float Float, *Vector3[3];
- unsigned char Byte, *Byte_3[3];
- };
- //Working Status: Untested
- void (*G_LocationalTrace)(trace_t *results, float *start, float *end, int passEntityNum, int contentmask, char *priorityMap) = (void(__cdecl*)(trace_t*,float*,float*,int,int,char*))0x823F1DD0;
- char* (*Com_SurfaceTypeToName)(int index) = (char*(__cdecl*)(int))0x8256F7D0;
- void bulletTrace(float*start, float*end, bool hitCharacters, int entity)
- {
- destination dest;
- trace_t targ;
- G_LocationalTrace(&targ, start, end, *(int*)entity, (hitCharacters ? 0x280E831 : 0x80A831), 1));
- for(int i = 0; i <= 2; i++)
- *dest.Vector3[i] = ((end[i]-start[i]) * targ.fraction) + start[i];
- unsigned short entity = (Trace_GetEntityHitId(&targ) & 0xFFFF);
- if(entity < 0x7FE) dest.clientIndex = (int)entity;
- if(dest.fraction != 1.0) int index = (int)dest.normal[2]; int result; __asm { srawi result, index, 0x14 }; dest.name = Com_SurfaceTypeToName(result & 0x1F);
- }
- //Working Status: Tested & Working
- int (*G_LocationalTracePassed)(float *start, float *end, int passEntityNum, int passEntityNum1, int contentmask, char *priorityMap) = (int(__cdecl*)(float*,float*,int,int,int,char*))0x823F1F70;
- bool bulletTracePassed(float*start, float*end, bool hitCharacters, int entity)
- {
- return G_LocationalTracePassed(start,end,*(int*)(entity),0x7FF,(hitCharacters ? 0x280E831 : 0x80A831), 0);
- }
- short getClassIndex(char*className)
- {
- if(!strcmp(classname,"script_model"))
- return *(short*)script_model;
- if(!strcmp(classname,"script_brushmodel"))
- return *(short*)script_brushmodel;
- if(!strcmp(classname,"script_origin"))
- return *(short*)script_origin;
- else
- return -1;
- }
- //Working Status: Untested but should work
- int (*G_Spawn)() = (int(__cdecl*)())0x8242AE50;
- int (*G_CallSpawnEntity)(int ent) = (int(__cdecl*)(int))0x82426578;
- void (*G_FreeEntity)(int ent) = (int(__cdecl*)(int))0x8242C620;
- int spawn(char*className, float*source, int flag=-1)
- {
- int entity = G_Spawn();
- *(short*)(entity + 0x17A) = getClassIndex(className);
- *(float*)(entity + 0x138) = source[0];
- *(float*)(entity + 0x13C) = source[1];
- *(float*)(entity + 0x140) = source[2];
- *(int*)(entity + 0x188) = (flag == -1 ? 0 : flag);
- if(!G_CallSpawnEntity(entity)) G_FreeEntity(entity);
- else { *(int*)(entity + 0x11C) = 0x00; }
- return entity;
- }
- //Working Status: Tested & Working
- int (*G_ModelIndex)(char*modelName) = (int(__cdecl*)(char*))0x8215C6A0;
- void setModel(int entity, char*modelName)
- {
- *(short*)(entity + 0x170) = G_ModelIndex(modelName);
- }
- //Working Status: Tested & Working
- void SetMiniMap(char*materialName, float ULX, float ULY, float LRX, float LRY)
- {
- void (*SV_SetConfigString)(int index, char*str) = (void(__cdecl*)(int,char*))0x824D82F0;
- SV_SetConfigString(0x43B, data().va("\"%s\" %f %f %f %f", materialName, ULX, ULY, LRX, LRY)); //Using data handler for linking strings
- }
- //Working Status: Tested & Working
- int (*SL_GetString)(char*str, int user) = (int(__cdecl*)(char*,int))0x8248FFE8;
- void Scr_GetLowercaseString(char*str, void*out)
- {
- char* buffer = new char[strlen(str)];
- for(int i = 0; i < 3; i++)
- buffer[i] = (char)tolower(str[i]);
- memcpy(out, (void*)SL_GetString(buffer, 0), 0x4);
- delete[] buffer;
- }
- //Working Status: Untested but should work
- int (*G_DObjGetWorldTagMatrix)(int ent, int tagName, float *tagMat) = (int(__cdecl*)(int,int,float*))0x8242C1A8;
- int (*SV_DObjExists)(int ent) = (int(__cdecl*)(int))0x824D6440;
- void getTagOrigin(int clientIndex, char*tagName, void*out)
- {
- /*
- 1 : <clientIndex> The index of the client in-game to be effected (integer)
- 2: <tagName> The name of the tag (string) e.g. "j_spine4"
- 3: <out> The variable where the successfully found origin will be stored. (vector3)
- Example:
- float origin[3];
- getTagOrigin(0, "j_spine4", &angles);
- */
- int entity = getEntity(clientIndex), level = 0x83375128, tagIndex = 0, entityNum = 0;
- float*tagMat[3];
- Scr_GetLowercaseString(tagName, &tagIndex);
- if(*(int*)(level + 0x2894) != *(int*)entity || *(int*)(level + 0x540) != *(int*)(level + 0x2890))
- if(SV_DObjExists(ent))
- memcpy((void*)tagMat, (void*)(level + 0x289C), 0xC);
- if(!G_DObjGetWordTagMatrix(ent, tagIndex, tagMat))
- memcpy(out, (void*)(level + 0x28C0), 0xC);
- else
- *(int*)(level + 0x2894) = *(int*)entity;
- *(int*)(level + 0x2890) = *(int*)(level + 0x540);
- else
- memcpy((out, (void*)(level + 0x28C0), 0xC);
- else
- memcpy(out, (void*)(level + 0x28C0), 0xC);
- if(*(short*)(level + 0x2898) & (short)tagIndex)
- memcpy(out, (void*)(level + 0x28C0), 0xC);
- }
- //Working Status: Untested but should work
- void (*AxisToAngles)(float*axis, float*angles) = (void(__cdecl*)(float*,float*))0x8254F3C0;
- void getTagAngles(int clientIndex, char*tagName, void*out)
- {
- /*
- 1 : <clientIndex> The index of the client in-game to be effected (integer)
- 2: <tagName> The name of the tag (string) e.g. "j_head"
- 3: <out> The variable where the successfully found angle's will be stored. (vector3)
- Example:
- float angles[3];
- getTagAngles(0, "j_head", &angles);
- */
- int entity = getEntity(clientIndex), level = 0x83375128, tagIndex = 0, entityNum = 0;
- float*tagMat[3], *angles[3];
- Scr_GetLowercaseString(tagName, &tagIndex);
- if(*(int*)(level + 0x2894) != *(int*)entity || *(int*)(level + 0x540) != *(int*)(level + 0x2890))
- if(SV_DObjExists(entity))
- memcpy((void*)tagMat, (void*)(level + 0x289C), 0xC);
- if(!G_DObjGetWorldTagMatrix(ent, tagIndex, tagMat)) AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
- else
- *(int*)(level + 0x2894) = *(int*)entity;
- *(int*)(level + 0x2890) = *(int*)(level + 0x540);
- else AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
- else AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
- if(*(short*)(level + 0x2898) & (short)tagIndex)
- AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
- }
- //Working Status: Untested but should work
- void setDepthofField(int clientIndex, float nstart, float nend, float fstart, float fend, float nblur, float fblur)
- {
- /*
- 1 : <clientIndex> The index of the client in-game to be effected
- 2 : <nstart> Before this distance, near depth of field is maximally blurry
- 3 : <nend> After this distance, near depth of field is perfectly in focus
- 4 : <fstart> Before this distance, far depth of field is perfectly in focus
- 5 : <fend> After this distance, far depth of field is maximally blurry
- 6 : <nblur> Maximal blur radius for near depth of field, in pixels at 640x480
- 7 : <fblur> Maximal blur radius for far depth of field, in pixels at 640x480
- Example: setDepthofField(0,10,80,1000,7000,5,1.5);
- */
- if(nstart >= 0 && nend >= 0 && fstart >= 0 && fend >= 0 && nblur >= 4 && nblur <= 10 && fblur >= 0 && fblur <= nblur)
- {
- *(float*)(getPlayerState(clientIndex) + 0xAA8) = nstart;
- *(float*)(getPlayerState(clientIndex) + 0xAAC) = nend;
- *(float*)(getPlayerState(clientIndex) + 0xAB0) = fstart;
- *(float*)(getPlayerState(clientIndex) + 0xAB4) = fend;
- *(float*)(getPlayerState(clientIndex) + 0xAB8) = nblur;
- *(float*)(getPlayerState(clientIndex) + 0xABC) = fblur;
- }
- }
- //Working Status: Untested
- void someThing(int clientIndex, float f1, float f2)
- {
- if(f1 >= 0 && f2 >= 0 && f1 < f2)
- {
- *(float*)(getPlayerState(clientIndex) + 0xAC0) = f1;
- *(float*)(getPlayerState(clientIndex) + 0xAC4) = f2;
- }
- }
- //Working Status: Untested but should work
- int (*G_EffectIndex)(char*effectName) = (int(__cdecl*)(char*))0x8215C7E0;
- int LoadFX(char*fx)
- {
- if(stricmp(fx, "fx/", 0x3) != 0 || stricmp(fx,"vfx/",0x4) != 0)
- {
- if(G_EffectIndex(fx) != 0 || *(int*)(0x83375128 + 0x2C) != 0) return G_EffectIndex(fx);
- }
- }
- //All enumerations and structures are correct
- typedef enum : int
- {
- RIFLE, SNIPER, MG, SMG, SPREAD, PISTOL, GRENADE, ROCKET_LAUNCHER, TURRET, THROWING_KNIFE, NON_PLAYER, ITEM
- }weapClass_t;
- typedef enum : int
- {
- PRIMARY, OFFHAND, ITEM, ALTMODE, EXCLUSIVE, SCAVENGER, FULL_AUTO, SINGLE_SHOT, BURST_2, BURST_3, BURST_4, X2_BARREL, NONE, SMALL, MEDIUM, LARGE
- }weapInventoryType_t;
- typedef enum : int
- {
- UNKNOWN, PISTOL_BULLET, RIFLE_BULLET, EXPLOSIE_BULLET, GRENADE, GRENADE_SPLASH, PROJECTILE, PROJECTILE_SPLASH, MELEE, HEAD_SHOT, MELEE_DOG, MELEE_ALIEN, CRUSH, FALLING, SUICIDE, TRIGGET_HURT, EXPLOSIVE, IMPACT
- }meansOfDeath_t;
- typedef struct
- {
- unsigned short entityNum, classNum;
- }scr_entref_t;
- //Working Status: Worked on MW2, re-reversed it and got a different result on ghosts, so untested but might(should) work
- int (*GScr_GetLocSelIndex)(char*locMat) = (int(__cdecl*)(char*))0x8215C9C0;
- /*
- Example:
- scr_entref_t ent;
- ent.entityNum = clientIndex;
- ent.classNum = 0;
- BeginLocationSelection(ent, "map_artillery_selector", 1, (*(float*)(0x83375128 + 0x28DC) / 5.625));
- */
- void BeginLocationSelection(scr_entref_t ent, char*locMat int flag, float size)
- {
- if(ent.classNum != 0) printf("ClassNum must be zero\n");
- if(size <= 0.0) printf("Radius of location selector must be greater than zero\n");
- float lol, mapSize = *(float*)(0x83375128 + 0x28DC);
- if(mapSize <= 0.0) lol = (size * 0.001);
- else lol = (mapSize / size);
- if(lol >= 0.0) { if(lol <= 1.0) { goto main; } else { goto main; } } else { goto main; }
- main:
- int flr = (int)floor((lol * 31.0) + 0.5);
- *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) = (GScr_GetLocSelIndex(locMat) & 3);
- *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) |= ((flr & 0x1F) << 2);
- *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) |= ((flag & 1) << 7);
- }
- //Working Status: Doesn't need testing, obviously would work
- void EndLocationSelection(scr_entref_t ent)
- {
- if(ent.classNum != 0) printf("ClassNum must be zero\n");
- else *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) = 0;
- }
- int G_GetTime()
- {
- return *(int*)(0x83375128 + 0x540);
- }
- void Scr_AnglesToForward(float*angles, float*forward)
- {
- float si = sin(angles[1]*(3.14159265358979323846*2 / 360));
- forward[0] = (cos(angles[1]*(3.14159265358979323846*2 / 360)) * cos(angles[0]*(3.14159265358979323846*2 / 360)));
- forward[1] = (cos(angles[1]*(3.14159265358979323846*2 / 360)) * sin(angles[0]*(3.14159265358979323846*2 / 360)));
- forward[2] = -si;
- }
- typedef enum : int
- {
- FREE, TEXT, VALUE, UNKNOWN, MATERIAL, TENTHS_TIMER_DOWN = 9, TENTH_TIMER_UP, CLOCK_DOWN, CLOCK_UP, WAYPOINT
- }he_type_t;
- typedef struct
- {
- unsigned char red, green, blue, alpha
- }hudelem_color_t;
- typedef struct game_hudelem_s
- {
- hudelem_s elem; //0x00 - 0xA8
- int clientIndex; //0xA8 - 0xAC
- int teamNum; //0xAC - 0xB0
- int unknown; //0xB0 - 0xB4
- int archived; //0xB4 - 0xB8
- };
- typedef enum : int
- {
- X, Y, Z,
- ORG = 0, SCRN = 1
- };
- typedef struct hudelem_s
- {
- he_type_t type; //0x00 - 0x04
- float origin[3]; //0x04 - 0x10
- int entityIndex; //0x10 - 0x14
- float fontScale; //0x14 - 0x18
- float fromFontScale; //0x18 - 0x1C
- int fontScaleStartTime; //0x1C - 0x20
- int fontScaleTime; //0x20 - 0x24
- int font; //0x24 - 0x28
- /* Everything else after font is just +0x10 from the cod4 structure */
- int align[2]; //0x28 - 0x30
- hudelem_color_t color; //0x30 - 0x34
- hudelem_color_t fromColour; //0x34 - 0x38
- int fadeStartTime; //0x38 - 0x3C
- int fadeTime; //0x3C - 0x40
- int label; //0x40 - 0x44
- int width; //0x44 - 0x48
- int height; //0x48 - 0x4C
- int materialIndex; //0x4C - 0x50
- int fromWidth; //0x50 - 0x54
- int fromHeight; //0x54 - 0x58
- int scaleStartTime; //0x58 - 0x5C
- int scaleTime; //0x5C - 0x60
- float fromVec2[2]; //0x60 - 0x68
- int fromAlign[2]; //0x68 - 0x70
- int moveStartTime; //0x70 - 0x74
- int moveTime; //0x74 - 0x78
- int time; //0x78 - 0x7C
- int duration; //0x7C - 0x80
- float value; //0x80 - 0x84
- int text; //0x84 - 0x88
- float sort; //0x88 - 0x8C
- hudelem_color_t glowColour; //0x8C - 0x90
- int fxBirthTime; //0x90 - 0x94
- int fxLetterTime; //0x94 - 0x98
- int fxDecayStartTime; //0x98 - 0x9C
- int fxDecayDuration; //0x9C - 0xA0
- int soundIndex; //0xA0 - 0xA4
- int flag; //0xA4 - 0xA8
- };
- //Working Status: Untested
- int (*G_MaterialIndex)(char*materialName) = (int(__cdecl*)(char*))0x8215C4C0;
- void HECmd_SetClock(game_hudelem_s*elem, float time, float fullTime, char*material, int width, int height, bool up=false)
- {
- elem->elem.type = (!up ? CLOCK_DOWN : CLOCK_UP);
- elem->elem.time = (int)ceil(time * 1000);
- elem->elem.duration = (int)ceil(fullTime * 1000);
- elem->elem.materialIndex = G_MaterialIndex(materialName);
- elem->elem.width = width;
- elem->elem.height = height;
- }
- //Working Status: Untested
- void HECmd_FadeOverTime(game_hudelem_s*elem, float time)
- {
- elem->elem.fromColor = elem->elem.color;
- elem->elem.fadeStartTime = G_GetTime();
- elem->elem.fadeTime = (int)floor((time * 1000) + 0.5);
- }
- //Working Status: Untested
- void HECmd_ChangeFontScale(game_hudelem_s*elem, float time)
- {
- elem->elem.fromFontScale = elem->elem.fontScale;
- elem->elem.fontScaleStartTime = G_GetTime();
- elem->elem.fontScaleTime = (int)floor((time * 1000) + 0.5);
- }
- //Working Status: Untested
- void HECmd_ScaleOverTime(game_hudelem_s*elem, float time, int width, int height)
- {
- elem->elem.width = width;
- elem->elem.height = height;
- elem->elem.scaleStartTime = G_GetTime();
- elem->elem.scaleTime = (int)floor((time * 1000) + 0.5);
- elem->elem.fromHeight = elem->elem.height;
- elem->elem.fromWidth = elem->elem.width;
- }
- //Working Status: Untested
- void HECmd_MoveOverTime(game_hudelem_s*elem, float time)
- {
- elem->elem.moveStartTime = G_GetTime();
- elem->elem.moveTime = (int)floor((time * 1000) + 0.5);
- elem->elem.fromVec2[X] = elem->elem.origin[X];
- elem->elem.fromVec2[Y] = elem->elem.origin[Y];
- elem->elem.fromAlign[ORG] = elem->elem.align[ORG];
- elem->elem.fromAlign[SCRN] = elem->elem.align[SCRN];
- }
- //Working Status: Untested
- void HECmd_SetWaypoint(game_hudelem_s*elem, float lol, float*origin, int entity)
- {
- elem->elem.type = WAYPOINT;
- elem->elem.value = lol;
- for(int i = X; i <= Z; i++)
- elem->elem.origin[i] = origin[i];
- elem->elem.entityIndex = *(int*)(entity);
- }
- //Working Status: Tested & Working
- int gClient(int clientIndex)
- {
- return *(int*)(getEntity(clientIndex) + 0x158);
- }
- //Working Status: Untested but will work
- bool isConnected(int clientIndex)
- {
- return (*(int*)(gClient(clientIndex) + 0x2F9C) & 2);//0x2F9C = int connected; //0x02 = connected, 0x01 = connecting & 0x00 = disconnected
- }
- //Working status: Untested but should work
- int (*G_SpawnPlayerClone)() = (int(__cdecl*)())0x8242CD98;
- void (*G_SetOrigin)(int ent, float*newOrigin) = (void(__cdecl*)(int,float*))0x8242C8D0;
- void (*G_SetAngles)(int ent, float*newAngles) = (void(__cdecl*)(int,float*))0x8242C928;
- int (*Com_GetServerDObj)(int handle) = (int(__cdecl*)(int))0x8246EF98;
- int (*DObjGetTree)(int obj) = (int(__cdecl*)(int))0x82572D00;
- int (*G_GetFreePlayerCorpseIndex)() = (int(__cdecl*)())0x823FEC98;
- void (*XAnimCloneAnimTree)(int from, int to) = (void(__cdecl*)(int,int))0x825781F0;
- int (*_8246EFD8)(int ent) = (int(__cdecl*)(int))0x8246EFD8;
- void (*_82220670)(int r3, int r4, int ent, int startUp, int r7) = (void(__cdecl*)(int,int,int,int,int))0x82220670;
- void (*_824319C8)(int ent, int ent2) = (void(__cdecl*)(int,int))0x824319C8;
- void (*_8242AA08)(int ent, int r4) = (void(__cdecl*)(int,int))0x8242AA08;
- void (*_823E4580)(int ent) = (void(__cdecl*)(int))0x823E4580;
- int ClonePlayer(int clientIndex, int deathAnimDur)
- {
- int clone = G_SpawnPlayerClone();
- *(int*)(clone + 0x90) = *(int*)(gClient(clientIndex) + 0x17C); //Spoofing the clientIndex to your own, but to your clone
- int math = (*(int*)(gClient(clientIndex) + 0x124) & ~0x200000000 | *(int*)(clone + 0x8) & 0x200000000)
- math &= 0x10000000;
- math = ((math << 16) | 0x14);
- *(int*)(clone + 0x08) = math;//Spoofing eFlags, from yours to the clones
- float*myOrigin[3] = { *(float*)(gClient(clientIndex) + 0x1C), *(float*)(gClient(clientIndex) + 0x20), *(float*)(gClient(clientIndex) + 0x24) }
- float*myAngles[3] = { *(float*)(getEntity(clientIndex) + 0x144), *(float*)(getEntity(clientIndex) + 0x148), *(float*)(getEntity(clientIndex) + 0x14C) };
- G_SetOrigin(clone, myOrigin); //So he spawns right on your origin
- G_SetAngles(clone, myAngles); //Spawn's looking in out direction
- *(int*)(clone + 0xC) = 5; //Setting gravity
- *(int*)(clone + 0x10) = G_GetTime(); //Setting the time to the current time, this is for the gravity effect.
- float*myDelta[3] = {*(float*)(gClient(clientIndex) + 0x28), *(float*)(gClient(clientIndex) + 0x2C), *(float*)(gClient(clientIndex) + 0x30) };
- *(float*)(clone + 0x24) = myDelta[0];
- *(float*)(clone + 0x28) = myDelta[1];
- *(float*)(clone + 0x2C) = myDelta[2];//Spoofing our delta origin to the clone's
- *(int*)(clone + 0x04) = 2; //Setting the clone's eType
- *(unsigned char*)(clone + 0x172) = 01; //physics object
- int tree = DObjGetTree(Com_GetServerDobj(*(int*)(gClient(clientIndex) + 0x17C)));
- if(*(float*)(clone + 0x24) <= *(float*)(0x832ACE24 + 0xC))
- {
- if(*(float*)(clone + 0x28) <= *(float*)(0x832ACE24 + 0xC))
- {
- *(int*)(clone + 0x1B0) = G_GetTime();
- int point = 0x834CEAD0 + 0x10F8 + (G_GetFreePlayerCorpse() * 0x5AC);
- *(int*)(point + 0x8) = G_GetTime();
- *(unsigned char*)(point + 0x5A9) = 00;
- *(int*)(point + 0x04) = *(int*)(clone);
- *(unsigned char*)(point + 0x5A8) = 01;
- int test = *(int*)(0x83327A80 + 0x4); test <<= 16; test += 0x1138;
- memcpy((void*)(point + 0xC), (void*)test, 0x59C);
- *(int*)(point + 0x394) = *(int*)(point);
- *(int*)(gClient(clientIndex) + 0xB8) = G_GetFreePlayerCorpse();
- XAnimCloneAnimTree(*(int*)(point), tree);
- *(int*)(clone + 0x80) = 0x7FF;
- *(int*)(clone + 0x88) = *(int*)(getEntity(clientIndex) + 0x88); //Not to sure exactly, but it's copying your data
- *(unsigned char*)(clone + 0x102) = 02; //setting svFlags
- for(int i = 6; i != 0; i--)
- *(int*)(clone + 0x100) = *(int*)(getEntity(clientIndex + 0x100);
- *(int*)(clone + 0x11C) = *(int*)(getEntity(clientIndex + 0x11C);
- *(int*)(clone + 0x194) = 0x10001;
- *(int*)(clone + 0x1C) = 0x4008000;
- SV_LinkEntity(clone);
- int lel = _8246D8A8(clone);
- *(unsigned char*)(clone + 0x175) = 0xD; //handler
- *(int*)(clone + 0x1A4) = (G_GetTime() + deathAnimDur);//nextThink
- _8221F870(-1, lel, clone, *(int*)(point + 0xC), 0);
- _824307D8(getEntity(clientIndex), clone);
- _82429818(*(int*)(getEntity(clientIndex) + 0xE0), clone);
- if(*(int*)(gClient(clientIndex) + 0x44) > *(int*)(gClient(clientIndex) + 0x34) || *(int*)(gClient(clientIndex) + 0x44) != *(int*)(gClient(clientIndex) + 0x7FE))
- {
- _823E3568(clone);
- }
- return clone;
- }
- else *(float*)(clone + 0x28) = *(float*)(0x832ACE24 + 0xC); return 0;
- }
- else *(float*)(clone + 0x24) = *(float*)(0x832ACE24 + 0xC);return 0;
- return -1;
- }
- void PlayFxOnTag(int effectId, char*tagName, int entity)
- {
- float origin[3];
- getTagOrigin(*(int*)(entity), tagName, &origin);
- doEffect(effectId, &origin);
- }
- int PlayLoopedFX(int effectId, float repeat_delay, float*source)
- {
- int entity = G_Spawn(); float*angle[3];
- *(int*)(entity + 0x04) = 0x09;
- *(int*)(entity + 0xD4) = effectId;
- setOrigin(entity, source);
- memcpy((void*)angle, (void*)(entity + 0x3C), 0xC);
- setFXAngles(2, 0, angle);
- *(float*)(entity + 0x54) = 0;
- *(int*)(entity + 0x58) = (int)floor(repeat_delay);
- SV_LinkEntity(entity);
- return entity;
- }
- bool isDead(int clientIndex)
- {
- return (bool)(*(int*)(gClient(clientIndex) + 0x3704) & 1);
- }
- /*
- //Random as fuck
- bool state[0xC][0x3] = {false};
- DWORD WINAPI Monitoring(int clientIndex)
- {
- for(;;)
- {
- state[clientIndex][0] = (*(int*)(gClient(clientIndex) + 0x3704) != 0 ? true : false); //onSpawn
- state[clientIndex][1] = (*(int*)(gClient(clientIndex) + 0x3704) & 1 ? true : false); //onDeath
- state[clientIndex][2] = (*(int*)(gClient(clientIndex) + 0x3704) & 2 ? true : false); //onSpecting
- }
- }
- */
- void rotatePitch(int clientIndex, float pitch)
- {
- float*angles[3] = { *(float*)(getEntity(clientIndex) + 0x144), pitch, *(float*)(getEntity(clientIndex) + 0x14C) };
- setClientViewAngles(angles);
- }
- void rotateYaw(int clientIndex, float yaw)
- {
- float*angles[3] = { yaw, *(float*)(getEntity(clientIndex) + 0x148), *(float*)(getEntity(clientIndex) + 0x14C) };
- setClientViewAngles(angles);
- }
- void rotateRoll(int clientIndex, float roll)
- {
- float*angles[3] = { *(float*)(getEntity(clientIndex) + 0x144), *(float*)(getEntity(clientIndex) + 0x148), roll };
- setClientViewAngles(angles);
- }
- bool teamBased()
- {
- return (*(int*)(gClient(irand(0, 0xC)) + 0x3060) == 0);
- }
- bool onSameTeam(int client1, int client2)
- {
- return (!memcmp((void*)(*(int*)(gClient(client1) + 0x3060)), (void*)(*(int*)(gClient(client2) + 0x3060)), 0x1));
- }
- void* BirthThread(int threadIndex, PTHREAD_START_ROUTINE start, __in_opt void*param)
- {
- HANDLE thread = CreateThread(0, 0, (PTHREAD_START_ROUTINE)start, (void*)param, 2, &threadIndex);
- SetThreadPriority(thread, -15);
- ResumeThread(thread);
- }
- void* KillThread(HANDLE thread = GetCurrentThread())
- {
- TerminateThread(thread, 0);
- CloseHandle(thread);
- }
- DWORD WINAPI endon(int clientIndex, char*cmd, HANDLE thread, bool tof)
- {
- for(;;)
- {
- Sleep(10);
- if(!strcmp(cmd,"death"))
- {
- if(isDead(clientIndex))
- KillThread(thread);
- tof = (isDead(clienIndex) ? true : false);
- }
- else if(!strcmp(cmd,"disconnect"))
- {
- if(!isConnected(clientIndex))
- KillThread(thread);
- tof = (!isConnected(clienIndex) ? true : false);
- }
- }
- }
- #define ENDON_DEATH 0
- #define ENDON_DISCONNECT 1
- DWORD WINAPI autoAim(int self)
- {
- int aimAt; float*dasResult[3]; bool isTrue[0xC][2] = {false};
- SV_GameSendServerCommand(self, 1, "e \"Aim Bot ^2On\"");
- for(;;)
- {
- Sleep(10);
- BirthThread(NULL, endon, self, "death", GetCurrentThread(), isTrue[self][ENDON_DEATH]);
- BirthThread(NULL, endon, self, "disconnect", GetCurrentThread(), isTrue[self][ENDON_DISCONNECT]);
- if(isTrue[self][ENDON_DEATH] || isTrue[self][ENDON_DISCONNECT]) SV_GameSendServerCommand(self, 1, "e \"Aim Bot ^1Off\"");
- for(int player = 0; player < 0xC; player++)
- {
- float*myOrigin[3] = { *(float*)(gClient(self) + 0x1C), *(float*)(gClient(self) + 0x20), *(float*)(gClient(self) + 0x24) }, *thereOrigin[3] = { *(float*)(gClient(player) + 0x1C), *(float*)(gClient(player) + 0x20), *(float*)(gClient(player) + 0x24) }, *aimAtOrigin[3] = { *(float*)(gClient(aimAt) + 0x1C), *(float*)(gClient(aimAt) + 0x20), *(float*)(gClient(aimAt) + 0x24) };
- if(!memcmp((void*)player, (void*)self, 0x4) || teamBased() && onSameTeam(self, player) || *(int*)(gentity(player) + 0x1A4) <= 0 || !bulletTracePassed(myOrigin, thereOrigin, false, getEntity(self))) continue;
- if(closer(myOrigin, thereOrigin, aimAtOrigin))
- {
- for(int i = 0; i < 3; i++)
- data().Origin2Angles((thereOrigin[i] - myOrigin[i]), dasResult);
- setClientViewAngles(getEntity(self), dasResult);
- }
- }
- }
- }
- void (*G_TraceCapsule)(trace_t *results, float *start, float *end, float*mins, int passEntNum, int mask, float*max ) = (void(__cdecl*)(trace_t*,float*,float*,float*,int,int,float*))0x823F1CA8; //Moved around ever since cod4's function
- void PhysicsTrace(float*v1,float*v2,float*out)
- {
- trace_t trace;
- G_TraceCapsule(trace, v1, v2, *(float*)0x8204B850, 0x7FF, 0x820015, *(float*)0x8204B850);
- float*result[3] = { v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2] };
- for(int i = 0; i < 3; i++)
- {
- *out[i] = (result[i] * trace.fraction) + v1[i];
- }
- }
- typedef enum : int
- {
- RB = 0x4000,
- LB = 0x8000,
- UNKNOWN = 0x800, //POSSIBLY LT
- UNKNOWN_2 = 0x400 //POSSIBLY RT
- }buttonEnum;
- bool buttonPressed(int clientIndex, buttonEnum buttonId)//if(buttonPressed(0, buttonEnum::FRAG))
- {
- return (*(int*)(gClient(clientIndex) + 0x3330) & buttonId);
- }
- DWORD WINAPI QuickScope(int clientIndex)
- {
- bool True[0xC][2] = {false};
- BirthThread(NULL, endon, clientIndex, "death", GetCurrentThread(), True[clientIndex][ENDON_DEATH]);
- BirthThread(NULL, endon, clientIndex, "disconnect", GetCurrentThread(), True[clientIndex][ENDON_DISCONNECT]);
- if(True[clientIndex][ENDON_DISCONNECT] || True[clientIndex][ENDON_DEATH])
- SV_GSSC(clientIndex, 1, "f \"Quick Scope ^1Off\"");
- KillThread();
- while(true)
- {
- if(buttonPressed(clientIndex,buttonEnum::UNKNOWN))
- {
- Sleep(300);
- *(int*)(gClient(clientIndex) + 0x420) &= ~0x20;
- *(int*)(gClient(clientIndex) + 0x420) |= 0x20;
- *(int*)(gClient(clientIndex) + 0x420) &= ~0x20;
- *(int*)(gClient(clientIndex) + 0x420) |= 0x20;
- Sleep(0.5);
- }
- }
- }
- bool ufo[0xC] = {false};
- void doUfo(int clientIndex, buttonEnum bind)
- {
- setSpectatePermissions(clientIndex);
- for(;;)
- {
- Sleep(10);
- if(buttonPressed(clientIndex, bind))
- {
- ufo[clientIndex] ^= true;
- allowSpectateTeam(clientIndex, "freelook", ufo[clientIndex]));
- *(int*)(gClient(clientIndex) + 0x3704) = (ufo[clientIndex] ? 2 : 0);
- *(int*)(getEntity(clientIndex) + 0x11C) = (ufo[clientIndex] ? 0 : 100);
- }
- }
- }
- void allowSpectateTeam(int clientIndex, char*team, bool value)
- {
- int id;
- if(!strcmp(team,"axis")) id = 0x02;
- else if(!strcmp(team,"allies")) id = 0x04;
- else if(!strcmp(team,"none")) id = 0x01;
- else if(!strcmp(team,"freelook")) id = 0x10;
- else printf("team must be \"axis\", \"allies\", \"none\", or \"freelook\"\n");
- *(int*)(gClient(clientIndex) + 0x3058) = (value ? *(int*)(gClient(clientIndex) + 0x3058) & ~id : *(int*)(gClient(clientIndex) + 0x3058) | id);
- }
- char* getOtherTeam(int clientIndex)
- {
- if(*(int*)(gClient(clientIndex) + 0x3060) & 1) return "allies";
- if(*(int*)(gClient(clientIndex) + 0x3060) & 2) return "axis";
- else return "none";
- }
- char*G_GetTeamForClient(int clientIndex)
- {
- if(*(int*)(gClient(clientIndex) + 0x3060) & 1) return "axis";
- if(*(int*)(gClient(clientIndex) + 0x3060) & 2) return "allies";
- if(*(int*)(gClient(clientIndex) + 0x3060) & 3) return "spectator";
- else return "none";
- }
- void setSpectatePermissions(int clientIndex)
- {
- char*team = G_GetTeamForClient(clientIndex);
- if(!teamBased())
- {
- allowSpectateTeam(clientIndex, "allies", false);
- allowSpectateTeam(clientIndex, "axis", false);
- allowSpectateTeam(clientIndex, "freelook", false);
- allowSpectateTeam(clientIndex, "none", false);
- }
- else if(!strcmp(team,"allies") || !strcmp(team,"axis"))
- {
- allowSpectateTeam(clientIndex,getOtherTeam(clientIndex),true);
- allowSpectateTeam(clientIndex,team,false);
- allowSpectateTeam(clientIndex, "freelook",false);
- allowSpectateTeam(clientIndex, "none",false);
- }
- else if(!strcmp(team,"spectator"))
- {
- allowSpectateTeam(clientIndex, "allies",true);
- allowSpectateTeam(clientIndex, "axis",true);
- allowSpectateTeam(clientIndex, "freelook",true);
- allowSpectateTeam(clientIndex, "none",true);
- }
- else
- {
- allowSpectateTeam(clientIndex, "allies",false);
- allowSpectateTeam(clientIndex, "axis",false);
- allowSpectateTeam(clientIndex, "freelook",false);
- allowSpectateTeam(clientIndex, "none",false);
- }
- }
- bool isTalking(int clientIndex)
- {
- if((*(int*)(gClient(clientIndex) + 0x3400) - G_GetTime()) < 0) return false;
- if((*(int*)(gClient(clientIndex) + 0x3400) - G_GetTime()) < *(int*)(0x832AE69C + 0xC)) return true;
- }
- void lastStand(int clientIndex, bool enabled)
- {
- *(int*)(gClient(clientIndex) + 0x36A0) = (int)enabled;
- *(int*)(gClient(clientIndex) + 0x36A4) = (enabled ? G_GetTime() : 0);
- }
- int (*G_EntLinkToWithOffset)(int ent, int parent, unsigned int tagName, float *originOffset, float *anglesOffset) = (int(__cdecl*)(int,int,unsigned int, float*,float*))0x82430798;
- int (*G_EntLinkTo)(int ent, int parent, unsigned int tagName) (int(__cdecl*)(int,int,unsigned int))0x82431AD0;
- void LinkTo(int entity, int parent, float*originOffset=0, float*anglesOffset=0)//Only reversed this because I'm going to be re-creating the GSC noclip later on today :P
- {
- if(*(int*)(entity + 0x18C) != 0x20)
- {
- if(G_EntLinkToWithOffset(entity, parent, 0, originOffset, anglesOffset))
- {
- G_EntLinkTo(end, parent, 0);
- *(unsigned char*)(*(int*)(entity + 0x218) + 0xA) = 01;
- }
- }
- }
- DWORD WINAPI Noclip(int clientIndex)
- {
- float*myOrigin[3] = { *(float*)(gClient(clientIndex) + 0x1C), *(float*)(gClient(clientIndex) + 0x20), *(float*)(gClient(clientIndex) + 0x24) };
- float*vec[3], *end[3], *angles[3];
- int newufo = spawn("script_origin", myOrigin);
- for(;;)
- {
- *myOrigin[0] = *(float*)(gClient(clientIndex) + 0x1C); *myOrigin[1] = *(float*)(gClient(clientIndex) + 0x20); *myOrigin[2] = *(float*)(gClient(clientIndex) + 0x24);
- if(*(int*)(gClient(clientIndex) + 0x420) != 0x1000) *(int*)(gClient(clientIndex) + 0x420) &= ~0x1000;//Disable offhand use
- *(float*)(newufo + 0x138) = *myOrigin[0];
- *(float*)(newufo + 0x13C) = *myOrigin[1];
- *(float*)(newufo + 0x140) = *myOrigin[2];
- LinkTo(getEntity(clientIndex), newufo);
- for(int i = 0; i < 3; i++){ for(int f = 0x144; f <= 0x14C; f += 4){ *angles[i] = *(float*)(getEntity(clientIndex) + f); } }
- Scr_AnglesToForward(angles, vec);
- if(buttonPressed(clientIndex, RB))
- {
- for(int i = 0; i < 3; i++) *end[i] = (vec[i]*200);
- *(float*)(newufo + 0x138) += end[0];
- *(float*)(newufo + 0x13C) += end[1];
- *(float*)(newufo + 0x140) += end[2];
- }
- else if(buttonPressed(clientIndex, LB))
- {
- for(int i = 0; i < 3; i++) *end[i] = (vec[i]*20);
- *(float*)(newufo + 0x138) += end[0];
- *(float*)(newufo + 0x13C) += end[1];
- *(float*)(newufo + 0x140) += end[2];
- }
- }
- Sleep((DWORD)floor(0.05 * 1000) + 0.5);
- }
Add Comment
Please, Sign In to add comment