Advertisement
it300

Halo 1.10 Addresses (and some usage)

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