Advertisement
MrDarkblue

MW3 1.24 C++ Nonhost Basic Functions

Apr 24th, 2018
1,064
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.98 KB | None | 0 0
  1. bool Redboxes_t;
  2. bool NoFog_t;
  3. bool ShowCompass_t;
  4. bool AUAV_t;
  5. bool Laser_t;
  6. bool Drawgun_t;
  7. bool SuperSteadyAim_t;
  8. bool SuperQuickDraw_t;
  9. bool SuperSleightofHand_t;
  10. bool InGamePlayerColor_t;
  11. bool NoRecoil_t;
  12. bool LeetVision_t;
  13. bool drawCrosshair_t;
  14. bool ThirdPerson_t;
  15. bool GlassGravity_t;
  16. bool FloatingBodies_t;
  17. bool drawFPS_t;
  18. bool ui_text_t;
  19. bool ShowPing_t;
  20. bool Blur_t;
  21. bool ChangeKillFeedColor_t;
  22. bool ChromePlayers_t;
  23. bool RapidFire_t;
  24. bool ColouredBox_t;
  25. bool DrawgunLeft_t;
  26.  
  27. opd_s Com_sprintf_s = { Com_sprintf_t, TOC };
  28. int(*Com_sprintf)(char *dest, int size, const char *fmt, ...) = (int(*)(char *, int, char const *, ...))&Com_sprintf_s;
  29. opd_s Cbuff_AddText_s = { Cbuff_AddText_t, TOC };
  30. void(*Cbuff_AddText)(int localClientNum, const char * text) = (void(*)(int, const char *))&Cbuff_AddText_s;
  31. opd_s SV_GameSendServerCommand_s = { SV_GameSendServerCommand_t, TOC };
  32. void(*SV_GameSendServerCommand)(int client, int type, char* cmd) = (void(*)(int, int, char*))&SV_GameSendServerCommand_s;
  33. int CG_VisionSetStartLerp_To_t[2] = { 0xB078C, TOC };
  34. void(*CG_VisionSetStartLerp_To)(int unk, int unk1, int unk2, const char *name, int duration) = (void(*)(int, int, int, const char*, int))&CG_VisionSetStartLerp_To_t;
  35. opd_s CG_PlayRumble_t = { 0x909D0, TOC };
  36. int(*CG_PlayRumble)(int Localclient, const char* rumble) = (int(*)(int, const char*))&CG_PlayRumble_t;
  37.  
  38. /////////////////////////////////////
  39. ///Non-Host iPrintln & iPrintlnBold
  40. /////////////////////////////////////
  41. opd_s CG_GameMessage_s = { CG_GameMessage_t, TOC };
  42. void(*CG_GameMessage)(int localClientNum, const char* msg) = (void(*)(int, const char*))&CG_GameMessage_s;
  43.  
  44. void iPrintln(const char * text) {
  45.         iPrintlnText = text;
  46.         iPrintlner = true;}
  47.  
  48. opd_s CG_GameMessageBold_s = { CG_GameMessageBold_t, TOC };
  49. void(*CG_GameMessageBold)(int localClientNum, const char* msg) = (void(*)(int, const char*))&CG_GameMessageBold_s;
  50.  
  51. void iPrintlnBold(const char * text) {
  52.         iPrintlnBoldText = text;
  53.         iPrintlnBolder = true;}}
  54.  
  55. //////////////////////
  56. ///Non-Host Play Sound
  57. //////////////////////
  58. opd_s UI_PlaySound_s = { UI_PlaySound_t, TOC };
  59. void(*UI_PlaySound)(int context, const char* soundalias) = (void(*)(int, const char*))&UI_PlaySound_s;
  60.  
  61. //////////////////////
  62. ///Button Monitoring
  63. //////////////////////
  64. opd_s Key_IsDown_s = { Key_IsDown_t, TOC };
  65. int(*Key_IsDown)(int localClientNum, int keynum) = (int(*)(int, int))&Key_IsDown_s;
  66.  
  67. enum Buttons{
  68.     Null = 0,
  69.     X = 1,
  70.     O = 2,
  71.     square = 3,
  72.     triangle = 4,
  73.     L1 = 5,
  74.     R1 = 6,
  75.     start = 14,
  76.     select = 15,
  77.     L3 = 16,
  78.     R3 = 17,
  79.     L2 = 18,
  80.     R2 = 19,
  81.     UP = 20,
  82.     DOWN = 21,
  83.     LEFT = 22,
  84.     RIGHT = 23,
  85.     APAD_UP = 28,
  86.     APAD_DOWN = 29,
  87.     APAD_LEFT = 30,
  88.     APAD_RIGHT = 31
  89. };
  90.  
  91. ///////////////////////////////
  92. ///Basic ReadBool Functions
  93. ///////////////////////////////
  94. bool inGame() {
  95.     if (*(char*)cl_InGame == 1)
  96.         return true;
  97.     else
  98.         return false;}
  99. bool IsHost() {
  100.     if (PSNName() == HostName()) //not accurate when using changename function
  101.         return true;
  102.     else
  103.         return false;}
  104.  
  105. ///////////////////////////////
  106. ///Basic ReadString Functions
  107. ///////////////////////////////
  108. const char* MapName() { return Dvar_GetString("ui_mapname");}
  109. const char* GameMode() { return Dvar_GetString("ui_gametype");}
  110. const char* HostName() { return Dvar_GetString("sv_hostname");}
  111.  
  112. char* PSNName() { return ReadString(0x01BBBC2C); }
  113. char* Country() { return ReadString(0x01cf1a87); }
  114. char* State() { return ReadString(0x01cf1ac8); }
  115. char* City() { return ReadString(0x01cf1b09); }
  116. char* IP() { return ReadString(0x01BBFE3C); } // changes to last player ip that entered lobby
  117.  
  118. //////////////////////
  119. ///Basic Functions
  120. //////////////////////
  121. void Redboxes(){
  122.     Redboxes_t = !Redboxes_t;
  123.     char bytesOn[] = { 0x60, 0x00, 0x00, 0x00 };
  124.     char bytesOff[] = { 0x41, 0x82, 0x00, 0x0C };
  125.     write_process(0x65D14, Redboxes_t ? bytesOn : bytesOff, sizeof(Redboxes_t ? bytesOn : bytesOff));
  126.     iPrintln(va("Redboxes: %s", Redboxes_t ? "^2On" : "^1Off"));
  127. }
  128. void NoFog(){
  129.     NoFog_t = !NoFog_t;
  130.     char bytesOn[] = { 0x01 };
  131.     char bytesOff[] = { 0x00 };
  132.     write_process(0x18C9158, NoFog_t ? bytesOn : bytesOff, sizeof(NoFog_t ? bytesOn : bytesOff));
  133.     iPrintln(va("No Fog: %s", NoFog_t ? "^2On" : "^1Off"));
  134. }
  135. void ShowCompass(){
  136.     ShowCompass_t = !ShowCompass_t;
  137.     char bytesOn[] = { 0x01 };
  138.     char bytesOff[] = { 0x00 };
  139.     write_process(0x18caaa0, ShowCompass_t ? bytesOn : bytesOff, sizeof(ShowCompass_t ? bytesOn : bytesOff));
  140.     iPrintln(va("Show Compass: %s", ShowCompass_t ? "^2On" : "^1Off"));
  141. }
  142. void AUAV(){
  143.     AUAV_t = !AUAV_t;
  144.     char bytesOn[] = { 0x02 };
  145.     char bytesOff[] = { 0x01 };
  146.     write_process(0x5F067, AUAV_t ? bytesOn : bytesOff, sizeof(AUAV_t ? bytesOn : bytesOff));
  147.     iPrintln(va("Advanced UAV: %s", AUAV_t ? "^2On" : "^1Off"));
  148. }
  149. void Laser(){
  150.     Laser_t = !Laser_t;
  151.     char bytesOn[] = { 0x01 };
  152.     char bytesOff[] = { 0x00 };
  153.     write_process(0xB6703, Laser_t ? bytesOn : bytesOff, sizeof(Laser_t ? bytesOn : bytesOff));
  154.     iPrintln(va("Laser: %s", Laser_t ? "^2On" : "^1Off"));
  155. }
  156. void Drawgun(){
  157.     Drawgun_t = !Drawgun_t;
  158.     char bytesOn[] = { 0x01 };
  159.     char bytesOff[] = { 0x00 };
  160.     write_process(0x18d5308, Drawgun_t ? bytesOn : bytesOff, sizeof(Drawgun_t ? bytesOn : bytesOff));
  161.     iPrintln(va("Drawgun: %s", Drawgun_t ? "^2On" : "^1Off"));
  162. }
  163. void SuperSteadyAim(){
  164.     SuperSteadyAim_t = !SuperSteadyAim_t;
  165.     char bytesOn[] = { 0x01 };
  166.     char bytesOff[] = { 0x3F };
  167.     write_process(0x18de168, SuperSteadyAim_t ? bytesOn : bytesOff, sizeof(SuperSteadyAim_t ? bytesOn : bytesOff));
  168.     iPrintln(va("SuperSteadyAim: %s", SuperSteadyAim_t ? "^2On" : "^1Off"));
  169. }
  170. void SuperQuickDraw(){
  171.     SuperQuickDraw_t = !SuperQuickDraw_t;
  172.     char bytesOn[] = { 0x45 };
  173.     char bytesOff[] = { 0x3F };
  174.     write_process(0x18de784, SuperQuickDraw_t ? bytesOn : bytesOff, sizeof(SuperQuickDraw_t ? bytesOn : bytesOff));
  175.     iPrintln(va("SuperQuickDraw: %s", SuperQuickDraw_t ? "^2On" : "^1Off"));
  176. }
  177. void SuperSleightofHand(){
  178.     SuperSleightofHand_t = !SuperSleightofHand_t;
  179.     char bytesOn[] = { 0x01 };
  180.     char bytesOff[] = { 0x3F };
  181.     write_process(0x18de1ac, SuperSleightofHand_t ? bytesOn : bytesOff, sizeof(SuperSleightofHand_t ? bytesOn : bytesOff));
  182.     iPrintln(va("SuperSleightofHand: %s", SuperSleightofHand_t ? "^2On" : "^1Off"));
  183. }
  184. void InGamePlayerColor(){
  185.     InGamePlayerColor_t = !InGamePlayerColor_t;
  186.     char bytesOn[] = { 0xFF, 0xFF };
  187.     char bytesOff[] = { 0x00, 0x00 };
  188.     write_process(0x18D75D6, InGamePlayerColor_t ? bytesOn : bytesOff, sizeof(InGamePlayerColor_t ? bytesOn : bytesOff));
  189.     iPrintln(va("InGamePlayerColor: %s", InGamePlayerColor_t ? "^2On" : "^1Off"));
  190. }
  191. void NoRecoil(){
  192.     NoRecoil_t = !NoRecoil_t;
  193.     char bytesOn[] = { 0x60, 0x00, 0x00, 0x00 };
  194.     char bytesOff[] = { 0x4B, 0xF8, 0x15, 0x01 };
  195.     write_process(0xBE6D0, NoRecoil_t ? bytesOn : bytesOff, sizeof(NoRecoil_t ? bytesOn : bytesOff));
  196.     iPrintln(va("NoRecoil: %s", NoRecoil_t ? "^2On" : "^1Off"));
  197. }
  198. void LeetVision(){
  199.     LeetVision_t = !LeetVision_t;
  200.     Cbuff_AddText(0, LeetVision_t ? "ui_debugMode 1" : "ui_debugMode 0");
  201.     iPrintln(va("LeetVision: %s", LeetVision_t ? "^2On" : "^1Off"));
  202. }
  203. void drawCrosshair(){
  204.     drawCrosshair_t = !drawCrosshair_t;
  205.     Cbuff_AddText(0, drawCrosshair_t ? "ui_drawCrosshair 1" : "ui_drawCrosshair 0");
  206.     iPrintln(va("drawCrosshair: %s", drawCrosshair_t ? "^2On" : "^1Off"));
  207. }
  208. void ThirdPerson(){
  209.     ThirdPerson_t = !ThirdPerson_t;
  210.     Cbuff_AddText(0, ThirdPerson_t ? "g_thirdPerson 1" : "g_thirdPerson 0");
  211.     iPrintln(va("thirdPerson: %s", ThirdPerson_t ? "^2On" : "^1Off"));
  212. }
  213. void GlassGravity(){
  214.     GlassGravity_t = !GlassGravity_t;
  215.     Cbuff_AddText(0, GlassGravity_t ? "glass_fall_gravity -99" : "glass_fall_gravity 800"); // 65
  216.     iPrintln(va("glass_fall_gravity: %s", GlassGravity_t ? "^2On" : "^1Off"));
  217. }
  218. void DrawgunLeft(){
  219.     DrawgunLeft_t = !DrawgunLeft_t;
  220.     Cbuff_AddText(0, DrawgunLeft_t ? "cg_gun_y 10; cg_gun_x 1" : "cg_gun_y 0; cg_gun_x 0");
  221.     iPrintln(va("DrawgunLeft: %s", DrawgunLeft_t ? "^2On" : "^1Off"));
  222. }
  223. void FloatingBodies(){
  224.     FloatingBodies_t = !FloatingBodies_t;
  225.     Cbuff_AddText(0, FloatingBodies_t ? "phys_gravity_ragdoll 99" : "phys_gravity_ragdoll -800");
  226.     iPrintln(va("gravity_ragdoll: %s", FloatingBodies_t ? "^2On" : "^1Off"));
  227. }
  228. void drawFPS(){
  229.     drawFPS_t = !drawFPS_t;
  230.     Cbuff_AddText(0, drawFPS_t ? "cg_drawFPS 1 " : "cg_drawFPS 0"); //cg_drawFPSLabels 2  1
  231.     iPrintln(va("drawFPS: %s", drawFPS_t ? "^2On" : "^1Off"));
  232. }
  233. void ColouredBox(){
  234.     ColouredBox_t = !ColouredBox_t;
  235.     Cbuff_AddText(0, ColouredBox_t ? "r_showFBColorDebug 1" : "r_showFBColorDebug 0");
  236.     iPrintln(va("ColouredBox: %s", ColouredBox_t ? "^2On" : "^1Off"));
  237. }
  238. // ui_debug_localVarBool
  239. void ui_text(){
  240.     ui_text_t = !ui_text_t;
  241.     Cbuff_AddText(0, ui_text_t ? "ui_debug_localVarBool YO WAZAP" : "ui_debug_localVarBool YO WAZAP");
  242.     iPrintln(va("ui_text: %s", ui_text_t ? "^2On" : "^1Off"));
  243. }
  244. void ShowPing(){
  245.     ShowPing_t = !ShowPing_t;
  246.     Cbuff_AddText(0, ShowPing_t ? "cl_maxPing 1" : "cl_maxPing 0");
  247.     iPrintln(va("ShowPing: %s", ShowPing_t ? "^2On" : "^1Off"));
  248. }
  249. void Blur(){
  250.     Blur_t = !Blur_t;
  251.     Cbuff_AddText(0, Blur_t ? "r_blur 5" : "reset r_blur");
  252.     iPrintln(va("Blur: %s", Blur_t ? "^2On" : "^1Off"));
  253. }
  254. void ChangeKillFeedColor(char* ColorAllies = "1 0 0 1", char* ColorAxis = "0 0 1 1"){
  255.     ChangeKillFeedColor_t = !ChangeKillFeedColor_t;
  256.     Cbuff_AddText(0, ChangeKillFeedColor_t ? va("cg_TeamColor_Allies %s ; cg_TeamColor_Axis %s", ColorAllies, ColorAxis) : "cg_TeamColor_Allies 0.15 0.16 0.18 0.26; cg_TeamColor_Axis 0.17 0.15 0.11 0.26");
  257.     iPrintln(va("ChangeKillFeedColor: %s", ChangeKillFeedColor_t ? "^2On" : "^1Off"));
  258. }
  259. void ChromePlayers(){
  260.     ChromePlayers_t = !ChromePlayers_t;
  261.     char bytesOn[] = { 0x01 };
  262.     char bytesOn2[] = { 0x05, 0x70 };
  263.     char bytesOff[] = { 0x00 };
  264.     char bytesOff2[] = { 0x05, 0x6A };
  265.     write_process(0x3984DF, ChromePlayers ? bytesOn : bytesOff, sizeof(ChromePlayers_t ? bytesOn : bytesOff));
  266.     write_process(0x3984F2, ChromePlayers ? bytesOn2 : bytesOff2, sizeof(ChromePlayers_t ? bytesOn2 : bytesOff2));
  267.     iPrintln(va("ChromePlayers: %s", ChromePlayers_t ? "^2On" : "^1Off"));
  268. }
  269. void RapidFire(){
  270.     RapidFire_t = !RapidFire_t;
  271.     char bytesOn1[] = { 0x60, 0x00, 0x00, 0x00 };
  272.     char bytesOn2[] = { 0xC0, 0x23, 0x00, 0x00 };
  273.     char bytesOn3[] = { 0x48, 0x00, 0x00, 0x3C };
  274.     char bytesOn4[] = { 0x3D, 0x4C, 0xCC, 0xCD };
  275.  
  276.     char bytesOff1[] = { 0x41, 0x82, 0x00, 0x94 };
  277.     char bytesOff2[] = { 0xC0, 0x24, 0x00, 0x00 };
  278.     char bytesOff3[] = { 0x40, 0x82, 0x00, 0x3C };
  279.     char bytesOff4[] = { 0x41, 0x82, 0x00, 0x94 };
  280.  
  281.     write_process(0x31D6C, RapidFire ? bytesOn1 : bytesOff1, sizeof(RapidFire_t ? bytesOn1 : bytesOff1));
  282.     write_process(0x31D84, RapidFire ? bytesOn2 : bytesOff2, sizeof(RapidFire_t ? bytesOn2 : bytesOff2));
  283.     write_process(0x31D8C, RapidFire ? bytesOn3 : bytesOff3, sizeof(RapidFire_t ? bytesOn3 : bytesOff3));
  284.     write_process(0x31B44, RapidFire ? bytesOn4 : bytesOff4, sizeof(RapidFire_t ? bytesOn4 : bytesOff4));
  285.     iPrintln(va("RapidFire: %s", RapidFire_t ? "^2On" : "^1Off"));
  286. }
  287. //////////////////////
  288. ///Basic+ Functions
  289. //////////////////////
  290. char* KeyBoard(char* Title)
  291. {
  292.     opd_s key = { 0x026F5BC, TOC };
  293.     void(*Run)(int, char*, char*, int, int, int) = (void(*)(int, char*, char*, int, int, int))&key;
  294.     Run(0, Title, "", 20, 0x72DCE8, 0x7239A0);
  295.     while (PS3::ReadInt32(0x73145C) != 0) //ReadInt32 5F
  296.     {
  297.         continue;
  298.     }
  299.     return PS3::ReadString(0x2380E22);
  300. }
  301. void Cbufkeyboard(int client)
  302. {
  303.     Cbuff_AddText(client, KeyBoard("Cbuff_AddText - Change Dvars. Example:ui_debug 1"));
  304. }
  305. //////////////////////////
  306. /////// Non-Host Vision
  307. //////////////////////////
  308. void ChangeVision(char* Vision){
  309.     CG_VisionSetStartLerp_To((*(int*)(0x7BD008) + 0x1044A8), 0, 3, Vision, 0);
  310. }
  311.  
  312. /////// Non-Host Name Changer "Needs to be in a thread or Hook"
  313. void ChangeInGameName(char* Name){
  314. Cbuff_AddText(0, va(";userinfo \"\\name\\%s\";" , Name));
  315. }
  316. void ChangeInGameNameClantag(char* ClanTag, char* Name){
  317. Cbuff_AddText(0, va(";userinfo \"\\clanAbbrev\\%s\\name\\%s\";", ClanTag, Name);
  318. }
  319. /////////////////////////////////////////////////////////////////////////////////////////
  320. void ChangeTeamAllies(){
  321. char allies[0x100];
  322. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " allies;");
  323. Cbuff_AddText(0, allies);
  324. }
  325. void ChangeTeamAxis(){
  326. char allies[0x100];
  327. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " axis;");
  328. Cbuff_AddText(0, allies);
  329. }
  330. void NonHostSpectator(){
  331. char allies[0x100];
  332. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " spectator;");
  333. Cbuff_AddText(0, allies);
  334. }
  335. void SelectClass()
  336. {
  337. char allies[0x100];
  338. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " changeclass_opfor;");
  339. Cbuff_AddText(0, allies);
  340. }
  341. void ChangeClass(){
  342. char allies[0x100];
  343. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " custom1;");
  344. Cbuff_AddText(0, allies);
  345. }
  346. void EndMatch(){
  347. char allies[0x100];
  348. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " -1 endround;");
  349. Cbuff_AddText(0, allies);
  350. }
  351. void Juggernaut(){
  352. char allies[0x100];
  353. Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " 10 juggernaut;");
  354. Cbuff_AddText(0, allies);
  355. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement