IMKYZABITCHES

Random Shit Reversed (Ghosts TU13) - Bitwise - Updated 17/05

Apr 27th, 2014
13,960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 35.36 KB | None | 0 0
  1. #include "data.h"
  2. Data data();
  3. //https://www.mediafire.com/folder/645ajcr0ntq4t/Modding
  4. //Working Status: UnTested
  5. //Note: Maybe Ethernet/Ethernet/Ambition sG is a fgt, a lying skid fgt.
  6. //Note2: Not every little thing on this pastebin is reversed, afew things I wiped up myself
  7. unsigned __int64 getXuidPopup()
  8. {
  9.     *(__int64*)(0x83C9B258 + 0x90428) = *(__int64*)(0x83C9B258 + 0x90430);
  10.     return *(unsigned __int64*)(0x83C9B258 + 0x90428);
  11. }
  12.  
  13. //Working Status: Tested & Working
  14. void (*SV_LinkEntity)(int entity) = (void(__cdecl*)(int))0x824ECDF8;
  15. typedef enum : short
  16. {
  17.     script_brushmodel = (0x834DA900 + 0xA2),
  18.     script_model = (0x834DA900 + 0xA6),
  19.     script_origin = (0x834DA900 + 0xA8),
  20.     light = (0x834DA900 + 0x76)
  21. }random;
  22. void Solid(int entity)
  23. {
  24.     short classId = *(short*)(entity + 0x17A);
  25.     if(classId & *(short*)script_brushmodel || classId & *(short*)script_model || classId & *(short*)script_origin || classId & *(short*)light)
  26.     {
  27.         if(classId != *(short*)script_origin)
  28.         {
  29.             if(classId & *(short*)script_model)
  30.             {
  31.                 *(int*)(entity + 0x11C) = 0x2080;
  32.                 SV_LinkEntity(entity);
  33.             }
  34.             else
  35.             {
  36.                 *(int*)(entity + 0x11C) = 1;
  37.                 *(int*)(entity + 0x08) &= ~1;
  38.                 SV_LinkEntity(entity);
  39.             }
  40.         }
  41.         else
  42.         {
  43.             printf("script_origin cannot be made solid (eIndex %i)\n", *(int*)entity);
  44.         }
  45.     }
  46.    
  47. }
  48. //Working Status: Tested & Working
  49. int getBrushModel()
  50. {
  51.     int id;
  52.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_prisionbreak"))
  53.         id = 0x38;
  54.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_dart"))
  55.         id = 0x6B;
  56.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_lonestar"))
  57.         id = 0x6A;
  58.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_frag"))
  59.         id = 0x55;
  60.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_snow"))
  61.         id = 0x56;
  62.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_fahrenheit"))
  63.         id = 0xA8;
  64.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_hasima"))
  65.         id = 0x63;
  66.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_warhawk"))
  67.         id = 0x45;
  68.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_soverign"))
  69.         id = 0x72;
  70.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_zebra"))
  71.         id = 0x44;
  72.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_skeleton"))
  73.         id = 0x3A;
  74.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_chasm"))
  75.         id = 0x49;
  76.     if(!strcmp(Dvar_GetString("ui_mapname"),"mp_flooded") || !strcmp(Dvar_GetString("ui_mapname"),"mp_strikezone"))
  77.         id = 0x57;
  78.     return 0x83379A80 + (id * 0x280);
  79. }
  80.  
  81. //Working Status: Tested & Working
  82. void (*SV_UnlinkEntity)(int entity) = (void(__cdecl*)(int))0x824ECA90;
  83. bool (*SV_SetBrushModel(int entity) = (bool(__cdecl*)(int))0x824D5CD0;
  84. void CloneScriptModelToBrushModel(int entity)
  85. {
  86.     short classId = *(short*)(entity + 0x17A);
  87.     int brushModel = getBrushModel();
  88.     if(classId & *(short*)script_brushmodel || classId & *(short*)script_model || classId & *(short*)script_origin || classId & *(short*)light)
  89.     {
  90.         if(classId & *(short*)script_model && *(int*)(brushModel + 0x8C) != 0)
  91.         {
  92.             SV_UnlinkEntity(entity);
  93.             *(int*)(entity + 0x8C) = *(int*)(brushModel + 0x8C); //Variable labeled "brushmodel" being spoofed to the correct value
  94.             *(unsigned char*)(entity + 0x101) = 0x04; //Possibly
  95.             SV_SetBrushModel(entity);
  96.             *(int*)(entity + 0x11C) |= *(int*)(brushModel + 0x11C);
  97.             SV_LinkEntity(entity);
  98.         }
  99.         else
  100.         {
  101.             printf("Entity must be script_model to be-able to clone to script_brushmodel (eIndex %i)\n", *(int*)(entity));
  102.         }
  103.     }
  104. }
  105.  
  106. //Working Status: Untested
  107. void (*Scr_FreeHudElem)(game_hudelem_s*elem) = (void(__cdecl*)(game_hudelem_s*))0x82425648;
  108. void Delete(game_hudelem_s*elem)
  109. {
  110.     Scr_FreeHudElem(elem);
  111.     elem->elem.type = 0;
  112. }
  113.  
  114.  
  115. //Working Status: Working
  116. float Vec3DistanceSq(float*p1,float*p2)
  117. {
  118.     float*dest[3];
  119.     for(int i = 0; i < 3; i++) dest[i] = (p1[i]-p2[i]);
  120.     return (dest[0]*dest[0] + dest[1]*dest[1] + dest[2]*dest[2]);
  121. }
  122.  
  123. //Working Status: Working
  124. bool Closer(float*start, float*v1,float*v2)
  125. {
  126.     float f1 = Vec3DistranceSq(start, v1), f2 = Vec3DistanceSq(start, v2);
  127.     return (f1 < f2);
  128. }
  129.  
  130. //Working Status: Untested
  131. void doSomeShit(int clientIndex, int r4, float*f3)//Found this lastnight, no idea what the fuck it is or does
  132. {
  133.     int nextThink = *(int*)(getEntity(clientIndex) + 0x1AC);
  134.     nextThink *= r4;
  135.     *(int*)(getPlayerState(clientIndex) + 0x33D4) = ((nextThink + 0x32) / 0x64);
  136.     if(*(int*)(getPlayerState(clientIndex) + 0x33D4) >= 0)
  137.     {
  138.         float*myOrigin[3] = { *(float*)(getPlayerState(clientIndex) + 0x1C), *(float*)(getPlayerState(clientIndex) + 0x20), *(float*)(getPlayerState(clientIndex) + 0x24) };
  139.         *(float*)(getPlayerState(clientIndex) + 0x33DC) = (f3[2] - myOrigin[0]);
  140.         *(float*)(getPlayerState(clientIndex) + 0x33E0) = (f3[1] - myOrigin[1]);
  141.         *(float*)(getPlayerState(clientIndex) + 0x33E4) = (f3[0] - myOrigin[2]);
  142.     }
  143. }
  144.  
  145. //Working Status: Untested, stil need confirmation on 8/10 GSC functions inside
  146. bool enabled[0xC] = {true};
  147. void shootEffect(int clientIndex, char*effectName="explosions/grenadeExp_water")//v0.0.1 - Bitwise
  148. {
  149.  while(enabled[clientIndex])
  150.  {
  151.  for(;;){
  152.   desination dest;
  153.   float*vec[3], *end[3], eye[3];
  154.   Mod client(clientIndex, true); //Mod class, my media fire has it all
  155.   if(Buttons(clientIndex) & BUTTON_RT)
  156.    client.Recoil();
  157.    Scr_AnglesToForward(*client.bit.angle, vec);
  158.    for(int i = 0; i <= 2; i++)
  159.     *end[i] = (vec[i]*20000);
  160.    getTagOrigin(clientIndex, "tag_eye", eye);
  161.    bulletTrace(eye, eye+end, true, getEntity(clientIndex));
  162.    doEffect(effectName, *dest.Vector3);
  163.    doEarthquake(0.3, 1, *dest.Vector3,1000);
  164.   }
  165.  }
  166. }
  167.  
  168. typedef struct trace_t
  169. {
  170.     float fraction;//0
  171.     float normal[3];//4
  172.     char padding[8];//0x10
  173.     TraceHitType hitType;//0x18
  174.     unsigned short hitId;//0x1C
  175.     char _padding[0xC];
  176. };
  177.  
  178. enum TraceHitType
  179. {
  180.   None,
  181.   entity,
  182.   dynet_model,
  183.   dynet_brush,
  184.   UNKNOWN
  185. };
  186.  
  187. //Working Status: Tested & Working
  188. unsigned short Trace_GetEntityHitId(trace_t*lel)
  189. {
  190.     if(lel->hitType & dynet_model || lel->hitType & dynet_brush || lel->hitType & UNKNOWN) return 0x7FE;
  191.     if(lel->hitType & entity) return 0x7FF;
  192.     else return lel->hitId;
  193. }
  194. struct destination
  195. {
  196.     char*name;
  197.     unsigned int clientIndex;
  198.     short Int16, *Int16_3[3];
  199.     int Int32, *Int32_3[3];
  200.     __int64 Int64, *Int64_3[3];
  201.     float Float, *Vector3[3];
  202.     unsigned char Byte, *Byte_3[3];
  203. };
  204.  
  205. //Working Status: Untested
  206.  
  207.  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;
  208. char* (*Com_SurfaceTypeToName)(int index) = (char*(__cdecl*)(int))0x8256F7D0;
  209. void bulletTrace(float*start, float*end, bool hitCharacters, int entity)
  210. {
  211.     destination dest;
  212.     trace_t targ;
  213.     G_LocationalTrace(&targ, start, end, *(int*)entity, (hitCharacters ? 0x280E831 : 0x80A831), 1));
  214.     for(int i = 0; i <= 2; i++)
  215.         *dest.Vector3[i] = ((end[i]-start[i]) * targ.fraction) + start[i];
  216.     unsigned short entity = (Trace_GetEntityHitId(&targ) & 0xFFFF);
  217.     if(entity < 0x7FE) dest.clientIndex = (int)entity;
  218.     if(dest.fraction != 1.0) int index = (int)dest.normal[2]; int result; __asm { srawi       result, index, 0x14 }; dest.name = Com_SurfaceTypeToName(result & 0x1F);
  219. }
  220.  
  221. //Working Status: Tested & Working
  222. int (*G_LocationalTracePassed)(float *start, float *end, int passEntityNum, int passEntityNum1, int contentmask, char *priorityMap) = (int(__cdecl*)(float*,float*,int,int,int,char*))0x823F1F70;
  223. bool bulletTracePassed(float*start, float*end, bool hitCharacters, int entity)
  224. {
  225.     return G_LocationalTracePassed(start,end,*(int*)(entity),0x7FF,(hitCharacters ? 0x280E831 : 0x80A831), 0);
  226. }
  227.  
  228. short getClassIndex(char*className)
  229. {
  230.     if(!strcmp(classname,"script_model"))
  231.         return *(short*)script_model;
  232.     if(!strcmp(classname,"script_brushmodel"))
  233.         return *(short*)script_brushmodel;
  234.     if(!strcmp(classname,"script_origin"))
  235.         return *(short*)script_origin;
  236.     else
  237.         return -1;
  238. }
  239.  
  240. //Working Status: Untested but should work
  241. int (*G_Spawn)() = (int(__cdecl*)())0x8242AE50;
  242. int (*G_CallSpawnEntity)(int ent) = (int(__cdecl*)(int))0x82426578;
  243. void (*G_FreeEntity)(int ent) = (int(__cdecl*)(int))0x8242C620;
  244. int spawn(char*className, float*source, int flag=-1)
  245. {
  246.     int entity = G_Spawn();
  247.     *(short*)(entity + 0x17A) = getClassIndex(className);
  248.     *(float*)(entity + 0x138) = source[0];
  249.     *(float*)(entity + 0x13C) = source[1];
  250.     *(float*)(entity + 0x140) = source[2];
  251.     *(int*)(entity + 0x188) = (flag == -1 ? 0 : flag);
  252.     if(!G_CallSpawnEntity(entity)) G_FreeEntity(entity);
  253.     else { *(int*)(entity + 0x11C) = 0x00; }
  254.     return entity;
  255. }
  256.  
  257. //Working Status: Tested & Working
  258. int (*G_ModelIndex)(char*modelName) = (int(__cdecl*)(char*))0x8215C6A0;
  259. void setModel(int entity, char*modelName)
  260. {
  261.     *(short*)(entity + 0x170) = G_ModelIndex(modelName);
  262. }
  263.  
  264. //Working Status: Tested & Working
  265. void SetMiniMap(char*materialName, float ULX, float ULY, float LRX, float LRY)
  266. {
  267.     void (*SV_SetConfigString)(int index, char*str) = (void(__cdecl*)(int,char*))0x824D82F0;
  268.     SV_SetConfigString(0x43B, data().va("\"%s\" %f %f %f %f", materialName, ULX, ULY, LRX, LRY)); //Using data handler for linking strings
  269. }
  270.  
  271. //Working Status: Tested & Working
  272. int (*SL_GetString)(char*str, int user) = (int(__cdecl*)(char*,int))0x8248FFE8;
  273. void Scr_GetLowercaseString(char*str, void*out)
  274. {
  275.     char* buffer = new char[strlen(str)];
  276.     for(int i = 0; i < 3; i++)
  277.         buffer[i] = (char)tolower(str[i]);
  278.     memcpy(out, (void*)SL_GetString(buffer, 0), 0x4);
  279.     delete[] buffer;
  280. }
  281.  
  282. //Working Status: Untested but should work
  283. int (*G_DObjGetWorldTagMatrix)(int ent, int tagName, float *tagMat) = (int(__cdecl*)(int,int,float*))0x8242C1A8;
  284. int (*SV_DObjExists)(int ent) = (int(__cdecl*)(int))0x824D6440;
  285. void getTagOrigin(int clientIndex, char*tagName, void*out)
  286. {
  287.     /*
  288.         1 : <clientIndex> The index of the client in-game to be effected (integer)
  289.         2:  <tagName> The name of the tag (string) e.g. "j_spine4"
  290.         3:  <out> The variable where the successfully found origin will be stored. (vector3)
  291.  
  292.         Example:
  293.             float origin[3];
  294.             getTagOrigin(0, "j_spine4", &angles);
  295.     */
  296.     int entity = getEntity(clientIndex), level = 0x83375128, tagIndex = 0, entityNum = 0;
  297.     float*tagMat[3];
  298.     Scr_GetLowercaseString(tagName, &tagIndex);
  299.     if(*(int*)(level + 0x2894) != *(int*)entity || *(int*)(level + 0x540) != *(int*)(level + 0x2890))
  300.         if(SV_DObjExists(ent))
  301.             memcpy((void*)tagMat, (void*)(level + 0x289C), 0xC);
  302.             if(!G_DObjGetWordTagMatrix(ent, tagIndex, tagMat))
  303.                 memcpy(out, (void*)(level + 0x28C0), 0xC);
  304.             else
  305.                 *(int*)(level + 0x2894) = *(int*)entity;
  306.                 *(int*)(level + 0x2890) = *(int*)(level + 0x540);
  307.         else
  308.             memcpy((out, (void*)(level + 0x28C0), 0xC);
  309.     else
  310.         memcpy(out, (void*)(level + 0x28C0), 0xC);
  311.     if(*(short*)(level + 0x2898) & (short)tagIndex)
  312.         memcpy(out, (void*)(level + 0x28C0), 0xC);
  313. }
  314.  
  315. //Working Status: Untested but should work
  316. void (*AxisToAngles)(float*axis, float*angles) = (void(__cdecl*)(float*,float*))0x8254F3C0;
  317. void getTagAngles(int clientIndex, char*tagName, void*out)
  318. {
  319.         /*
  320.         1 : <clientIndex> The index of the client in-game to be effected (integer)
  321.         2:  <tagName> The name of the tag (string) e.g. "j_head"
  322.         3:  <out> The variable where the successfully found angle's will be stored. (vector3)
  323.  
  324.         Example:
  325.             float angles[3];
  326.             getTagAngles(0, "j_head", &angles);
  327.     */
  328.     int entity = getEntity(clientIndex), level = 0x83375128, tagIndex = 0, entityNum = 0;
  329.     float*tagMat[3], *angles[3];
  330.     Scr_GetLowercaseString(tagName, &tagIndex);
  331.     if(*(int*)(level + 0x2894) != *(int*)entity || *(int*)(level + 0x540) != *(int*)(level + 0x2890))
  332.         if(SV_DObjExists(entity))
  333.             memcpy((void*)tagMat, (void*)(level + 0x289C), 0xC);
  334.             if(!G_DObjGetWorldTagMatrix(ent, tagIndex, tagMat)) AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
  335.             else
  336.                 *(int*)(level + 0x2894) = *(int*)entity;
  337.                 *(int*)(level + 0x2890) = *(int*)(level + 0x540);
  338.         else AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
  339.     else AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
  340.     if(*(short*)(level + 0x2898) & (short)tagIndex)
  341.         AxisToAngles(tagMat, angles); memcpy(out, (void*)angles, 0xC);
  342. }
  343.  
  344. //Working Status: Untested but should work
  345. void setDepthofField(int clientIndex, float nstart, float nend, float fstart, float fend, float nblur, float fblur)
  346. {
  347.     /*
  348.         1 : <clientIndex> The index of the client in-game to be effected
  349.             2 : <nstart> Before this distance, near depth of field is maximally blurry
  350.             3 : <nend> After this distance, near depth of field is perfectly in focus
  351.         4 : <fstart> Before this distance, far depth of field is perfectly in focus
  352.         5 : <fend> After this distance, far depth of field is maximally blurry
  353.         6 : <nblur> Maximal blur radius for near depth of field, in pixels at 640x480
  354.         7 : <fblur> Maximal blur radius for far depth of field, in pixels at 640x480
  355.  
  356.         Example: setDepthofField(0,10,80,1000,7000,5,1.5);
  357.  
  358.     */
  359.     if(nstart >= 0 && nend >= 0 && fstart >= 0 && fend >= 0 && nblur >= 4 && nblur <= 10 && fblur >= 0 && fblur <= nblur)
  360.     {
  361.         *(float*)(getPlayerState(clientIndex) + 0xAA8) = nstart;
  362.         *(float*)(getPlayerState(clientIndex) + 0xAAC) = nend;
  363.         *(float*)(getPlayerState(clientIndex) + 0xAB0) = fstart;
  364.         *(float*)(getPlayerState(clientIndex) + 0xAB4) = fend;
  365.         *(float*)(getPlayerState(clientIndex) + 0xAB8) = nblur;
  366.         *(float*)(getPlayerState(clientIndex) + 0xABC) = fblur;
  367.     }
  368. }
  369.  
  370.  
  371. //Working Status: Untested
  372. void someThing(int clientIndex, float f1, float f2)
  373. {
  374.     if(f1 >= 0 && f2 >= 0 && f1 < f2)
  375.     {
  376.         *(float*)(getPlayerState(clientIndex) + 0xAC0) = f1;
  377.         *(float*)(getPlayerState(clientIndex) + 0xAC4) = f2;
  378.     }
  379. }
  380.  
  381. //Working Status: Untested but should work
  382. int (*G_EffectIndex)(char*effectName) = (int(__cdecl*)(char*))0x8215C7E0;
  383. int LoadFX(char*fx)
  384. {
  385.     if(stricmp(fx, "fx/", 0x3) != 0 || stricmp(fx,"vfx/",0x4) != 0)
  386.     {
  387.         if(G_EffectIndex(fx) != 0 || *(int*)(0x83375128 + 0x2C) != 0) return G_EffectIndex(fx);
  388.     }
  389. }
  390. //All enumerations and structures are correct
  391. typedef enum : int
  392. {
  393.     RIFLE, SNIPER, MG, SMG, SPREAD, PISTOL, GRENADE, ROCKET_LAUNCHER, TURRET, THROWING_KNIFE, NON_PLAYER, ITEM
  394. }weapClass_t;
  395.  
  396. typedef enum : int
  397. {
  398.     PRIMARY, OFFHAND, ITEM, ALTMODE, EXCLUSIVE, SCAVENGER, FULL_AUTO, SINGLE_SHOT, BURST_2, BURST_3, BURST_4, X2_BARREL, NONE, SMALL, MEDIUM, LARGE
  399. }weapInventoryType_t;
  400.  
  401. typedef enum : int
  402. {
  403.     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
  404. }meansOfDeath_t;
  405.  
  406. typedef struct
  407. {
  408.     unsigned short entityNum, classNum;
  409. }scr_entref_t;
  410. //Working Status: Worked on MW2, re-reversed it and got a different result on ghosts, so untested but might(should) work
  411. int (*GScr_GetLocSelIndex)(char*locMat) = (int(__cdecl*)(char*))0x8215C9C0;
  412. /*
  413.     Example:
  414.         scr_entref_t ent;
  415.         ent.entityNum = clientIndex;
  416.         ent.classNum = 0;
  417.         BeginLocationSelection(ent, "map_artillery_selector", 1, (*(float*)(0x83375128 + 0x28DC) / 5.625));
  418. */
  419. void BeginLocationSelection(scr_entref_t ent, char*locMat int flag, float size)
  420. {
  421.     if(ent.classNum != 0) printf("ClassNum must be zero\n");
  422.     if(size <= 0.0) printf("Radius of location selector must be greater than zero\n");
  423.     float lol, mapSize = *(float*)(0x83375128 + 0x28DC);
  424.     if(mapSize <= 0.0) lol = (size * 0.001);
  425.     else lol = (mapSize / size);
  426.     if(lol >= 0.0) { if(lol <= 1.0) { goto main; } else { goto main; } } else { goto main; }
  427.     main:
  428.         int flr = (int)floor((lol * 31.0) + 0.5);
  429.         *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) = (GScr_GetLocSelIndex(locMat) & 3);
  430.         *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) |= ((flr & 0x1F) << 2);
  431.         *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) |= ((flag & 1) << 7);
  432. }
  433.  
  434. //Working Status: Doesn't need testing, obviously would work
  435. void EndLocationSelection(scr_entref_t ent)
  436. {
  437.     if(ent.classNum != 0) printf("ClassNum must be zero\n");
  438.     else *(int*)(getPlayerState((int)ent.entityNum) + 0x23C) = 0;
  439. }
  440.  
  441. int G_GetTime()
  442. {
  443.     return *(int*)(0x83375128 + 0x540);
  444. }
  445.  
  446. void Scr_AnglesToForward(float*angles, float*forward)
  447. {
  448.     float si = sin(angles[1]*(3.14159265358979323846*2 / 360));
  449.     forward[0] = (cos(angles[1]*(3.14159265358979323846*2 / 360)) * cos(angles[0]*(3.14159265358979323846*2 / 360)));
  450.     forward[1] = (cos(angles[1]*(3.14159265358979323846*2 / 360)) * sin(angles[0]*(3.14159265358979323846*2 / 360)));
  451.     forward[2] = -si;
  452. }
  453.  
  454. typedef enum : int
  455. {
  456.     FREE, TEXT, VALUE, UNKNOWN, MATERIAL, TENTHS_TIMER_DOWN = 9, TENTH_TIMER_UP, CLOCK_DOWN, CLOCK_UP, WAYPOINT
  457. }he_type_t;
  458.  
  459. typedef struct
  460. {
  461.     unsigned char red, green, blue, alpha
  462. }hudelem_color_t;
  463.  
  464. typedef struct game_hudelem_s
  465. {
  466.     hudelem_s elem; //0x00 - 0xA8
  467.     int clientIndex; //0xA8 - 0xAC
  468.     int teamNum; //0xAC - 0xB0
  469.     int unknown; //0xB0 - 0xB4
  470.     int archived; //0xB4 - 0xB8
  471. };
  472.  
  473. typedef enum : int
  474. {
  475.     X, Y, Z,
  476.     ORG = 0, SCRN = 1
  477. };
  478.  
  479. typedef struct hudelem_s
  480. {
  481.     he_type_t type; //0x00 - 0x04
  482.     float origin[3]; //0x04 - 0x10
  483.     int entityIndex; //0x10 - 0x14
  484.     float fontScale; //0x14 - 0x18
  485.     float fromFontScale; //0x18 - 0x1C
  486.     int fontScaleStartTime; //0x1C - 0x20
  487.     int fontScaleTime; //0x20 - 0x24
  488.     int font; //0x24 - 0x28
  489.     /*  Everything else after font is just +0x10 from the cod4 structure  */
  490.     int align[2]; //0x28 - 0x30
  491.     hudelem_color_t color; //0x30 - 0x34
  492.     hudelem_color_t fromColour; //0x34 - 0x38
  493.     int fadeStartTime; //0x38 - 0x3C
  494.     int fadeTime; //0x3C - 0x40
  495.     int label; //0x40 - 0x44
  496.     int width; //0x44 - 0x48
  497.     int height; //0x48 - 0x4C
  498.     int materialIndex; //0x4C - 0x50
  499.     int fromWidth; //0x50 - 0x54
  500.     int fromHeight; //0x54 - 0x58
  501.     int scaleStartTime; //0x58 - 0x5C
  502.     int scaleTime; //0x5C - 0x60
  503.     float fromVec2[2]; //0x60 - 0x68
  504.     int fromAlign[2]; //0x68 - 0x70
  505.     int moveStartTime; //0x70 - 0x74
  506.     int moveTime; //0x74 - 0x78
  507.     int time; //0x78 - 0x7C
  508.     int duration; //0x7C - 0x80
  509.     float value; //0x80 - 0x84
  510.     int text; //0x84 - 0x88
  511.     float sort; //0x88 - 0x8C
  512.     hudelem_color_t glowColour; //0x8C - 0x90
  513.     int fxBirthTime; //0x90 - 0x94
  514.     int fxLetterTime; //0x94 - 0x98
  515.     int fxDecayStartTime; //0x98 - 0x9C
  516.     int fxDecayDuration; //0x9C - 0xA0
  517.     int soundIndex; //0xA0 - 0xA4
  518.     int flag; //0xA4 - 0xA8
  519. };
  520. //Working Status: Untested
  521. int (*G_MaterialIndex)(char*materialName) = (int(__cdecl*)(char*))0x8215C4C0;
  522. void HECmd_SetClock(game_hudelem_s*elem, float time, float fullTime, char*material, int width, int height, bool up=false)
  523. {
  524.     elem->elem.type = (!up ? CLOCK_DOWN : CLOCK_UP);
  525.     elem->elem.time = (int)ceil(time * 1000);
  526.     elem->elem.duration = (int)ceil(fullTime * 1000);
  527.     elem->elem.materialIndex = G_MaterialIndex(materialName);
  528.     elem->elem.width = width;
  529.     elem->elem.height = height;
  530. }
  531. //Working Status: Untested
  532. void HECmd_FadeOverTime(game_hudelem_s*elem, float time)
  533. {
  534.     elem->elem.fromColor = elem->elem.color;
  535.     elem->elem.fadeStartTime = G_GetTime();
  536.     elem->elem.fadeTime = (int)floor((time * 1000) + 0.5);
  537. }
  538. //Working Status: Untested
  539. void HECmd_ChangeFontScale(game_hudelem_s*elem, float time)
  540. {
  541.     elem->elem.fromFontScale = elem->elem.fontScale;
  542.     elem->elem.fontScaleStartTime = G_GetTime();
  543.     elem->elem.fontScaleTime = (int)floor((time * 1000) + 0.5);
  544. }
  545. //Working Status: Untested
  546. void HECmd_ScaleOverTime(game_hudelem_s*elem, float time, int width, int height)
  547. {
  548.     elem->elem.width = width;
  549.     elem->elem.height = height;
  550.     elem->elem.scaleStartTime = G_GetTime();
  551.     elem->elem.scaleTime = (int)floor((time * 1000) + 0.5);
  552.     elem->elem.fromHeight = elem->elem.height;
  553.     elem->elem.fromWidth = elem->elem.width;
  554. }
  555. //Working Status: Untested
  556. void HECmd_MoveOverTime(game_hudelem_s*elem, float time)
  557. {
  558.     elem->elem.moveStartTime = G_GetTime();
  559.     elem->elem.moveTime = (int)floor((time * 1000) + 0.5);
  560.     elem->elem.fromVec2[X] = elem->elem.origin[X];
  561.     elem->elem.fromVec2[Y] = elem->elem.origin[Y];
  562.     elem->elem.fromAlign[ORG] = elem->elem.align[ORG];
  563.     elem->elem.fromAlign[SCRN] = elem->elem.align[SCRN];
  564. }
  565. //Working Status: Untested
  566. void HECmd_SetWaypoint(game_hudelem_s*elem, float lol, float*origin, int entity)
  567. {
  568.     elem->elem.type = WAYPOINT;
  569.     elem->elem.value = lol;
  570.     for(int i = X; i <= Z; i++)
  571.         elem->elem.origin[i] = origin[i];
  572.     elem->elem.entityIndex = *(int*)(entity);
  573. }
  574. //Working Status: Tested & Working
  575. int gClient(int clientIndex)
  576. {
  577.     return *(int*)(getEntity(clientIndex) + 0x158);
  578. }
  579. //Working Status: Untested but will work
  580. bool isConnected(int clientIndex)
  581. {
  582.     return (*(int*)(gClient(clientIndex) + 0x2F9C) & 2);//0x2F9C = int connected; //0x02 = connected, 0x01 = connecting & 0x00 = disconnected
  583. }
  584.  
  585. //Working status: Untested but should work
  586. int (*G_SpawnPlayerClone)() = (int(__cdecl*)())0x8242CD98;
  587. void (*G_SetOrigin)(int ent, float*newOrigin) = (void(__cdecl*)(int,float*))0x8242C8D0;
  588. void (*G_SetAngles)(int ent, float*newAngles) = (void(__cdecl*)(int,float*))0x8242C928;
  589. int (*Com_GetServerDObj)(int handle) = (int(__cdecl*)(int))0x8246EF98;
  590. int (*DObjGetTree)(int obj) = (int(__cdecl*)(int))0x82572D00;
  591. int (*G_GetFreePlayerCorpseIndex)() = (int(__cdecl*)())0x823FEC98;
  592. void (*XAnimCloneAnimTree)(int from, int to) = (void(__cdecl*)(int,int))0x825781F0;
  593. int (*_8246EFD8)(int ent) = (int(__cdecl*)(int))0x8246EFD8;
  594. void (*_82220670)(int r3, int r4, int ent, int startUp, int r7) = (void(__cdecl*)(int,int,int,int,int))0x82220670;
  595. void (*_824319C8)(int ent, int ent2) = (void(__cdecl*)(int,int))0x824319C8;
  596. void (*_8242AA08)(int ent, int r4) = (void(__cdecl*)(int,int))0x8242AA08;
  597. void (*_823E4580)(int ent) = (void(__cdecl*)(int))0x823E4580;
  598. int ClonePlayer(int clientIndex, int deathAnimDur)
  599. {
  600.     int clone = G_SpawnPlayerClone();
  601.     *(int*)(clone + 0x90) = *(int*)(gClient(clientIndex) + 0x17C); //Spoofing the clientIndex to your own, but to your clone
  602.     int math = (*(int*)(gClient(clientIndex) + 0x124) & ~0x200000000 | *(int*)(clone + 0x8) & 0x200000000)
  603.     math &= 0x10000000;
  604.     math = ((math << 16) | 0x14);
  605.     *(int*)(clone + 0x08) = math;//Spoofing eFlags, from yours to the clones
  606.     float*myOrigin[3] = { *(float*)(gClient(clientIndex) + 0x1C), *(float*)(gClient(clientIndex) + 0x20), *(float*)(gClient(clientIndex) + 0x24) }
  607.     float*myAngles[3] = { *(float*)(getEntity(clientIndex) + 0x144), *(float*)(getEntity(clientIndex) + 0x148), *(float*)(getEntity(clientIndex) + 0x14C) };
  608.     G_SetOrigin(clone, myOrigin); //So he spawns right on your origin
  609.     G_SetAngles(clone, myAngles); //Spawn's looking in out direction
  610.     *(int*)(clone + 0xC) = 5; //Setting gravity
  611.     *(int*)(clone + 0x10) = G_GetTime(); //Setting the time to the current time, this is for the gravity effect.
  612.     float*myDelta[3] = {*(float*)(gClient(clientIndex) + 0x28), *(float*)(gClient(clientIndex) + 0x2C), *(float*)(gClient(clientIndex) + 0x30) };
  613.     *(float*)(clone + 0x24) = myDelta[0];
  614.     *(float*)(clone + 0x28) = myDelta[1];
  615.     *(float*)(clone + 0x2C) = myDelta[2];//Spoofing our delta origin to the clone's
  616.     *(int*)(clone + 0x04) = 2; //Setting the clone's eType
  617.     *(unsigned char*)(clone + 0x172) = 01; //physics object
  618.     int tree = DObjGetTree(Com_GetServerDobj(*(int*)(gClient(clientIndex) + 0x17C)));
  619.     if(*(float*)(clone + 0x24) <= *(float*)(0x832ACE24 + 0xC))
  620.     {
  621.         if(*(float*)(clone + 0x28) <= *(float*)(0x832ACE24 + 0xC))
  622.         {
  623.             *(int*)(clone + 0x1B0) = G_GetTime();
  624.             int point = 0x834CEAD0 + 0x10F8 + (G_GetFreePlayerCorpse() * 0x5AC);
  625.             *(int*)(point + 0x8) = G_GetTime();
  626.             *(unsigned char*)(point + 0x5A9) = 00;
  627.             *(int*)(point + 0x04) = *(int*)(clone);
  628.             *(unsigned char*)(point + 0x5A8) = 01;
  629.             int test = *(int*)(0x83327A80 + 0x4); test <<= 16; test += 0x1138;
  630.             memcpy((void*)(point + 0xC), (void*)test, 0x59C);
  631.             *(int*)(point + 0x394) = *(int*)(point);
  632.             *(int*)(gClient(clientIndex) + 0xB8) = G_GetFreePlayerCorpse();
  633.             XAnimCloneAnimTree(*(int*)(point), tree);
  634.             *(int*)(clone + 0x80) = 0x7FF;
  635.             *(int*)(clone + 0x88) = *(int*)(getEntity(clientIndex) + 0x88); //Not to sure exactly, but it's copying your data
  636.             *(unsigned char*)(clone + 0x102) = 02; //setting svFlags
  637.             for(int i = 6; i != 0; i--)
  638.                 *(int*)(clone + 0x100) = *(int*)(getEntity(clientIndex + 0x100);
  639.                 *(int*)(clone + 0x11C) = *(int*)(getEntity(clientIndex + 0x11C);
  640.             *(int*)(clone + 0x194) = 0x10001;
  641.             *(int*)(clone + 0x1C) = 0x4008000;
  642.             SV_LinkEntity(clone);
  643.             int lel = _8246D8A8(clone);
  644.             *(unsigned char*)(clone + 0x175) = 0xD; //handler
  645.             *(int*)(clone + 0x1A4) = (G_GetTime() + deathAnimDur);//nextThink
  646.             _8221F870(-1, lel, clone, *(int*)(point + 0xC), 0);
  647.             _824307D8(getEntity(clientIndex), clone);
  648.             _82429818(*(int*)(getEntity(clientIndex) + 0xE0), clone);
  649.             if(*(int*)(gClient(clientIndex) + 0x44) > *(int*)(gClient(clientIndex) + 0x34) || *(int*)(gClient(clientIndex) + 0x44) != *(int*)(gClient(clientIndex) + 0x7FE))
  650.             {
  651.                 _823E3568(clone);
  652.             }
  653.             return clone;
  654.         }
  655.         else *(float*)(clone + 0x28) = *(float*)(0x832ACE24 + 0xC); return 0;
  656.     }
  657.     else *(float*)(clone + 0x24) = *(float*)(0x832ACE24 + 0xC);return 0;
  658.     return -1;
  659. }
  660.  
  661. void PlayFxOnTag(int effectId, char*tagName, int entity)
  662. {
  663.     float origin[3];
  664.     getTagOrigin(*(int*)(entity), tagName, &origin);
  665.     doEffect(effectId, &origin);
  666. }
  667.  
  668. int PlayLoopedFX(int effectId, float repeat_delay, float*source)
  669. {
  670.     int entity = G_Spawn(); float*angle[3];
  671.     *(int*)(entity + 0x04) = 0x09;
  672.     *(int*)(entity + 0xD4) = effectId;
  673.     setOrigin(entity, source);
  674.     memcpy((void*)angle, (void*)(entity + 0x3C), 0xC);
  675.     setFXAngles(2, 0, angle);
  676.     *(float*)(entity + 0x54) = 0;
  677.     *(int*)(entity + 0x58) = (int)floor(repeat_delay);
  678.     SV_LinkEntity(entity);
  679.     return entity;
  680. }
  681.  
  682. bool isDead(int clientIndex)
  683. {
  684.     return (bool)(*(int*)(gClient(clientIndex) + 0x3704) & 1);
  685. }
  686.  
  687. /*
  688.     //Random as fuck
  689.  
  690.         bool state[0xC][0x3] = {false};
  691.         DWORD WINAPI Monitoring(int clientIndex)
  692.         {
  693.             for(;;)
  694.             {
  695.                 state[clientIndex][0] = (*(int*)(gClient(clientIndex) + 0x3704) != 0 ? true : false); //onSpawn
  696.                 state[clientIndex][1] = (*(int*)(gClient(clientIndex) + 0x3704) & 1 ? true : false); //onDeath
  697.                 state[clientIndex][2] = (*(int*)(gClient(clientIndex) + 0x3704) & 2 ? true : false); //onSpecting
  698.             }
  699.         }
  700. */
  701.  
  702. void rotatePitch(int clientIndex, float pitch)
  703. {
  704.     float*angles[3] = { *(float*)(getEntity(clientIndex) + 0x144), pitch, *(float*)(getEntity(clientIndex) + 0x14C) };
  705.     setClientViewAngles(angles);
  706. }
  707.  
  708. void rotateYaw(int clientIndex, float yaw)
  709. {
  710.     float*angles[3] = { yaw, *(float*)(getEntity(clientIndex) + 0x148), *(float*)(getEntity(clientIndex) + 0x14C) };
  711.     setClientViewAngles(angles);
  712. }
  713.  
  714. void rotateRoll(int clientIndex, float roll)
  715. {
  716.     float*angles[3] = { *(float*)(getEntity(clientIndex) + 0x144), *(float*)(getEntity(clientIndex) + 0x148), roll };
  717.     setClientViewAngles(angles);
  718. }
  719.  
  720. bool teamBased()
  721. {
  722.     return (*(int*)(gClient(irand(0, 0xC)) + 0x3060) == 0);
  723. }
  724.  
  725. bool onSameTeam(int client1, int client2)
  726. {
  727.     return (!memcmp((void*)(*(int*)(gClient(client1) + 0x3060)), (void*)(*(int*)(gClient(client2) + 0x3060)), 0x1));
  728. }
  729.  
  730. void* BirthThread(int threadIndex, PTHREAD_START_ROUTINE start, __in_opt void*param)
  731. {
  732.     HANDLE thread = CreateThread(0, 0, (PTHREAD_START_ROUTINE)start, (void*)param, 2, &threadIndex);
  733.     SetThreadPriority(thread, -15);
  734.     ResumeThread(thread);
  735. }
  736.  
  737. void* KillThread(HANDLE thread = GetCurrentThread())
  738. {
  739.     TerminateThread(thread, 0);
  740.     CloseHandle(thread);
  741. }
  742.  
  743. DWORD WINAPI endon(int clientIndex, char*cmd, HANDLE thread, bool tof)
  744. {
  745.     for(;;)
  746.     {
  747.         Sleep(10);
  748.         if(!strcmp(cmd,"death"))
  749.         {
  750.             if(isDead(clientIndex))
  751.                 KillThread(thread);
  752.             tof = (isDead(clienIndex) ? true : false);
  753.         }
  754.         else if(!strcmp(cmd,"disconnect"))
  755.         {
  756.             if(!isConnected(clientIndex))
  757.                 KillThread(thread);
  758.             tof = (!isConnected(clienIndex) ? true : false);
  759.         }
  760.     }
  761. }
  762. #define ENDON_DEATH 0
  763. #define ENDON_DISCONNECT 1
  764. DWORD WINAPI autoAim(int self)
  765. {
  766.     int aimAt; float*dasResult[3]; bool isTrue[0xC][2] = {false};
  767.     SV_GameSendServerCommand(self, 1, "e \"Aim Bot ^2On\"");
  768.     for(;;)
  769.     {
  770.         Sleep(10);
  771.         BirthThread(NULL, endon, self, "death", GetCurrentThread(), isTrue[self][ENDON_DEATH]);
  772.         BirthThread(NULL, endon, self, "disconnect", GetCurrentThread(), isTrue[self][ENDON_DISCONNECT]);
  773.         if(isTrue[self][ENDON_DEATH] || isTrue[self][ENDON_DISCONNECT]) SV_GameSendServerCommand(self, 1, "e \"Aim Bot ^1Off\"");
  774.         for(int player = 0; player < 0xC; player++)
  775.         {
  776.            
  777.             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) };
  778.             if(!memcmp((void*)player, (void*)self, 0x4) || teamBased() && onSameTeam(self, player) || *(int*)(gentity(player) + 0x1A4) <= 0 || !bulletTracePassed(myOrigin, thereOrigin, false, getEntity(self))) continue;
  779.             if(closer(myOrigin, thereOrigin, aimAtOrigin))
  780.             {
  781.                 for(int i = 0; i < 3; i++)
  782.                     data().Origin2Angles((thereOrigin[i] - myOrigin[i]), dasResult);
  783.                 setClientViewAngles(getEntity(self), dasResult);
  784.             }
  785.         }
  786.     }
  787. }
  788.  
  789. 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
  790. void PhysicsTrace(float*v1,float*v2,float*out)
  791. {
  792.     trace_t trace;
  793.     G_TraceCapsule(trace, v1, v2, *(float*)0x8204B850, 0x7FF, 0x820015, *(float*)0x8204B850);
  794.     float*result[3] = { v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2] };
  795.     for(int i = 0; i < 3; i++)
  796.     {
  797.         *out[i] = (result[i] * trace.fraction) + v1[i];
  798.     }
  799. }
  800.  
  801. typedef enum : int
  802. {
  803.     RB = 0x4000,
  804.     LB = 0x8000,
  805.     UNKNOWN = 0x800, //POSSIBLY LT
  806.     UNKNOWN_2 = 0x400 //POSSIBLY RT
  807. }buttonEnum;
  808.  
  809. bool buttonPressed(int clientIndex, buttonEnum buttonId)//if(buttonPressed(0, buttonEnum::FRAG))
  810. {
  811.     return (*(int*)(gClient(clientIndex) + 0x3330) & buttonId);
  812. }
  813.  
  814. DWORD WINAPI QuickScope(int clientIndex)
  815. {
  816.     bool True[0xC][2] = {false};
  817.     BirthThread(NULL, endon, clientIndex, "death", GetCurrentThread(), True[clientIndex][ENDON_DEATH]);
  818.     BirthThread(NULL, endon, clientIndex,  "disconnect", GetCurrentThread(), True[clientIndex][ENDON_DISCONNECT]);
  819.     if(True[clientIndex][ENDON_DISCONNECT] || True[clientIndex][ENDON_DEATH])
  820.         SV_GSSC(clientIndex, 1, "f \"Quick Scope ^1Off\"");
  821.         KillThread();
  822.     while(true)
  823.     {
  824.         if(buttonPressed(clientIndex,buttonEnum::UNKNOWN))
  825.         {
  826.             Sleep(300);
  827.             *(int*)(gClient(clientIndex) + 0x420) &= ~0x20;
  828.             *(int*)(gClient(clientIndex) + 0x420) |= 0x20;
  829.             *(int*)(gClient(clientIndex) + 0x420) &= ~0x20;
  830.             *(int*)(gClient(clientIndex) + 0x420) |= 0x20;
  831.             Sleep(0.5);
  832.         }
  833.     }
  834. }
  835.  
  836. bool ufo[0xC] = {false};
  837. void doUfo(int clientIndex, buttonEnum bind)
  838. {
  839.    setSpectatePermissions(clientIndex);
  840.    for(;;)
  841.    {
  842.      Sleep(10);
  843.      if(buttonPressed(clientIndex, bind))
  844.      {
  845.        ufo[clientIndex] ^= true;
  846.        allowSpectateTeam(clientIndex, "freelook", ufo[clientIndex]));
  847.        *(int*)(gClient(clientIndex) + 0x3704) = (ufo[clientIndex] ? 2 : 0);
  848.        *(int*)(getEntity(clientIndex) + 0x11C) = (ufo[clientIndex] ? 0 : 100);
  849.      }
  850.    }
  851. }
  852.  
  853. void allowSpectateTeam(int clientIndex, char*team, bool value)
  854. {
  855.    int id;
  856.    if(!strcmp(team,"axis")) id = 0x02;
  857.    else if(!strcmp(team,"allies")) id = 0x04;
  858.    else if(!strcmp(team,"none")) id = 0x01;
  859.    else if(!strcmp(team,"freelook")) id = 0x10;
  860.    else printf("team must be \"axis\", \"allies\", \"none\", or \"freelook\"\n");
  861.      *(int*)(gClient(clientIndex) + 0x3058) = (value ? *(int*)(gClient(clientIndex) + 0x3058) & ~id : *(int*)(gClient(clientIndex) + 0x3058) | id);
  862. }
  863. char* getOtherTeam(int clientIndex)
  864. {
  865.    if(*(int*)(gClient(clientIndex) + 0x3060) & 1) return "allies";
  866.    if(*(int*)(gClient(clientIndex) + 0x3060) & 2) return "axis";
  867.    else return "none";
  868. }
  869.  
  870. char*G_GetTeamForClient(int clientIndex)
  871. {
  872.    if(*(int*)(gClient(clientIndex) + 0x3060) & 1) return "axis";
  873.    if(*(int*)(gClient(clientIndex) + 0x3060) & 2) return "allies";
  874.    if(*(int*)(gClient(clientIndex) + 0x3060) & 3) return "spectator";
  875.    else return "none";
  876. }
  877.  
  878. void setSpectatePermissions(int clientIndex)
  879. {
  880.    char*team = G_GetTeamForClient(clientIndex);
  881.    if(!teamBased())
  882.    {
  883.      allowSpectateTeam(clientIndex, "allies", false);
  884.      allowSpectateTeam(clientIndex, "axis", false);
  885.      allowSpectateTeam(clientIndex, "freelook", false);
  886.      allowSpectateTeam(clientIndex, "none", false);
  887.    }
  888.    else if(!strcmp(team,"allies") || !strcmp(team,"axis"))
  889.    {
  890.      allowSpectateTeam(clientIndex,getOtherTeam(clientIndex),true);
  891.      allowSpectateTeam(clientIndex,team,false);
  892.      allowSpectateTeam(clientIndex, "freelook",false);
  893.      allowSpectateTeam(clientIndex, "none",false);
  894.    }
  895.    else if(!strcmp(team,"spectator"))
  896.    {
  897.      allowSpectateTeam(clientIndex, "allies",true);
  898.      allowSpectateTeam(clientIndex, "axis",true);
  899.      allowSpectateTeam(clientIndex, "freelook",true);
  900.      allowSpectateTeam(clientIndex, "none",true);
  901.    }
  902.    else
  903.    {
  904.      allowSpectateTeam(clientIndex, "allies",false);
  905.      allowSpectateTeam(clientIndex, "axis",false);
  906.      allowSpectateTeam(clientIndex, "freelook",false);
  907.      allowSpectateTeam(clientIndex, "none",false);
  908.    }
  909. }
  910.  
  911. bool isTalking(int clientIndex)
  912. {
  913.     if((*(int*)(gClient(clientIndex) + 0x3400) - G_GetTime()) < 0) return false;
  914.     if((*(int*)(gClient(clientIndex) + 0x3400) - G_GetTime()) < *(int*)(0x832AE69C + 0xC)) return true;
  915. }
  916.  
  917. void lastStand(int clientIndex, bool enabled)
  918. {
  919.     *(int*)(gClient(clientIndex) + 0x36A0) = (int)enabled;
  920.     *(int*)(gClient(clientIndex) + 0x36A4) = (enabled ? G_GetTime() : 0);
  921. }
  922.  
  923. int (*G_EntLinkToWithOffset)(int ent, int parent, unsigned int tagName, float *originOffset, float *anglesOffset) = (int(__cdecl*)(int,int,unsigned int, float*,float*))0x82430798;
  924. int (*G_EntLinkTo)(int ent, int parent, unsigned int tagName) (int(__cdecl*)(int,int,unsigned int))0x82431AD0;
  925. 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
  926. {
  927.     if(*(int*)(entity + 0x18C) != 0x20)
  928.     {
  929.         if(G_EntLinkToWithOffset(entity, parent, 0, originOffset, anglesOffset))
  930.         {
  931.             G_EntLinkTo(end, parent, 0);
  932.             *(unsigned char*)(*(int*)(entity + 0x218) + 0xA) = 01;
  933.         }
  934.     }
  935. }
  936.  
  937. DWORD WINAPI Noclip(int clientIndex)
  938. {
  939.     float*myOrigin[3] = { *(float*)(gClient(clientIndex) + 0x1C), *(float*)(gClient(clientIndex) + 0x20), *(float*)(gClient(clientIndex) + 0x24) };
  940.     float*vec[3], *end[3], *angles[3];
  941.     int newufo = spawn("script_origin", myOrigin);
  942.     for(;;)
  943.     {
  944.         *myOrigin[0] = *(float*)(gClient(clientIndex) + 0x1C); *myOrigin[1] = *(float*)(gClient(clientIndex) + 0x20); *myOrigin[2] = *(float*)(gClient(clientIndex) + 0x24);
  945.         if(*(int*)(gClient(clientIndex) + 0x420) != 0x1000) *(int*)(gClient(clientIndex) + 0x420) &= ~0x1000;//Disable offhand use
  946.         *(float*)(newufo + 0x138) = *myOrigin[0];
  947.         *(float*)(newufo + 0x13C) = *myOrigin[1];
  948.         *(float*)(newufo + 0x140) = *myOrigin[2];
  949.         LinkTo(getEntity(clientIndex), newufo);
  950.         for(int i = 0; i < 3; i++){ for(int f = 0x144; f <= 0x14C; f += 4){ *angles[i] = *(float*)(getEntity(clientIndex) + f); } }
  951.         Scr_AnglesToForward(angles, vec);
  952.         if(buttonPressed(clientIndex, RB))
  953.         {
  954.             for(int i = 0; i < 3; i++) *end[i] = (vec[i]*200);
  955.             *(float*)(newufo + 0x138) += end[0];
  956.             *(float*)(newufo + 0x13C) += end[1];
  957.             *(float*)(newufo + 0x140) += end[2];
  958.         }
  959.         else if(buttonPressed(clientIndex, LB))
  960.         {
  961.             for(int i = 0; i < 3; i++) *end[i] = (vec[i]*20);
  962.             *(float*)(newufo + 0x138) += end[0];
  963.             *(float*)(newufo + 0x13C) += end[1];
  964.             *(float*)(newufo + 0x140) += end[2];
  965.         }
  966.     }
  967.     Sleep((DWORD)floor(0.05 * 1000) + 0.5);
  968. }
Add Comment
Please, Sign In to add comment