LUA 172
+++ Halo 1.10 Addresses and offsets (and some usage) +++ By xdedeone on 25th February 2019 11:18:36 PM
  1. api_version = "1.10.0.0"
  2. ce, client_info_size = 0x40, 0xEC
  3.  
  4. function OnScriptLoad()end
  5. function OnScriptUnload() end
  6.  
  7. function game_addresses()
  8.         if halo_type == "PC" then ce, client_info_size = 0x0, 0x60 end
  9.         stats_header = 0x5BD720 -- Confirmed.
  10.         stats_globals = read_dword(sig_scan("33C0BF??????00F3AB881D") + 0x3) -- Confirmed. (Thanks Giraffe)
  11.         ctf_globals = 0x5BDB98 -- Confirmed.
  12.         slayer_globals = 0x5BE0E8 -- Confirmed,
  13.         oddball_globals = 0x5BDE58 -- Confirmed.
  14.         koth_globals = 0x5BDBD0 -- Confirmed.
  15.         race_globals = 0x5BDFA0 -- Confirmed.
  16.         race_locs = 0x5F5078 -- Confirmed.
  17.         map_pointer = 0x5B925C -- Confirmed.
  18.         gametype_base = 0x5F5478 -- Confirmed.
  19.         network_struct = read_dword(sig_scan("F3ABA1????????BA????????C740??????????E8????????668B0D") + 3) -- Confirmed (Thanks Wizard)
  20.         camera_base = 0x620734 -- Confirmed.
  21.         player_globals = 0x6E1458 -- Confirmed.
  22.         player_header_pointer = read_dword(sig_scan("DDD8A1??????008944244835") + 0x3) -- Confirmed (Thanks Giraffe)
  23.         object_header_pointer = read_dword(sig_scan("8B0D????????8B513425FFFF00008D") + 2) -- Confirmed. (Thanks 002)
  24.         collideable_objects_pointer = 0x6C69F4 -- Confirmed.
  25.         map_header_base = 0x6E2C84 -- Confirmed.
  26.         banlist_header = 0x5C5280 -- Confirmed.
  27.         game_globals = nil -- Don't care.
  28.         gameinfo_header = read_dword(sig_scan("A1????????8B480C894D00") + 0x1) -- Confirmed. (Thanks Wizard)
  29.         mapcycle_header = 0x598A8C -- Confirmed
  30.         network_server_globals = 0x61FB44 -- Confirmed.
  31.         hash_table_base = 0x5AFB14 -- Untested.
  32.  
  33.         -- Strings (Thanks to Giraffe for all the sigs in this section!)
  34.         broadcast_version_address = read_dword(sig_scan("751768??????0068??????00BA") + 0x3) -- Confirmed.
  35.         version_info_address = nil -- Don't care.
  36.         broadcast_game_address = read_dword(sig_scan("CCCCBA??????002BD08A08") + 0x3) -- Confirmed (halor = PC, halom = CE)
  37.         server_ip_argument = read_dword(sig_scan("BA??????008BC72BD78A08880C024084C975F68B442404") + 0x1) -- Confirmed.
  38.         server_port_address = read_dword(sig_scan("668B0D??????000BF2C605") + 0x3) -- Confirmed.
  39.         server_path_address = read_dword(sig_scan("0000BE??????005657C605") + 0x3) -- Confirmed.
  40.         computer_name_address = read_dword(sig_scan("68??????0068??????0068000401006A00") + 0x1) -- Confirmed
  41.         profile_path_address = read_dword(sig_scan("68??????008D54245468") + 0x1) -- Confirmed.
  42.         map_name_address =read_dword(sig_scan("66A3??????00890D??????00C3") + 0x2) -- Confirmed. (Full name)
  43.         hardware_info_address = read_dword(sig_scan("BE??????008BC68B4DF064890D000000005F5E5B8BE55DC36A0C") + 0x1) -- Confirmed.
  44.         map_name_address2 = read_dword(sig_scan("B8??????00E8??????0032C983F813") + 0x1) -- Confirmed. (File name)
  45.         server_password_address = read_dword(sig_scan("F3ABA3??????00A3??????00A2??????00C705") + 0x3) -- Confirmed.
  46.         logfile_path_address = read_dword(sig_scan("740ABB????5C00E8????0300") + 0x3) -- Confirmed. (CE Only)
  47.         banlist_path_address = read_dword(sig_scan("68??????00E8??????0083C41068") + 0x1) -- Confirmed.
  48.         banlist_path_address2 = read_dword(sig_scan("CCCCC605??????0000E8??????0085C0") + 0x4) -- Confirmed.
  49.         rcon_password_address = read_dword(sig_scan("7740BA??????008D9B000000008A01") + 0x3) -- Confirmed.
  50.  
  51.         -- Patches
  52.         rcon_failed_address = read_dword(sig_scan("B8????????E8??000000A1????????55") + 1) -- Found by 002
  53.         kill_message_address = read_dword(sig_scan("8B42348A8C28D500000084C9") + 3) -- Found by sehe (Write to 0x03EB01B1)
  54.         color_patch1 = read_char(sig_scan("741F8B482085C9750C")) -- Found by 002 (Write to 235 if not 0)
  55.         color_patch2 = read_char(sig_scan("EB1F8B482085C9750C")) -- Found by 002 (Write to 235)
  56.  
  57.         -- Other
  58.         gravity_global = 0x637BE4 -- Found by 002
  59.         game_over_state_address_sig = sig_scan("C705????????03??????75??C6") -- Found by 002
  60. end
  61.  
  62. function get_ban_data()
  63.         local banlist_size = read_dword(banlist_header)
  64.         local banlist_base = read_dword(banlist_header + 0x4)
  65.         for i = 1,banlist_size do
  66.                 ban_index_struct = banlist_base + ((i-1) * 0x44)
  67.                 ban_name = read_widestring(ban_index_struct, 12)
  68.                 ban_hash = read_widestring(ban_index_struct + 0x1A, 32)
  69.                 ban_expired = read_bit(ban_index_struct + 0x3A, 0)
  70.                 ban_count = read_word(ban_index_struct + 0x3C)
  71.                 ban_indefinitely = read_bit(ban_index_struct + 0x3E, 0)
  72.                 ban_end_date = read_dword(ban_index_struct + 0x40)
  73.         end
  74. end
  75.  
  76. function mapcycle_data()
  77.         local mapcycle_pointer = read_dword(mapcycle_header)
  78.         local mapcycle_size = read_dword(mapcycle_header + 0x4) -- Number of options in the mapcycle.
  79.         local mapcycle_allocated = read_dword(mapcycle_header + 0x8) -- Number of active options in the mapcycle.
  80.         local mapcycle_index = read_dword(mapcycle_header + 0xC) -- Current mapcycle index.
  81.         for i = 0,mapcycle_size-1 do
  82.                 local mapcycle_index_gametype = read_widestring(mapcycle_pointer + i * 0xE4 + 0xC, 22) -- Gametype name of the mapcycle index.
  83.         end
  84.         local mapcycle_current_map = read_string(read_dword(mapcycle_pointer)) -- Real name of the map.
  85.         local mapcycle_current_gametype = read_string(read_dword(mapcycle_pointer + 0x4)) -- Gametype as typed in init. (Ex: sv_map ratrace SlAyEr)
  86.         local mapcycle_current_gametype2 = read_widestring(mapcycle_pointer + 0xC, 22) -- Full name of gametype. (Ex: Slayer)
  87. end
  88.  
  89. function game_type()
  90.         -- Gametype Name
  91.         local gametype_name = read_widestring(gametype_base, 0x2C) -- Custom name of gametype.
  92.         -- Gametype Options
  93.         local team_play = read_byte(gametype_base + 0X34) -- 0 = False | 1 = True
  94.         local gametype_game = read_byte(gametype_base + 0X30) -- Listed in order below with settings.
  95.         local gametype_timelimit = read_dword(gametype_base + 0x78) -- 1 Second = 30
  96.         local gametype_scorelimit = read_byte(gametype_base + 0x58) -- Number
  97.         if gametype_game == 1 then -- 1 = CTF
  98.                 local assualt = read_byte(gametype_base + 0x7C) -- 0 = False | 1 = True
  99.                 local flag_must_reset = read_byte(gametype_base + 0x7E) -- 0 = False | 1 = True
  100.                 local flag_at_home_to_score = read_byte(gametype_base + 0x7F) -- 0 = False | 1 = True
  101.                 local single_flag_reset_time = read_dword(gametype_base + 0x80) -- 1 Second = 30
  102.         elseif gametype_game == 2 then -- 2 = Slayer
  103.                 local death_bonus = read_byte(gametype_base + 0x7C) -- 0 = False | 1 = True
  104.                 local kill_penalty = read_byte(gametype_base + 0x7D) -- 0 = False | 1 = True
  105.         elseif gametype_game == 3 then -- 3 = Oddball
  106.                 local oddball_type = read_byte(gametype_base + 0x8C) -- 0 = Normal | 1 = Reverse Tag | 2 = Juggernaut
  107.                 local speed_with_ball = read_byte(gametype_base + 0x80) -- 0 = Slow | 1 = Normal | 2 = Fast
  108.                 local trait_with_ball = read_byte(gametype_base + 0x84) -- 0 = None | 1 = Invisable | 2 = Extra Damage | 3 = Damage Resistant
  109.                 local trait_without_ball = read_byte(gametype_base + 0x88) -- Same as above.
  110.                 local oddball_spawn_count = read_byte(gametype_base + 0x90) -- Unknown
  111.         elseif gametype_game == 4 then -- 4 = King of the hill
  112.                 local moving_hill = read_byte(gametype_base + 0x7C) -- 0 = False | 1 = True
  113.         elseif gametype_game == 5 then -- 5 = Race
  114.                 local race_type = read_byte(gametype_base + 0x7C) -- 0 = Normal | 1 = Any Order | 2 = Rally
  115.                 local team_scoring = read_byte(gametype_base + 0x80) -- 0 = Min | 1 = Max | 2 = Sum
  116.         end
  117.         -- Player Options
  118.         local number_of_lives = read_byte(gametype_base + 0x50) -- 0 = Unlimited
  119.         local max_health = read_float(gametype_base + 0x54) -- Untested
  120.         local sheilds = read_bit(gametype_base + 0x38, 3) -- 1 = False | 0 = True ?? WHY THE FUCK?
  121.         local respawn_time = read_byte(gametype_base + 0x48) -- 1 Second = 30
  122.         local respawn_time_growth = read_byte(gametype_base + 0x44) -- 1 Second = 30
  123.         local odd_man_out = read_byte(gametype_base + 0x40) -- 0 = False | 1 = True
  124.         local invisable_players = read_bit(gametype_base + 0x38, 4) -- 0 = False | 1 = True
  125.         local suicide_penalty = read_byte(gametype_base + 0x4C) -- 1 Second = 30
  126.         -- Item Options
  127.         local infite_grenades = read_bit(gametype_base + 0x38, 2) -- 0 = False | 1 = True
  128.         local weapon_set = read_byte(gametype_base + 0x5C) -- 0 = Normal | 1 = Pistols | 2 = Rifles | 3 = Plasma | 4 = Snipers | 5 = No Snipers | 6 = Rockets | 7 = Shotguns | 8 = Short Range | 9 = Human | 10 = Covenent | 11 = Classic | 12 = Heavy
  129.         local starting_equipment = read_bit(gametype_base + 0x38, 5) -- 0 = Custom | 1 = Generic
  130.         -- Vehicle Options
  131.         local red_vehicles = read_dword(gametype_base + 0x60) -- Unknown
  132.         local blue_vehicles = read_dword(gametype_base + 0x64) -- Unknown
  133.         local Vehicle_respawn_time = read_dword(gametype_base + 0x68) -- 1 Second = 30
  134.         -- Indicator Options
  135.         local gametype_indicator = read_byte(gametype_base + 0x3C) -- 0 = Motion Tracker | 1 = Nav Points | 2 = None
  136.         local only_friendlys_on_radar = read_bit(gametype_base + 0x38, 6) -- 0 = False | 1 = True
  137.         local all_players_on_radar = read_bit(gametype_base + 0x38, 0) -- 0 = False | 1 = True
  138.         local friendly_indicators = read_bit(gametype_base + 0x38, 1) -- 0 = False | 1 = True
  139.         -- Team Options
  140.         local friendly_fire = read_byte(gametype_base + 0x6C) -- 0 = False | 1 = True
  141.         local friendly_fire_penalty = read_byte(gametype_base + 0x70) -- 1 Second = 30
  142.         local auto_balance = read_byte(gametype_base + 0x74) -- 0 = False | 1 = True
  143. end
  144.  
  145. function NetworkStruct(PlayerIndex) -- Stuff regarding the player Wizard had wrong.
  146.     local client_machineinfo_struct = network_struct + 0x3B8 + ce + to_real_index(PlayerIndex) * client_info_size
  147.         local crouch_key = read_bit(client_machineinfo_struct + 0x24, 0) -- 0 = False | 1 = True
  148.     local jump_key = read_bit(client_machineinfo_struct + 0x24, 1) -- 0 = False | 1 = True
  149.     --unknownbit(24, 2)(24, 3)
  150.     local flashlight_key = read_bit(client_machineinfo_struct + 0x24, 4) -- 0 = False | 1 = True
  151.     local action_key = read_bit(client_machineinfo_struct + 0x24, 6) -- 0 = False | 1 = True | Action (E) & Swap Weapon (X - Lags)
  152.     local melee_key = read_bit(client_machineinfo_struct + 0x24, 7) -- 0 = False | 1 = True
  153.     --unknownbit(24, 8)(25, 0)(25, 1)
  154.     local reload_key = read_bit(client_machineinfo_struct + 0x25, 2) -- 0 = False | 1 = True | Reload (R)
  155.     local primary_fire = read_bit(client_machineinfo_struct + 0x25, 3) -- 0 = False | 1 = True
  156.     local secondary_fire = read_bit(client_machineinfo_struct + 0x25, 4) -- 0 = False | 1 = True
  157.     local secondary_fire2 = read_bit(client_machineinfo_struct + 0x25, 5) -- 0 = False | 1 = True
  158.     local swap_weapon = read_bit(client_machineinfo_struct + 0x25, 6) -- 0 = False | 1 = True | Swap Weapon (X)
  159.     --unknownbit(25, 7)(25, 8)
  160.     local nade_type = read_bit(client_machineinfo_struct + 0x4A, 0) -- 0 = Frag | 1 = Plasma
  161.     local zoom_level = read_char(client_machineinfo_struct + 0x4C) -- -1 = None | 0 = 2x | 1 = 8x
  162. end
  163.  
  164. -- Custom function(s)
  165.  
  166. function player() -- Player Only
  167.         local m_player = get_player(PlayerIndex)
  168.         -- Stats
  169.         local stats_base = stats_globals + to_real_index(PlayerIndex) * 0x30
  170.         local player_ingame = read_byte(stats_base) -- 1 = true 0 = false
  171.         local player_dword_id = read_dword(stats_base + 0x4)
  172.         local player_kills = read_word(stats_base + 0x8)
  173.         local player_assists = read_word(stats_base + 0x10)
  174.         local player_betrays = read_word(stats_base + 0x18)
  175.         local player_deaths = read_word(stats_base + 0x1A)
  176.         local player_suicides = read_word(stats_base + 0x1C)
  177.  
  178.                 -- Gametype specific
  179.                 -- (CTF = Flag steals) (KOTH = Hill time) (Race = Time)
  180.                 local player_gametype_stats = read_word(stats_base + 0x1E)
  181.                 -- (CTF = Flag returns) (ODDBALL = Tragets killed vs jug), (RACE = laps)
  182.                 local player_gametype_stats2 = read_word(stats_base + 0x20)
  183.                 -- (CTF = Flag scores) (ODDBALL = Kills as jug) (RACE = Best lap)
  184.                 local player_gametype_stats3 = read_word(stats_base + 0x22)
  185.  
  186.                 local player_in_hill = read_byte(koth_globals + to_real_index(PlayerIndex) + 0x80)
  187.  
  188.                 local oddball_base = oddball_globals + to_real_index(PlayerIndex) * 4
  189.                 local player_oddball_score = read_dword(oddball_base + 0x44)
  190.                 local player_holding_ball = read_dword(oddball_base + 0xC4)
  191.                 local player_time_with_ball = read_dword(oddball_base + 0x104)
  192.  
  193.                 local player_current_checkpoint = read_dword(race_globals + to_real_index(PlayerIndex) * 4 + 0x44)
  194.  
  195.                 local player_slayer_score = read_dword(slayer_globals + to_real_index(PlayerIndex) * 4 + 0x40)
  196.  
  197.         -- Camera
  198.         local camera_struct = camera_base + to_real_index(PlayerIndex) * 0x30
  199.         local xy = read_float(camera_struct)
  200.         local z = read_float(camera_struct + 0x4)
  201.         local x_aim = read_float(camera_struct + 0x1C)
  202.         local y_aim = read_float(camera_struct + 0x20)
  203.         local z_aim = read_float(camera_struct + 0x24)
  204.  
  205.         -- Player
  206.         local player_menu = read_word((m_player - 0xD) + 1) -- 0 = In server 1 = At menu (ui.map)
  207.         local player_word_id = read_word(m_player)
  208.         local player_host = read_word(m_player + 0x2) -- Setting this to 1 will stop the server from sending location updates to them.
  209.         local player_name = read_widestring(m_player + 0x4, 12) -- Name captured with 'pl' command.
  210.         local player_team = read_byte(m_player + 0x20)
  211.  
  212.                 -- Interactions
  213.                 local player_interaction_object_id = read_dword(m_player + 0x24)
  214.                 local player_interaction_object_type = read_word(m_player + 0x28) -- 7 = weapon, 8 = Vehicle
  215.                 local player_interaction_vehicle_seat = read_word(m_player + 0x2A)
  216.  
  217.                 -- Respawn times
  218.                 local player_respawn_time = read_dword(m_player + 0x2C)
  219.                 local player_respawn_time_growth = read_dword(m_player + 0x30)
  220.  
  221.                 -- Objects
  222.                 local player_object_id = read_dword(m_player + 0x34)
  223.                 local player_last_object_id = read_dword(m_player + 0x38)
  224.  
  225.         local player_weapon_pickup = read_dword(m_player + 0x3E) -- 1 = true, 0 = false
  226.         local player_tickcount_last_shot = read_dword(m_player + 0x44) -- Last gametime tick the player shot.
  227.         local player_name2 = read_widestring(m_player + 0x48, 12)
  228.         local player_color = read_word(m_player + 0x60)
  229.         local player_machine_index = read_byte(m_player + 64) -- Same as to_player_index
  230.         local player_spawned_team = read_byte(m_player + 0x66) -- Team the player spawned on.
  231.         local player_index = read_byte(m_player + 0x67) -- Same as to_real_index
  232.  
  233.                 -- Timed powerups.
  234.                 -- For times 1 second = 30 ticks. (This means divide these values by 30 to get the time in seconds.)
  235.                 local camo_timer = read_word(m_player + 0x68) -- Time until player is no longer camouflaged.
  236.                 local full_spec_timer = read_word(m_player + 0x6A) -- Time until player no longer has full spectrum vision.
  237.  
  238.         local player_speed_multiplier = read_float(m_player + 0x6C) -- This is what sapp uses for setting player speeds.
  239.         local player_objective_mode = read_dword(m_player + 0x74)
  240.         local player_target_player = read_dword(m_player + 0x7C)
  241.         local player_target_time = read_dword(m_player + 0x80)
  242.         local player_slayer_target = read_dword(m_player + 0x88) -- Enemy player who gets the objective marker above their head.
  243.         local player_oddman_out = read_bit(m_player + 0x8C, 0)
  244.         local player_kill_steak = read_word(m_player + 0x96) -- Killing spree, Running riot, ect.
  245.         local player_kill_multiplier = read_word(m_player + 0x98)  -- Double kill, Triple Kill, ect.
  246.         local player_tickcount_last_kill = read_word(m_player + 0x9A) -- Last gametime tick the player got a kill.
  247.  
  248.                 -- Stats 2
  249.                 local player_kills2 = read_word(m_player + 0x9C)
  250.                 local player_assists2 = read_word(m_player + 0xA4)
  251.                 local player_betrays2 = read_word(m_player + 0xAC) -- Betrays + Suicides
  252.                 local player_deaths2 = read_word(m_player + 0xAE)
  253.                 local player_suicides2 = read_word(m_player + 0xB0)
  254.                 local player_teamkills = read_word(m_player + 0xC0)
  255.  
  256.                         -- Gametype specific 2
  257.                         -- (CTF = Flag steals) (KOTH = Hill time) (Race = Time)
  258.                         local player_gametype_stats_2 = read_word(m_player + 0xC4)
  259.                         -- (CTF = Flag returns) (ODDBALL = Tragets killed vs jug), (RACE = laps)
  260.                         local player_gametype_stats2_2 = read_word(m_player + 0xC6)
  261.                         -- (CTF = Flag scores) (ODDBALL = Kills as jug) (RACE = Best lap)
  262.                         local player_gametype_stats3_2 = read_word(m_player + 0xC8)
  263.  
  264.         local player_telefrag_timer = read_dword(m_player + 0xCC) -- Time spent blocking teleporter.
  265.         local player_quit_time = read_dword(m_player + 0xD0)
  266.         local player_ping = read_dword(m_player + 0xDC)
  267.         local player_teamkill_count = read_dword(m_player + 0xE0)
  268.         local player_teamkill_timer = read_dword(m_player + 0xE4) -- Time since last betray.
  269.         local player_local_update_count = read_word(m_player + 0xE8) -- Tick (0-32) since the players local position was updated.
  270.  
  271.         local x, y, z = read_vector3d(m_player + 0xF8) -- Player's biped coords. (DS only)
  272.  
  273.                         -- Baseline updates (update every 3-6 seconds by default.)
  274.                         -- Tied to the following server console commands.
  275.                                 -- DS Side.
  276.                                 local player_melee_key = read_bit(m_player + 0x11C, 0)
  277.                                 local player_action_key = read_bit(m_player + 0x11C, 1)
  278.                                 local player_flashlight_key = read_bit(m_player + 0x11C, 3)
  279.                                 local player_reload_key = read_bit(m_player + 0x11D, 5)
  280.  
  281.                                 local player_xy_aim = read_float(m_player + 0x138)
  282.                                 local player_z_aim = read_float(m_player + 0x13C)
  283.                                 local player_forward = read_float(m_player + 0x140)
  284.                                 local player_left = read_float(m_player + 0x144)
  285.                                 local player_rate_of_fire = read_float(m_player + 0x148)
  286.                                 local player_weapon_slot = read_byte(m_player + 0x14C)
  287.                                 local player_nade_type = read_byte(m_player + 0x14E)
  288.                                 local player_x_aim2 = read_float(m_player + 0x154)
  289.                                 local player_y_aim2 = read_float(m_player + 0x158)
  290.                                 local player_z_aim2 = read_float(m_player + 0x15C)
  291.                                 local x, y, z = read_vector3d(m_player + 0x170) -- Player coords.
  292.                                
  293.                         -- Client side addresses (These are mapped better probably)
  294.                                 local player_crouch_hold = read_bit(m_player + 0xF4, 0) -- Current crouch state.
  295.                                 local player_flashlight = read_bit(m_player + 0xF4, 4) -- Current flashlight press.
  296.                                 local player_action_press = read_bit(m_player + 0xF4, 6) -- Current action press.
  297.                                 local player_melee_press = read_bit(m_player + 0xF4, 7) -- Current melee press.
  298.                                 local player_reload_press = read_bit(m_player + 0xF5, 2) -- Current reload press.
  299.                                 local player_attack_hold = read_bit(m_player + 0xF5, 3) -- Current attack hold.
  300.                                 local player_secondary_attack_hold = read_bit(m_player + 0xF5, 4) -- Current secondary attack hold.
  301.                                 local player_secondary_attack_hold_2 = read_bit(m_player + 0xF5, 5) -- Current secondary attack hold.
  302.                                 local player_action_swap_hold = read_bit(m_player + 0xF5, 5) -- Current action/swap hold.
  303.                                
  304.                                 local player_forward = read_float(m_player + 0x100) -- Current baseline forward/back speed.
  305.                                 local player_left = read_float(m_player + 0x104) -- Current baseline left/right speed.
  306.                                 local player_weapon_slot = read_byte(m_player + 0x10C) -- Current player weapon slot.
  307.                                 local x_aim, y_aim, z_aim = read_vector3d(m_player + 0x114) -- Current baseline vector aim.
  308.                                 local player_aim_yaw = read_float(m_player + 0x140) -- Current baseline player yaw.
  309.                                 local player_aim_pitch = read_float(m_player + 0x144) -- Current baseline player pitch.
  310.                                 local player_forward_2 = read_float(m_player + 0x148) -- Current baseline forward/back speed.
  311.                                 local player_left_2 = read_float(m_player + 0x14C) -- Current baseline left/right speed.
  312.                                 local player_rof = read_float(m_player + 0x150) -- Current baseline rate of fire.
  313.                                 local player_weapon_slot = read_byte(m_player + 0x154) -- Current baseline weapon slot.
  314.                                 local player_nade_slot = read_byte(m_player + 0x156) -- Current baseline nade type.
  315.                                 local x, y, z = read_vector3d(m_player + 0x164) -- Current baseline location.
  316. end
  317.  
  318. function player_object() -- Object (Player, Vehicle, Projectile, Ect)
  319.         local m_object = get_dynamic_player(PlayerIndex)
  320.         local m_objectId = read_dword(get_player(PlayerIndex) + 0x34)
  321.  
  322.         local object_tag_id = read_dword(m_object)
  323.         local object_forces_baseline_update = read_bit(m_object + 0x8, 8)
  324.         local object_existance_time = read_dword(m_object + 0xC)
  325.         local object_has_no_collision = read_bit(m_object + 0x10, 0)
  326.         local object_in_contact_with_bsp = read_bit(m_object + 0x10, 1)
  327.         local object_ignores_gravity = read_bit(m_object + 0x10, 2)
  328.         local object_in_water = read_bit(m_object + 0x10, 3)
  329.         local object_is_stationary = read_bit(m_object + 0x10, 5)
  330.         local object_has_no_collision2 = read_bit(m_object + 0x10, 7)
  331.         local object_garbage_bit = read_bit(m_object + 0x12, 0)
  332.         local object_does_not_cast_shadow = read_bit(m_object + 0x12, 2)
  333.         local object_outside_map = read_bit(m_object + 0x12, 5)
  334.         local Object_has_no_collision3 = read_bit(m_object + 0x13, 0) -- Does not apply to vehicles
  335.  
  336.                 local x3, y3, z3 = read_vector3d(m_object + 0x5c)
  337.                 local object_x_velocity = read_float(m_object + 0x68)
  338.                 local object_y_velocity = read_float(m_object + 0x6C)
  339.                 local object_z_velocity = read_float(m_object + 0x70)
  340.                 local object_pitch = read_float(m_object + 0x74) -- Vector
  341.                 local object_yaw = read_float(m_object + 0x78) -- Vector
  342.                 local object_roll = read_float(m_object + 0x7C) -- Vector
  343.                 local object_x_scale = read_float(m_object + 0x80)
  344.                 local object_y_scale = read_float(m_object + 0x84)
  345.                 local object_z_scale = read_float(m_object + 0x88)
  346.                 local object_pitch_velocity = read_float(m_object + 0x8C)
  347.                 local object_yaw_velocity = read_float(m_object + 0x90)
  348.                 local object_roll_velocity = read_float(m_object + 0x94)
  349.                 local object_location_id = read_dword(m_object + 0x98) -- There's a lot of these.
  350.  
  351.                 local x4, y4, z4 = read_vector3d(m_object + 0xA0) -- Objects center (Player pelvis.)
  352.                 local object_radius = read_float(m_object + 0xAC)
  353.                 local object_scale = read_float(m_object + 0xB0) -- Hitbox scale (from objects center.)
  354.  
  355.         -- (0 = Biped) (1 = Vehicle) (2 = Weapon) (3 = Equipment) (4 = Garbage)
  356.         -- (5 = Projectile) (6 = Scenery) (7 = Machine) (8 = Control)
  357.         -- (9 = Light Fixture) (10 = Placeholder) (11 = Sound Scenery)
  358.         local object_type = read_word(m_object + 0xB4)
  359.         local object_gametype_objective = read_word(m_object + 0xB8)
  360.         local object_player_id = read_dword(m_object + 0xC0)
  361.         local object_owner_id = read_dword(m_object + 0xC4) -- Parent/Owner objectId
  362.         local object_max_health = read_float(m_object + 0xD8)
  363.     local object_max_shields = read_float(m_object + 0xDC)
  364.     local object_health = read_float(m_object + 0xE0)
  365.     local object_shields = read_float(m_object + 0xE4) -- (0 to 3) (Normal = 1) (Full overshield = 3)
  366.     local object_current_shield_damage = read_float(m_object + 0xE8)
  367.         local object_current_damage = read_float(m_object + 0xEC)
  368.         local object_last_shield_damage_ammount = read_float(m_object + 0xF4)
  369.         local object_last_damage_ammount = read_float(m_object + 0xF8)
  370.         local object_last_shield_damage_time = read_float(m_object + 0xFC)
  371.         local object_last_damage_time = read_float(m_object + 0x100)
  372.         local object_shields_recharge_time = read_float(m_object + 0x104)
  373.         local object_cannot_take_damage = read_bit(m_object + 0x106, 11)
  374.         local object_shields_recharging = read_bit(m_object + 0x106, 12)
  375.         local object_weapon_object_id = read_dword(m_object + 0x118) -- WeaponId
  376.         local object_vehicle_object_id = read_dword(m_object + 0x11C) -- VehicleId
  377.         local object_forces_shield_update = read_bit(m_object + 0x122, 0)
  378.         local object_shields_hit = read_float(m_object + 0x124)
  379.         local object_flashlight_scale = read_float(m_object + 0x12C)
  380.  
  381.                 local unit_is_invisible = read_bit(m_object + 0x204, 4) -- Confirmed. (True if currently invisible, False if not)
  382.                 local unit_flashlight = read_bit(m_object + 0x206, 3)
  383.                 local unit_wont_drop_items = read_bit(m_object + 0x206, 4)
  384.                 local unit_is_suspended = read_bit(m_object + 0x207, 0)
  385.                 -- There is more to come.
  386.        
  387.         local weapon_slot_2 = read_byte(m_object + 0x2A1) -- Current player weapon slot.
  388.         local weapon_slot_3 = read_byte(m_object + 0x2F2) -- Current player weapon slot. (Read only)
  389.  
  390.  
  391.  
  392. end
  393.  
  394. function player_vehicle() -- Vehicle only
  395.         local m_object = get_dynamic_player(PlayerIndex)
  396.         local m_vehicle = get_object_memory(read_dword(m_object + 0x11C))
  397.  
  398.  
  399.         -- I think theses are the three levitation points?
  400.         local ghost_x_coord = read_float(m_vehicle + 0x5E8)
  401.         local ghost_y_coord = read_float(m_vehicle + 0x5EC)
  402.         local ghost_z_coord = read_float(m_vehicle + 0x5F0)
  403.  
  404.         local ghost_x_coord2 = read_float(m_vehicle + 0x684)
  405.         local ghost_y_coord2 = read_float(m_vehicle + 0x688)
  406.         local ghost_z_coord2 = read_float(m_vehicle + 0x68C)
  407.  
  408.         local ghost_x_coord3 = read_float(m_vehicle + 0x6B8)
  409.         local ghost_y_coord3 = read_float(m_vehicle + 0x6BC)
  410.         local ghost_z_coord3 = read_float(m_vehicle + 0x6C0)
  411.  
  412. end
  413.  
  414. function get_object_info()
  415.         local object_table = read_dword(object_header_pointer)
  416.         local object_count = read_word(object_table + 0x2E)
  417.         local first_object = read_dword(object_table + 0x34)
  418.         for i = 0,object_count-1 do
  419.                 local object = read_dword(first_object + i * 0xC + 0x8)
  420.                 if object ~= 0 and object ~= 0xFFFFFFFF then
  421.                         local object_type = read_word(object + 0xB4) -- (0 = Biped) (1 = Vehicle) (2 = Weapon) (3 = Equipment) (4 = Garbage) (5 = Projectile) (6 = Scenery) (7 = Machine) (8 = Control) (9 = Light Fixture) (10 = Placeholder) (11 = Sound Scenery)
  422.                         if object_type = 3 then
  423.                                 local equip_existane_time = read_word(object + 0x32c) -- (1 sec = 30 ticks) counting tied to objects incremental rate.
  424.                         end
  425.                 end
  426.         end
  427. end
  428.  
  429. function get_random_player(New_Team, Kill)
  430.         local players, count = {}, 1
  431.         for i = 1,16 do
  432.                 if player_present(i) then
  433.                         if New_Team then
  434.                                 if get_team(i) ~= New_Team then
  435.                                         players[count], count = i, count + 1
  436.                                 end
  437.                         else
  438.                                 players[count], count = i, count + 1
  439.         end     end     end
  440.         if #players > 1 then
  441.                 local PlayerIndex = players(rand(1, #players))
  442.                 set_team(PlayerIndex, New_Team, Kill)
  443.         end
  444. end
  445.  
  446. function get_tag(class, path) -- By 002
  447.     local tagarray = read_dword(0x40440000)
  448.     for i = 0,read_word(0x4044000C)-1 do
  449.         local tag = tagarray + i * 0x20
  450.         local tagclass = string.reverse(string.sub(read_string(tag),1,4))
  451.         if tagclass == class then
  452.             if(read_string(read_dword(tag + 0x10)) == path) then return read_dword(tag + 0xC) end
  453.         end
  454.     end
  455.     return nil
  456. end
  457.  
  458. function get_team(PlayerIndex)
  459.         local m_player = get_player(PlayerIndex)
  460.         if m_player then
  461.                 return read_byte(m_player + 0x20)
  462.         end
  463.         return nil
  464. end
  465.  
  466. function get_name(PlayerIndex)
  467.         if player_present then
  468.                 return get_var(PlayerIndex, "$name")
  469.         end
  470.         return nil
  471. end
  472.  
  473. function set_speed(PlayerIndex, Speed)
  474.         local m_player = get_player(PlayerIndex)
  475.         if m_player then
  476.                 write_float(m_player + 0x6c, Speed)
  477.         end
  478. end
  479.  
  480. function set_spawn_time(PlayerIndex, Time)
  481.         local m_player = get_player(PlayerIndex)
  482.         if m_player then
  483.                 write_dword(m_player + 0x2C, Time + 30)
  484.         end
  485. end
  486.  
  487. function set_color(PlayerIndex, Color)
  488.         local m_player = get_player(PlayerIndex)
  489.         if m_player then
  490.                 write_word(m_player + 0x60, Color)
  491.         end
  492. end
  493.  
  494. function set_team(PlayerIndex, New_Team, Kill)
  495.         local m_player = get_player(PlayerIndex)
  496.         if m_player then
  497.                 write_byte(m_player + 0x20, New_Team)
  498.                 if Kill then kill(PlayerIndex) end
  499.         end
  500. end
  501.  
  502. function set_navs(PlayerIndex)
  503.         local Target = nil
  504.         for i = 1,16 do
  505.                 local m_player = get_player(i)
  506.                 if m_player then
  507.                         if PlayerIndex == nil then
  508.                                 Target = to_real_index(i)
  509.                         else
  510.                                 Target = to_real_index(PlayerIndex)
  511.                         end
  512.                         write_word(m_player + 0x88, Target)
  513.                 end
  514.         end
  515. end
  516.  
  517. function read_widestring(address, length)
  518.     local count = 0
  519.     local byte_table = {}
  520.     for i = 1,length do -- Reads the string.
  521.                 if read_byte(address + count) == 00 then count = count + 1 end
  522.         byte_table[i] = string.char(read_byte(address + count))
  523.         count = count + 1
  524.     end
  525.     return table.concat(byte_table)
  526. end

HaloNet.Net is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.