Registration Code (Part 1): w%kQ6
Registration Code (Part 2): b<#$1[*(cw~
In order to register on this forum, you must use the codes above. Combine them into one code (copy paste).

[RELEASE] MapHacks

NosHook addon releases and discussions can be done here.
Post Reply
User avatar
atom0s
Site Admin
Posts: 388
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

[RELEASE] MapHacks

Post by atom0s » Sat Aug 06, 2016 4:08 pm

Addon Name: MapHacks
Addon Author: atom0s
Addon Version: v1.0.0.0

Here is a simple addon to add an in-game UI to enable/disable some basic mini-map features. With this you can enable the visibility of enemies, npcs and players with ease.

Image

To use this addon, you must do the following:
  • Open your NosHook folder.
  • Open the /Scripts/Addons/ folder.
  • Create a new folder named maphacks
  • Download the code below and place it into the maphacks folder. (The file should be named maphacks.lua)
  • Paste the below code into that file and save it.
  • In-game open the NosHook console and type: /addon load maphacks
  1. --[[
  2.  * NosHook - Copyright (c) 2016 atom0s [atom0s@live.com]
  3.  *
  4.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  5.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to
  6.  * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
  7.  *
  8.  * By using NosHook, you agree to the above license and its terms.
  9.  *
  10.  *      Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were
  11.  *                    made. You must do so in any reasonable manner, but not in any way that suggests the licensor
  12.  *                    endorses you or your use.
  13.  *
  14.  *   Non-Commercial - You may not use the material (NosHook) for commercial purposes.
  15.  *
  16.  *   No-Derivatives - If you remix, transform, or build upon the material (NosHook), you may not distribute the
  17.  *                    modified material. You are, however, allowed to submit the modified works back to the original
  18.  *                    NosHook project in attempt to have it added to the original project.
  19.  *
  20.  * You may not apply legal terms or technological measures that legally restrict others
  21.  * from doing anything the license permits.
  22.  *
  23.  * No warranties are given.
  24. ]]--
  25.  
  26. require 'common'
  27. require 'imguidef'
  28.  
  29. _addon.author   = 'atom0s';
  30. _addon.name     = 'maphacks';
  31. _addon.version  = '1.00';
  32.  
  33. ----------------------------------------------------------------------------------------------------
  34. -- Variables
  35. ----------------------------------------------------------------------------------------------------
  36. local variables =
  37. {
  38.     ['var_ShowMapHacksWindow']  = { nil, ImGuiVar_BOOLCPP, true },
  39.     ['var_EnableEnemies']       = { nil, ImGuiVar_BOOLCPP, false },
  40.     ['var_EnableNpcs']          = { nil, ImGuiVar_BOOLCPP, false },
  41.     ['var_EnablePlayers']       = { nil, ImGuiVar_BOOLCPP, false },
  42. };
  43.  
  44. local map_pointer       = 0;
  45. local map_offset1       = 0xA8;
  46. local map_show_enemies  = 0xCE;
  47. local map_show_npcs     = 0xCD;
  48. local map_show_players  = 0xCC;
  49.  
  50. ----------------------------------------------------------------------------------------------------
  51. -- func: WriteMapValue
  52. -- desc: Writes a value to the map pointer at the given offset.
  53. ----------------------------------------------------------------------------------------------------
  54. local function WriteMapValue(offset, value)
  55.     -- Prevent invalid write attempts..
  56.     if (map_pointer == 0) then
  57.         return;
  58.     end
  59.    
  60.     -- Convert the value..
  61.     if (value == true) then
  62.         value = 1;
  63.     else
  64.         value = 0;
  65.     end
  66.  
  67.     -- Read into the pointer..
  68.     local pointer = mem.ReadULong(map_pointer);
  69.     pointer = mem.ReadULong(pointer + map_offset1);
  70.    
  71.     -- Write to the offset..
  72.     mem.UnprotectMemory(pointer + offset, 1);
  73.     mem.WriteUChar(pointer + offset, value);
  74.    
  75. end
  76.  
  77. ----------------------------------------------------------------------------------------------------
  78. -- func: load
  79. -- desc: Event called when the addon is being loaded.
  80. ----------------------------------------------------------------------------------------------------
  81. hook.register_event('load', function()
  82.     -- Initialize the custom variables..
  83.     for k, v in pairs(variables) do
  84.         -- Create the variable..
  85.         if (v[2] >= ImGuiVar_CDSTRING) then
  86.             variables[k][1] = imgui.CreateVar(variables[k][2], variables[k][3]);
  87.         else
  88.             variables[k][1] = imgui.CreateVar(variables[k][2]);
  89.         end
  90.        
  91.         -- Set a default value if present..
  92.         if (#v > 2 and v[2] < ImGuiVar_CDSTRING) then
  93.             imgui.SetVarValue(variables[k][1], variables[k][3]);
  94.         end        
  95.     end
  96.    
  97.     -- Locate map pointer..
  98.     local ptr = mem.FindPattern('nostalex.dat', '8B128942??8BCBB201A1????????E8????????A3????????8BCBB201', 0x14, 0x00);
  99.     if (ptr == 0) then
  100.         error('Failed to locate required map pointer!');
  101.     end
  102.     map_pointer = mem:ReadULong(ptr);
  103. end);
  104.  
  105. ----------------------------------------------------------------------------------------------------
  106. -- func: unload
  107. -- desc: Event called when the addon is being unloaded.
  108. ----------------------------------------------------------------------------------------------------
  109. hook.register_event('unload', function()
  110.     -- Cleanup the custom variables..
  111.     for k, v in pairs(variables) do
  112.         if (variables[k][1] ~= nil) then
  113.             imgui.DeleteVar(variables[k][1]);
  114.         end
  115.         variables[k][1] = nil;
  116.     end
  117. end);
  118.  
  119. ----------------------------------------------------------------------------------------------------
  120. -- func: prerender
  121. -- desc: Event called when BeginScene() is called in Direct3D.
  122. ----------------------------------------------------------------------------------------------------
  123. hook.register_event('prerender', function()
  124.     local show_enemies = imgui.GetVarValue(variables['var_EnableEnemies'][1]);
  125.     local show_npcs = imgui.GetVarValue(variables['var_EnableNpcs'][1]);
  126.     local show_players = imgui.GetVarValue(variables['var_EnablePlayers'][1]);
  127.  
  128.     WriteMapValue(map_show_enemies, show_enemies);
  129.     WriteMapValue(map_show_npcs, show_npcs);
  130.     WriteMapValue(map_show_players, show_players);
  131. end);
  132.  
  133. ----------------------------------------------------------------------------------------------------
  134. -- func: render
  135. -- desc: Event called when EndScene() is called in Direct3D.
  136. ----------------------------------------------------------------------------------------------------
  137. hook.register_event('render', function()
  138.     -- Do not render the UI if it was hidden..
  139.     if (imgui.GetVarValue(variables['var_ShowMapHacksWindow'][1]) == false) then
  140.         return;
  141.     end
  142.    
  143.     -- Render the UI..
  144.     imgui.SetNextWindowSize(200, 100, ImGuiSetCond_Always);
  145.     if (not imgui.Begin('Map Hacks', variables['var_ShowMapHacksWindow'][1], imgui.bor(ImGuiWindowFlags_NoResize))) then
  146.         imgui.End();
  147.         return;
  148.     end
  149.     imgui.Checkbox('Show Enemies', variables['var_EnableEnemies'][1]);
  150.     imgui.Checkbox('Show NPCs', variables['var_EnableNpcs'][1]);
  151.     imgui.Checkbox('Show Players', variables['var_EnablePlayers'][1]);    
  152.     imgui.End();
  153. end);
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.com/cgi-bin/webscr?c ... Q2GRT6KUJN
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest