Advertisement
th3w1zard1

Addresses and Offsets for Halo PC/CE

Apr 29th, 2012 (edited)
5,992
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 146.25 KB | Software | 0 0
  1. -- Addresses and Offsets
  2. -- Created by Wizard.
  3. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  4. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  5. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  6. --DO NOT DOWNLOAD THIS SCRIPT. YOU SHOULD BE VISITING THIS PAGE WHENEVER YOU NEED AN OFFSET.
  7. --THIS PAGE IS UPDATED FREQUENTLY, IF YOU DOWNLOAD THIS YOU WILL HAVE  AN  OUTDATED COPY.
  8. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  9. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  10. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  11.  
  12. function GetRequiredVersion()
  13.     return 200
  14. end
  15.  
  16. function OnScriptLoad(process, Game, persistent)
  17.  
  18.     GetGameAddresses(Game) -- declare addresses and confirm the game (pc or ce)
  19.     game = Game
  20.     -- gametype info
  21.  
  22.     gametype_name = readwidestring(gametype_base, 0x2C) -- Confirmed. Real name of gametype.
  23.     gametype_game = readbyte(gametype_base + 0x30) -- Confirmed. (CTF = 1) (Slayer = 2) (Oddball = 3) (KOTH = 4) (Race = 5)
  24.     gametype_team_play = readbyte(gametype_base + 0x34) -- Confirmed. (Off = 0) (On = 1)
  25.     --  gametype parameters
  26.         gametype_other_players_on_radar = readbit(gametype_base + 0x38, 0) -- Confirmed. (On = True, Off = False)
  27.         gametype_friends_indicator = readbit(gametype_base + 0x38, 1) -- Confirmed. (On = True, Off = False)
  28.         gametype_infinite_grenades = readbit(gametype_base + 0x38, 2) -- Confirmed. (On = True, Off = False)
  29.         gametype_shields = readbit(gametype_base + 0x38, 3) -- Confirmed. (Off = True, On = False)
  30.         gametype_invisible_players = readbit(gametype_base + 0x38, 4) -- Confirmed. (On = True, Off = False)
  31.         gametype_starting_equipment = readbit(gametype_base + 0x38, 5) -- Confirmed. (Generic = True, Custom = False)
  32.         gametype_only_friends_on_radar = readbit(gametype_base + 0x38, 6) -- Confirmed.
  33.     --  unkBit[7] 0. - always 0?
  34.     gametype_indicator = readbyte(gametype_base + 0x3C) -- Confirmed. (Motion Tracker = 0) (Nav Points = 1) (None = 2)
  35.     gametype_odd_man_out = readbyte(gametype_base + 0x40) -- Confirmed. (No = 0) (Yes = 1)
  36.     gametype_respawn_time_growth = readdword(gametype_base + 0x44) -- Confirmed. (1 sec = 30 ticks)
  37.     gametype_respawn_time = readdword(gametype_base + 0x48) -- Confirmed. (1 sec = 30 ticks)
  38.     gametype_suicide_penalty = readdword(gametype_base + 0x4C) -- Confirmed. (1 sec = 30 ticks)
  39.     gametype_lives = readbyte(gametype_base + 0x50) -- Confirmed. (Unlimited = 0)
  40.     gametype_maximum_health = readfloat(gametype_base + 0x54) -- Confirmed.
  41.     gametype_score_limit = readbyte(gametype_base + 0x58) -- Confirmed.
  42.     gametype_weapons = readbyte(gametype_base + 0x5C) -- Confirmed. (Normal = 0) (Pistols = 1) (Rifles = 2) (Plasma Weapons = 3) (Sniper = 4) (No Sniping = 5) (Rocket Launchers = 6) (Shotguns = 7) (Short Range = 8) (Human = 9) (Convenant = 10) (Classic = 11) (Heavy Weapons = 12)
  43.     gametype_red_vehicles = readdword(gametype_base + 0x60) -- (???) Binary?
  44.     gametype_blue_vehicles = readdword(gametype_base + 0x64) -- (???) Binary?
  45.     gametype_vehicle_respawn_time = readdword(gametype_base + 0x68) -- Confirmed. (1 sec = 30 ticks)
  46.     gametype_friendly_fire = readbyte(gametype_base + 0x6C) -- Confirmed. (Off = 0) (On = 1)
  47.     gametype_friendly_fire_penalty = readdword(gametype_base + 0x70) -- Confirmed. (1 sec = 30 ticks)
  48.     gametype_auto_team_balance = readbyte(gametype_base + 0x74) -- Confirmed. (Off = 0) (On = 1)
  49.     gametype_time_limit = readdword(gametype_base + 0x78) -- Confirmed. (1 sec = 30 ticks)
  50.     gametype_ctf_assault = readbyte(gametype_base + 0x7C) -- Confirmed. (No = 0) (Yes = 1)
  51.         gametype_koth_moving_hill = readbyte(gametype_base + 0x7C) -- Confirmed. (No = 0) (Yes = 1)
  52.         gametype_oddball_random_start = readbyte(gametype_base + 0x7C) -- Confirmed. (No = 0) (Yes = 1)
  53.         gametype_race_type = readbyte(gametype_base + 0x7C) -- Confirmed. (Normal = 0) (Any Order = 1) (Rally = 2)
  54.         gametype_slayer_death_bonus = readbyte(gametype_base + 0x7c) -- Confirmed. (Yes = 0) (No = 1)
  55.     gametype_slayer_kill_penalty = readbyte(gametype_base + 0x7D) -- Confirmed. (Yes = 0) (No = 1)
  56.     gametype_ctf_flag_must_reset = readbyte(gametype_base + 0x7E) -- Confirmed. (No = 0) (Yes = 1)
  57.         gametype_slayer_kill_in_order = readbyte(gametype_base + 0x7E) -- Confirmed. (No = 0) (Yes = 1)
  58.     gametype_ctf_flag_at_home_to_score = readbyte(gametype_base + 0x7F) -- Confirmed. (No = 0) (Yes = 1)
  59.     gametype_ctf_single_flag_time = readdword(gametype_base + 0x80) -- Confirmed. (1 sec = 30 ticks)
  60.         gametype_oddball_speed_with_ball = readbyte(gametype_base + 0x80) -- Confirmed. (Slow = 0) (Normal = 1) (Fast = 2)
  61.         gametype_race_team_scoring = readbyte(gametype_base + 0x80) -- Confirmed. (Minimum = 0) (Maximum = 1) (Sum = 2)
  62.     gametype_oddball_trait_with_ball = readbyte(gametype_base + 0x84) -- Confirmed. (None = 0) (Invisible = 1) (Extra Damage = 2) (Damage Resistant = 3)
  63.     gametype_oddball_trait_without_ball = readbyte(gametype_base + 0x88) -- Confirmed. (None = 0) (Invisible = 1) (Extra Damage = 2) (Damage Resistant = 3)
  64.     gametype_oddball_ball_type = readbyte(gametype_base + 0x8C) -- Confirmed. (Normal = 0) (Reverse Tag = 1) (Juggernaut = 2)
  65.     gametype_oddball_ball_spawn_count = readbyte(gametype_base + 0x90) -- Confirmed.
  66.    
  67.     --stats header (size = 0x178 = 376 bytes)
  68.     --This header is seriously unfinished.
  69.     stats_header_recorded_animations_data = readdword(stats_header + 0x0) -- Confirmed. Pointer to Recorded Animations data table.
  70.     --unkByte[4] 0x4-0x8 (Zero's)
  71.     stats_header_last_decal_location_x = readfloat(stats_header + 0x8) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  72.     stats_header_last_decal_location_y = readfloat(stats_header + 0xC) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  73.     stats_header_last_decal_location_x2 = readfloat(stats_header + 0x10) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  74.     stats_header_last_decal_location_y2 = readfloat(stats_header + 0x14) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  75.     stats_header_last_decal_location_x3 = readfloat(stats_header + 0x18) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  76.     stats_header_last_decal_location_y3 = readfloat(stats_header + 0x1C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  77.     stats_header_last_decal_location_x4 = readfloat(stats_header + 0x20) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  78.     stats_header_last_decal_location_y4 = readfloat(stats_header + 0x24) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  79.     stats_header_last_decal_location_x5 = readfloat(stats_header + 0x28) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  80.     stats_header_last_decal_location_y5 = readfloat(stats_header + 0x2C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  81.     stats_header_last_decal_location_x6 = readfloat(stats_header + 0x30) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  82.     stats_header_last_decal_location_y6 = readfloat(stats_header + 0x34) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  83.     --unkByte[48] 0x38-0x68 (Zero's)
  84.     stats_header_last_decal_location2_x = readfloat(stats_header + 0x68) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  85.     stats_header_last_decal_location2_y = readfloat(stats_header + 0x6C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  86.     stats_header_last_decal_location2_x2 = readfloat(stats_header + 0x70) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  87.     stats_header_last_decal_location2_y2 = readfloat(stats_header + 0x74) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  88.     stats_header_last_decal_location2_x3 = readfloat(stats_header + 0x78) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  89.     stats_header_last_decal_location2_y3 = readfloat(stats_header + 0x7C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  90.     stats_header_last_decal_location2_x4 = readfloat(stats_header + 0x80) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  91.     stats_header_last_decal_location2_y4 = readfloat(stats_header + 0x84) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  92.     stats_header_last_decal_location2_x5 = readfloat(stats_header + 0x88) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  93.     stats_header_last_decal_location2_y5 = readfloat(stats_header + 0x8C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  94.     stats_header_last_decal_location2_x6 = readfloat(stats_header + 0x90) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  95.     stats_header_last_decal_location2_y6 = readfloat(stats_header + 0x94) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  96.     --unkFloat[2] 0x98-0xA0 (???)
  97.     --unkByte[40] 0xA0-0xC8 (Zero's)
  98.     stats_header_decalID_table = readdword(stats_header + 0xC8) -- From Silentk. Pointer to an array of Decal ID's (correlates with LastDecalLocation)
  99.     --unkPointer[1] 0xCC-0xD0 (???)
  100.     --unkByte[20] 0xD0-0xE4 (???)
  101.     stats_header_locationID = readdword(stats_header + 0xE4) -- From Silentk
  102.     stats_header_locationID2 = readdword(stats_header + 0xE8) -- From Silentk
  103.     --unkLong[1] 0xEC-0xF0 (???)
  104.     --unkByte[130] 0xF0-0x172 (Zero's)
  105.     --unkPointer[2] 0x172-0x17A
  106.    
  107.     --mapcycle header
  108.     mapcycle_pointer = readdword(mapcycle_header) -- (???) index * 0xA4 + 0xC + this = something.
  109.     mapcycle_total_indicies = readdword(mapcycle_header + 0x4) -- From DZS. Number of options in the mapcycle.
  110.     mapcycle_total_indicies_allocated = readdword(mapcycle_header + 0x8) -- From Phasor.
  111.     mapcycle_current_index = readdword(mapcycle_header + 0xC) -- Confirmed. Current mapcycle index.
  112.    
  113.     --mapcycle struct
  114.     mapcycle_something = readwidestring(mapcycle_pointer + mapcycle_current_index * 0xE4 + 0xC) -- (???) LOTS OF BAADF00D!
  115.     mapcycle_current_map_name = readstring(readdword(mapcycle_pointer)) -- Confirmed. Real name of the map.
  116.     mapcycle_current_gametype_name = readstring(readdword(mapcycle_pointer + 0x4)) -- Confirmed. Real name of the gametype. Case-sensitive.
  117.     mapcycle_current_gametype_name2 = readwidestring(mapcycle_pointer + 0xC) -- Confirmed. Real name of gametype. Case-sensitive.
  118.    
  119.     --Server globals
  120.     server_initialized = readbit(network_server_globals, 0) -- Tested.
  121.     server_last_display_time = readdword(network_server_globals + 0x4) -- From OS.
  122.     server_password = readstring(network_server_globals + 0x8, 8) -- Confirmed.
  123.     server_single_flag_force_reset = readbit(network_server_globals + 0x10, 0) -- Confirmed.
  124.     server_banlist_path = readstring(network_server_globals + 0x1C) -- Confirmed. Path to the banlist file.
  125.     server_friendly_fire_type = readword(network_server_globals + 0x120) -- Tested. Something to do with the friendly fire.
  126.     server_rcon_password = readstring(network_server_globals + 0x128) -- Confirmed.
  127.     if game == "CE" then
  128.         server_motd_filename = readstring(network_server_globals + 0x13C, 0x100) -- From OS.
  129.         server_motd_contents = readstring(network_server_globals + 0x23C, 0x100) -- From OS.
  130.     end
  131.  
  132.     --gameinfo header
  133.     gameinfo_base = readdword(gameinfo_header)
  134.     --unkLong[1] 0x4 (???) Always 0?
  135.     --unkFloat[2] 0x8 (???)
  136.     --unkLong[9] 0x10 (???)
  137.     --unkFloat[2] 0x34 (???)
  138.    
  139.     --gameinfo struct (someone should really help me with names lol)
  140.     gameinfo_initialized = readbit(gameinfo_base, 0) -- Confirmed. If the game is started or in standby. (1 if started, 0 if not)
  141.     gameinfo_active = readbit(gameinfo_base, 1) -- Confirmed. If the game is currently running (Active = True, Not Active = False)
  142.     gameinfo_paused = readbit(gameinfo_base, 2) -- From OS.
  143.     --Padding[2]
  144.     --unkWord[3] (???)
  145.     gameinfo_time_passed = readdword(gameinfo_base + 0xC) -- Confirmed (1 second = 30 ticks)
  146.     gameinfo_elapsed_time = readdword(gameinfo_base + 0x10) -- From OS.
  147.     gameinfo_server_time = readdword(gameinfo_base + 0x14) -- Confirmed. Same as gameinfo_time_passed, except it lags behind.
  148.     gameinfo_server_speed = readdword(gameinfo_base + 0x18) -- Confirmed. Changing this would be the same as cheatengining the server and messing with speedhack control.
  149.     gameinfo_leftover_time = readdword(gameinfo_base + 0x1C) -- From OS. Not sure what this is. Changes frequently.
  150.     --unkLong[39] 0x20 don't care enough to continue.
  151.    
  152.     --banlist header
  153.     banlist_size = readdword(banlist_header)
  154.     banlist_base = readdword(banlist_header + 0x4)
  155.    
  156.     --banlist struct
  157.     banlist_struct_size = 0x44
  158.     for j = 1,banlist_size do
  159.         ban_name = readwidestring(banlist_base + j * 0x44, 13) -- Confirmed. Name of banned player.
  160.         ban_hash = readstring(banlist_base + j * 0x44 + 0x1A, 32) -- Confirmed. Hash of banned player.
  161.         ban_some_bool = readbit(banlist_base + j * 0x44 + 0x3A, 0) -- (???)
  162.         ban_count = readword(banlist_base + j * 0x44 + 0x3C) -- Confirmed. How many times the specified player has been banned.
  163.         ban_indefinitely = readbit(banlist_base + j * 0x44 + 0x3E, 0) -- Confirmed. 1 if permanently banned, 0 if not.
  164.         ban_time = readdword(banlist_base + j * 0x44 + 0x40) -- Confirmed. Ban end date.
  165.     end
  166.    
  167.     --String/data addresses that aren't in a struct/header (to my knowledge).
  168.     server_broadcast_version = readstring(broadcast_version_address) -- Confirmed. Version that the server is broadcasting on.
  169.     version_info = readstring(version_info_address, 0x2A) -- Confirmed. Some version info for halo
  170.     halo_broadcast_game = readstring(broadcast_game_address, 5) -- Confirmed. Basically determines whether the server will broadcast on PC/CE/Trial ("halor" = PC, "halom" = CE,  ested the halo trial string).
  171.     server_port = readdword(server_port_address) -- Confirmed. Port that the server is broadcasting on.
  172.     server_path = readstring(server_path_address) -- Confirmed. Path to the server's haloded.exe
  173.     server_computer_name = readstring(computer_name_address) -- Confirmed. Server Computer (domain) name.
  174.     profile_path = readstring(profile_path_address) -- Confirmed. Path to the profile path.
  175.     map_name = readwidestring(map_name_address) -- Confirmed. Halo's map name (e.g. Blood Gulch)
  176.     computer_specs = readstring(computer_specs_address) -- Confirmed. Some address I found that stores information about the server (processor speed, brand)
  177.     map_name2 = readstring(map_name_address2) -- Confirmed. Map file name. (e.g. bloodgulch)
  178.     server_password = readstring(server_password_address, 8) -- Confirmed. Current server password for the server (will be nullstring if there is no password)
  179.     banlist_path = readstring(banlist_path_address) -- Confirmed. Path to the banlist file.
  180.     rcon_password = readstring(rcon_password_address, 8) -- Confirmed. Current rcon password for the server.
  181.    
  182.     -- random unuseful crap (string stuff) don't care enough to do CE
  183.     -- don't know why I even cared enough to write these down.
  184.     if game == "PC" then
  185.         halo_profilepath_cmdline = readstring(0x5D45B0, 5) -- Confirmed. The -path cmdline string.
  186.         halo_cpu_cmdline = readstring(0x5E4760, 4) -- Confirmed. The -cpu cmdline string.
  187.         halo_broadcast_game = readstring(0x5E4768, 5) -- Confirmed. Basically determines whether the server will broadcast on PC/CE/Trial ("halor" = PC, "halom" = CE, haven't tested the halo trial string).
  188.         halo_ip_cmdline = readstring(0x5E4770, 3) -- Confirmed. The -ip cmdline string.
  189.         halo_port_cmdline = readstring(0x5E4774, 5) -- Confirmed. The -port cmdline string.
  190.         halo_checkfpu_cmdline = readstring(0x5E477C, 9) -- Confirmed. The -checkfpu cmdline string.
  191.         halo_windowname = readstring(0x5E4788, 4) -- "The console windowname and classname (basically windowtitle, always 'Halo Console (#)').
  192.         --0x5E4790 - 0x5E473C is registry key stuff
  193.         halo_dw15_exe_path = readstring(0x5E4940, 26) --Confirmed. Path to dw15.exe (.\Watson\dw15.exe -x -s %u) probably from client code.
  194.         --other random crap/strings here
  195.     end
  196.  
  197. end
  198.  
  199. -- All of these are confirmed, unless said otherwise.
  200. function GetGameAddresses(game)
  201.  
  202.     if game == "PC" then
  203.         -- Structs/Headers.
  204.         stats_header = 0x639720
  205.         stats_globals = 0x639898
  206.         ctf_globals = 0x639B98
  207.         slayer_globals = 0x63A0E8
  208.         oddball_globals = 0x639E58
  209.         koth_globals = 0x639BD0
  210.         race_globals = 0x639FA0
  211.         race_locs = 0x670F40
  212.         map_pointer = 0x63525C
  213.         gametype_base = 0x671340
  214.         network_struct = 0x745BA0
  215.         camera_base = 0x69C2F8
  216.         player_header_pointer = 0x75ECE4
  217.         obj_header_pointer = 0x744C18
  218.         collideable_objects_pointer = 0x744C34
  219.         map_header_base = 0x630E74
  220.         banlist_header = 0x641280
  221.         game_globals = "???" -- (???) Why do I not have this for PC?
  222.         gameinfo_header = 0x671420
  223.         mapcycle_header = 0x614B4C
  224.         network_server_globals = 0x69B934
  225.         flags_pointer = 0x6A590C
  226.         hash_table_base = 0x6A2AE4
  227.        
  228.         -- String/Data Addresses.
  229.         broadcast_version_address = 0x5DF840
  230.         version_info_address = 0x5E02C0
  231.         broadcast_game_address = 0x5E4768
  232.         server_port_address = 0x625230
  233.         server_path_address = 0x62C390
  234.         computer_name_address = 0x62CD60
  235.         profile_path_address = 0x635610
  236.         map_name_address = 0x63BC78
  237.         computer_specs_address = 0x662D04
  238.         map_name_address2 = 0x698F21
  239.         server_password_address = 0x69B93C
  240.         banlist_path_address = 0x69B950
  241.         rcon_password_address = 0x69BA5C
  242.  
  243.         --Patches
  244.         gametype_patch = 0x481F3C -- I 'thought' this worked but haven't tested in ages.
  245.         hashcheck_patch = 0x59c280
  246.         servername_patch = 0x517D6B
  247.         versioncheck_patch = 0x5152E7
  248.     else
  249.         -- Structs/headers.
  250.         stats_header = 0x5BD740
  251.         stats_globals = 0x5BD8B8
  252.         ctf_globals = 0x5BDBB8
  253.         slayer_globals = 0x5BE108
  254.         oddball_globals = 0x5BDE78
  255.         koth_globals = 0x5BDBF0
  256.         race_globals = 0x5BDFC0
  257.         race_locs = 0x5F5098
  258.         map_pointer = 0x5B927C
  259.         gametype_base = 0x5F5498
  260.         network_struct = 0x6C7980
  261.         camera_base = 0x62075C
  262.         player_globals = 0x6E1478 -- From OS.
  263.         player_header_pointer = 0x6E1480
  264.         obj_header_pointer = 0x6C69F0
  265.         collideable_objects_pointer = 0x6C6A14
  266.         map_header_base = 0x6E2CA4
  267.         banlist_header = 0x5C52A0
  268.         game_globals = 0x61CFE0 -- (???)
  269.         gameinfo_header = 0x5F55BC
  270.         mapcycle_header = 0x598A8C
  271.         network_server_globals = 0x61FB64
  272.         hash_table_base = 0x5AFB34
  273.        
  274.         -- String/Data Addresses.
  275.         broadcast_version_address = 0x564B34
  276.         version_info_address = 0x565104
  277.         broadcast_game_address = 0x569EAC
  278.         server_port_address = 0x5A91A0
  279.         server_path_address = 0x5B0670
  280.         computer_name_address = 0x5B0D40
  281.         profile_path_address = 0x5B9630
  282.         map_name_address = 0x5BFC98
  283.         computer_specs_address = 0x5E6E5C
  284.         map_name_address2 = 0x61D151
  285.         server_password_address = 0x61FB6C
  286.         banlist_path_address = 0x61FB80
  287.         rcon_password_address = 0x61FC8C
  288.        
  289.  
  290.         --Patches
  291.         hashcheck_patch = 0x530130
  292.         servername_patch = 0x4CE0CD
  293.         versioncheck_patch = 0x4CB587
  294.     end
  295. end
  296.  
  297. function OnScriptUnload()
  298.  
  299. end
  300.  
  301. function OnNewGame(map)
  302.     Map = map
  303.     --Patches
  304.     writeword(servername_patch, 0x9090) -- Allows special characters in server name. Pretty useless now that Phasor does this automatically.
  305.     writebyte(hashcheck_patch, 0xEB) -- Disables Halo's hash check (0x74 to reenable)
  306.     writebyte(versioncheck_patch, 0xEB) -- Disables Halo's version check (0x7D to reenable)
  307.    
  308. end
  309.  
  310. function OnDamageApplication(receiving_obj, causing_obj, mapId, hitdata, backtap)
  311.  
  312. end
  313.  
  314. function OnDamageLookup(receiving_obj, causing_obj, mapId, tagdata)
  315.     -- REMEMBER. ANYTHING WRITTEN TO TAGDATA IS PERMANANT UNTIL THE MAP RESETS.
  316.     -- MAKE SURE IF YOU'RE WRITING TO TAGDATA YOU REMEMBER TO RESET IT AFTERWARDS (like with a timer) UNLESS YOU WANT IT TO BE PERMANENT
  317.     -- If you do want the change to be permanent, you most likely don't want to do it here. Do it OnNewGame.
  318.     -- In reality, a majority of these should be for reading only.
  319.    
  320.     -- jpt! tagdata struct.
  321.     dmg_radius_from = readfloat(tagdata + 0x0) -- From Sparky's Plugins. In world units.
  322.     dmg_radius_to = readfloat(tagdata + 0x4) -- From Sparky's Plugins. In world units.
  323.     dmg_cutoff_scale = readfloat(tagdata + 0x8) -- From Sparky's Plugins. 0 - 1 only
  324.     --  bitmask16
  325.     --  bitPadding[15] 0-14
  326.         dmg_dont_scale_damage_by_distance = readbit(tagdata + 0x0C, 15) -- From Sparky's Plugins
  327.     --jpt! Screen Flash.png
  328.     dmg_screen_flash_type = readword(tagdata + 0x24) -- From Sparky's Plugins. Probably doesn't sync. (None = 0, Lighten = 1, Darken = 2, Maximum = 3, Minimum = 4, Invert = 5, Tint = 6)
  329.     dmg_screen_flash_priority = readword(tagdata + 0x26) -- From Sparky's Plugins. (Low = 0, Medium = 1, High = 2)
  330.     dmg_screen_flash_duration = readfloat(tagdata + 0x34) -- From Sparky's Plugins.
  331.     --Padding[2] 0x36
  332.     dmg_screen_flash_fade_function = readword(tagdata + 0x38) -- From Sparky's Plugins. (Linear = 0, Early = 1, Very Early = 2, Late = 3, Very Late = 4, Cosine = 5)
  333.     --Padding[10] 0x3A
  334.     dmg_screen_flash_maximum_intensity = readfloat(tagdata + 0x44) -- From Sparky's Plugins. 0 - 1 only.
  335.     dmg_screen_flash_colors = readColorARGB(tagdata + 0x48) -- From Sparky's Plugins.
  336.     dmg_low_frequency_vibrate_frequency = readfloat(tagdata + 0x5C) -- From Sparky's Plugins. 0 - 1 only.
  337.     dmg_low_frequency_vibrate_duration = readfloat(tagdata + 0x60) -- From Sparky's Plugins. In seconds.
  338.     dmg_low_frequency_fade_function = readword(tagdata + 0x64) -- From Sparky's Plugins. (Linear = 0, Early = 1, Very Early = 2, Late = 3, Very Late = 4, Cosine = 5)
  339.     --Padding[2] 0x66
  340.     dmg_high_frequency_vibrate_frequency = readfloat(tagdata + 0x68) -- From Sparky's Plugins. 0 - 1 only.
  341.     dmg_high_frequency_vibrate_duration = readfloat(tagdata + 0x6C) -- From Sparky's Plugins. In seconds.
  342.     dmg_high_frequency_fade_function = readword(tagdata + 0x70) -- From Sparky's Plugins. (Linear = 0, Early = 1, Very Early = 2, Late = 3, Very Late = 4, Cosine = 5)
  343.     --Padding[0x26] 0x72
  344.     dmg_temporary_camera_impulse_duration = readfloat(tagdata + 0x98) -- From Sparky's Plugins. Wait... impulsive cameras?
  345.     dmg_temporary_camera_impulse_fadefunction = readword(tagdata + 0x9C) -- From Sparky's Plugins. (Linear = 0, Early = 1, Very Early = 2, Late = 3, Very Late = 4, Cosine = 5)
  346.     dmg_temporary_camera_impulse_rotation = readfloat(tagdata + 0xA0) -- From Sparky's Plugins. In radians.
  347.     dmg_temporary_camera_impulse_pushback = readfloat(tagdata + 0xA4) -- From Sparky's Plugins. In world units.
  348.     dmg_temporary_camera_impulse_jitter_from = readfloat(tagdata + 0xA8) -- From Sparky's Plugins. In world units.
  349.     dmg_temporary_camera_impulse_jitter_to = readfloat(tagdata + 0xAC) -- From Sparky's Plugins. In world units.
  350.     --Padding[8]
  351.     dmg_permanent_camera_impulse_angle = readfloat(tagdata + 0xB8) -- From Sparky's Plugins. In radians.
  352.     --Padding[16]
  353.     dmg_camera_shaking_duration = readfloat(tagdata + 0xCC)
  354.     dmg_camera_shaking_falloff_function = readword(tagdata + 0xD0) -- From Sparky's Plugins. (Linear = 0, Early = 1, Very Early = 2, Late = 3, Very Late = 4, Cosine = 5)
  355.     --Padding[2]
  356.     dmg_camera_shaking_random_translation = readfloat(tagdata + 0xD4) -- From Sparky's Plugins. In world units, in all directions
  357.     dmg_camera_shaking_random_rotation = readfloat(tagdata + 0xD8) -- From Sparky's Plugins. In radians, in all directions.
  358.     --Padding[12] 0xDC-0xE8
  359.     dmg_camera_shaking_wobble_function = readword(tagdata + 0xE8) -- From Sparky's Plugins. Perturbs the effect's behavior over time. (One = 0, Zero = 1, Cosine = 2, Cosine (variable period) = 3, Diagonal Wave = 4, Diagonal Wave (variable period) = 5, Slide = 6, , Slide (variable period) = 7, Noise = 8, Jitter = 9, Wander = 10, Spark = 11)
  360.     --Padding[2] 0xEA-0xEC
  361.     dmg_camera_shaking_wobble_function_period = readfloat(tagdata + 0xEC) -- From Sparky's Plugins. (1 sec = 30 ticks)
  362.     dmg_camera_shaking_wobble_weight = readfloat(tagdata + 0xF0) -- From Sparky's Plugins. 0.0 = wobble function has no effect; 1.0 = effect will not be felt when the wobble function's value is zero
  363.     --Padding[32] 0xF4-0x114
  364.     dmg_sound_tagtype = readstring(tagdata + 0x114, 4) -- From Sparky's Plugins. (changing this does nothing)
  365.     dmg_sound_tagname_address = readdword(tagdata + 0x118) -- From Sparky's Plugins. (changing this does nothing)
  366.         dmg_sound_tagname = readstring(dmg_sound_tagname_address) -- (DO NOT CHANGE)
  367.     --Padding[4]
  368.     dmg_sound_mapId = readdword(tagdata + 0x11C) -- From Sparky's Plugins.
  369.     --Padding[116] 0x120-0x194
  370.     dmg_breaking_effect_forward_velocity = readfloat(tagdata + 0x194) -- From Sparky's Plugins. In world units per second.
  371.     dmg_breaking_effect_forward_radius = readfloat(tagdata + 0x198) -- From Sparky's Plugins. In world units.
  372.     dmg_breaking_effect_forward_exponent = readfloat(tagdata + 0x19C) -- From Sparky's Plugins.
  373.     dmg_breaking_effect_outward_velocity = readfloat(tagdata + 0x1A0) -- From Sparky's Plugins. In world units per second.
  374.     dmg_breaking_effect_outward_radius = readfloat(tagdata + 0x1A4) -- From Sparky's Plugins. In world units.
  375.     dmg_breaking_effect_outward_exponent = readfloat(tagdata + 0x1A8) -- From Sparky's Plugins.
  376.     --Padding[18] 0x1AC-0x1C4
  377.     dmg_side_effect = readword(tagdata + 0x1C4) -- From Sparky's Plugins. (None = 0, Harmless = 1, Lethal to the Unsuspecting = 2, EMP = 3)
  378.     dmg_damage_category = readword(tagdata + 0x1C6) -- From Sparky's Plugins. (None = 0, Falling = 1, Bullet = 2, Grenade = 3, High Explosive = 4, Sniper = 5, Melee = 6, Flame = 7, Mounted Weapon = 8, Vehicle = 9)
  379.     --  damage flags bitmask16
  380.         dmg_does_not_hurt_owner = readbit(tagdata + 0x1C8, 0) -- From Sparky's Plugins.
  381.         dmg_can_cause_headshots = readbit(tagdata + 0x1C8, 1) -- From Sparky's Plugins.
  382.         dmg_pings_resistent_units = readbit(tagdata + 0x1C8, 2) -- From Sparky's Plugins.
  383.         dmg_does_not_hurt_friends = readbit(tagdata + 0x1C8, 3) -- From Sparky's Plugins.
  384.         dmg_does_not_ping_units = readbit(tagdata + 0x1C8, 4) -- From Sparky's Plugins.
  385.         dmg_detonates_explosives = readbit(tagdata + 0x1C8, 5) -- From Sparky's Plugins.
  386.         dmg_only_hurts_shields = readbit(tagdata + 0x1C8, 6) -- From Sparky's Plugins.
  387.         dmg_causes_flaming_death = readbit(tagdata + 0x1C8, 7) -- From Sparky's Plugins.
  388.         dmg_damage_indicators_always_point_down = readbit(tagdata + 0x1C8, 8) -- From Sparky's Plugins.
  389.         dmg_skips_shields = readbit(tagdata + 0x1C8, 9) -- From Sparky's Plugins.
  390.         dmg_only_hurts_one_infection_form = readbit(tagdata + 0x1C8, 10) -- From Sparky's Plugins.
  391.         dmg_can_cause_multiplayer_headshots = readbit(tagdata + 0x1C8, 11) -- From Sparky's Plugins.
  392.         dmg_infection_form_pop = readbit(tagdata + 0x1C8, 12) -- From Sparky's Plugins.
  393.     --Padding[2] 0x1CA-0x1CC
  394.     dmg_aoe_core_radius = readfloat(tagdata + 0x1CC) -- From Sparky's Plugins. if this is an area of effect damage type; (AOE = area of effect, not Age of Empires :P)
  395.     dmg_min_dmg = readfloat(tagdata + 0x1D0) -- Confirmed. The minimum amount of damage that can be done.
  396.     dmg_max_min = readfloat(tagdata + 0x1D4) -- Confirmed. The minimum amount of damage that can be done at the maximum damage level.
  397.     dmg_max_max = readfloat(tagdata + 0x1D8) -- Confirmed. The maximum amount of damage the causer can damage the receiver.
  398.     dmg_vehicle_passthrough_penalty = readfloat(tagdata + 0x1DC) -- From Sparky's Plugins. (0-1 only). 0 damages passengers in vehicles; 1 does not.
  399.     dmg_active_camouflage_damage = readfloat(tagdata + 0x1E0) -- From Sparky's Plugins. (0-1 only). how much more visible this makes a player who is active camouflaged.
  400.     dmg_stun = readfloat(tagdata + 0x1E4) -- From Sparky's Plugins. (0-1 only). amount of stun added to damaged object.
  401.     dmg_maximum_stun = readfloat(tagdata + 0x1E8) -- From Sparky's Plugins. (0-1 only). damaged object's stun will never exceed this amount; also check the matg Globals tag value!
  402.     dmg_stun_time = readfloat(tagdata + 0x1EC) -- From Sparky's Plugins. (0-1 only). duration of stun due to this damage.
  403.     --Padding[4] 0x1F0-0x1F4
  404.     dmg_force_amount = readfloat(tagdata + 0x1F4) -- From Sparky's Plugins. (0 through infinity).
  405.    
  406.     --TONS OF DAMAGE MODIFIERS RELATING TO MATERIALS HERE. SCREW IT FOR NOW. OTHERWISE THIS IS COMPLETE.
  407. end
  408.  
  409. function readColorARGB(address, offset)
  410.     address = address + (offset or 0x0)
  411.     local colors = {}
  412.     colors.alpha = readfloat(address + 0x0) --Also known as transparency.
  413.     colors.red = readfloat(address + 0x4)
  414.     colors.green = readfloat(address + 0x8)
  415.     colors.blue = readfloat(address + 0xC)
  416.     return colors
  417. end
  418.  
  419. function readcolorrgb(address, offset)
  420.     address = address + (offset or 0x0)
  421.     red = readfloat(address + 0x0)
  422.     green = readfloat(address + 0x4)
  423.     blue = readfloat(address + 0x8)
  424.     return red, blue, green
  425. end
  426.  
  427. function OnClientUpdate(player, m_objectId)
  428.  
  429.     local thisHash = gethash(player)
  430.     local team = getteam(player)
  431.  
  432.     if thisHash ~= nil then
  433.  
  434.         -- Confirmed/tested addresses and offsets
  435.         -- teams: red = 0, blue = 1
  436.        
  437.         --stats struct (size = 0x30 = 48 bytes)
  438.         stats_base = stats_globals + player*0x30
  439.         stats_player_ingame = readbyte(stats_base + 0x0) -- From Silentk (1 = Ingame, 0 if not)
  440.         --unkByte[3] 0x1-0x4 (???)
  441.         stats_player_id = readident(stats_base, 0x4) --Confirmed. Full DWORD ID of player.
  442.         stats_player_kills = readword(stats_base + 0x8) -- Confirmed.
  443.         --unkByte[6] 0xA-0x10 (???)
  444.         stats_player_assists = readword(stats_base + 0x10) -- From Silentk
  445.         --unkByte[6] 0x12-0x18 (???)
  446.         stats_player_betrays = readword(stats_base + 0x18) -- From Silentk. Actually betrays + suicides.
  447.         stats_player_deaths = readword(stats_base + 0x1A) -- From Silentk Everytime you die, no matter what..
  448.         stats_player_suicides = readword(stats_base + 0x1C) -- Confirmed.
  449.         stats_player_flag_steals = readword(stats_base + 0x1E) -- From Silentk. Flag steals for CTF.
  450.             stats_player_hill_time = readword(stats_base + 0x1E) -- Confirmed. Time for KOTH. (1 sec = 30 ticks)
  451.             stats_player_race_time = readword(stats_base + 0x1E) -- Guess. Time for Race. (1 sec = 30 ticks)
  452.         stats_player_flag_returns = readword(stats_base + 0x20) -- From Silentk. Flag returns for CTF.
  453.             stats_player_oddball_target_kills = readword(stats_base + 0x20) -- Guess. Number of times you killed the Juggernaut or It.
  454.             stats_player_race_laps = readword(stats_base + 0x20) -- Guess. Laps for Race.
  455.         stats_player_flag_scores = readword(stats_base + 0x22) -- From Silentk. Flag scores for CTF.
  456.             stats_player_oddball_kills = readword(stats_base + 0x22) -- Guess. Number of kills you have as Juggernaut or It.
  457.             stats_player_race_best_time = readword(stats_base + 0x22) -- Guess. Best time for Race. (1 sec = 30 ticks)
  458.         --unkByte[12] 0x24-0x30 (???)
  459.  
  460.         -- ctf globals (size = 0x34 = 52 bytes)
  461.         ctf_flag_coords_pointer = readdword(ctf_globals + team*4) -- Confirmed. Pointer to the coords where the flag respawns.
  462.             ctf_flag_x_coord = readfloat(ctf_flag_coords_pointer) -- Confirmed.
  463.             ctf_flag_y_coord = readfloat(ctf_flag_coords_pointer + 0x4) -- Confirmed.
  464.             ctf_flag_z_coord = readfloat(ctf_flag_coords_pointer + 0x8) -- Confirmed.
  465.         ctf_flag_object_id = readident(ctf_globals + team*4 + 0x8) -- Confirmed.
  466.         ctf_team_score = readdword(ctf_globals + team*4 + 0x10) -- Confirmed.
  467.         ctf_score_limit = readdword(ctf_globals + 0x18) -- Confirmed.
  468.         ctf_team_missing_flag_bool = readbit(ctf_globals + 0x1C+team, 0) -- Confirmed. (True if team doesn't have flag, False if their flag is at home)
  469.         ctf_flag_istaken_red_soundtimer = readdword(ctf_globals + 0x20) -- Confirmed. (Announcer repeats 'Red team, has the flag' after this number gets to 600 ticks = 20 seconds)
  470.         ctf_flag_istaken_blue_soundtimer = readdword(ctf_globals + 0x24) -- Confirmed. (Announcer repeats 'Blue team, has the flag' after this number gets to 600 ticks = 20 seconds)
  471.         ctf_flag_swap_timer = readdword(ctf_globals + 0x28) -- Confirmed. Single flag only. Counts down until 0, then offense team swaps with defense team. (1 second = 30 ticks)
  472.         ctf_failure_timer = readdword(ctf_globals + 0x2C)-- From OS. Sound timer for failure. Counts down until 0. (1 second = 30 ticks)
  473.         ctf_team_on_defense = readbyte(ctf_globals + 0x30) -- Confirmed. Team on defense (single flag gametypes) (Red = 0, Blue = 1)
  474.  
  475.         --koth globals (size = 0x200 = 512 bytes)
  476.         --Reminder: There are 16 teams in FFA, one for each person.
  477.         koth_team_score = readdword(koth_globals + team*4) -- Confirmed. (1 second = 30 ticks)
  478.         koth_team_last_time_in_hill = gameinfo_current_time - readdword(koth_globals + player*4 + 0x40) -- Confirmed. Time since team was last in the hill. (1 sec = 30 ticks)
  479.         koth_player_in_hill = readbyte(koth_globals + player + 0x80) -- Confirmed. (1 if in hill, 0 if not)
  480.         koth_hill_marker_count = readdword(koth_globals + 0x90) -- Confirmed. Number of hill markers.
  481.         --These are coordinates for each hill marker
  482.         for i = 0,koth_hill_marker_count-1 do
  483.             koth_hill_marker_x_coord = readfloat(koth_globals + i*4 + 0x94) -- X coordinate for hill marker
  484.             koth_hill_marker_y_coord = readfloat(koth_globals + i*4 + 0x98) -- Y coordinate for hill marker
  485.             koth_hill_marker_z_coord = readfloat(koth_globals + i*4 + 0x9C) -- Z coordinate for hill marker
  486.         end
  487.         --wth... these are coordinates but they're 2 dimensional, no z axis. Probably just the area that determines if you are in a hill
  488.         for i = 0,koth_hill_marker_count-1 do
  489.             koth_hill_marker_x_coord2 = readfloat(koth_globals + i*4 + 0x124) -- Tested. X coordinate for 2d hill.
  490.             koth_hill_marker_y_coord2 = readfloat(koth_globals + i*4 + 0x128) -- Tested. Y coordinate for 2d hill.
  491.         end
  492.         koth_center_of_hill_x_coord = readfloat(koth_globals + 0x184) -- Confirmed. Center of hill X.
  493.         koth_center_of_hill_y_coord = readfloat(koth_globals + 0x188) -- Confirmed. Center of hill Y.
  494.         koth_center_of_hill_z_coord = readfloat(koth_globals + 0x18C) -- Confirmed. Center of hill Z.
  495.         --unkLong[4] 0x190 (???)
  496.         koth_move_timer = readdword(koth_globals + 0x200) -- Confirmed. (1 second = 30 ticks)
  497.  
  498.         -- oddball globals
  499.         oddball_score_to_win = readdword(oddball_globals) -- Confirmed.
  500.         oddball_team_score = readdword(oddball_globals + team*4 + 0x4) -- Confirmed. There's actually 16 teams if the gametype is FFA.
  501.         oddball_player_score = readdword(oddball_globals + player*4 + 0x44) -- Confirmed.
  502.         --oddball_something = readdword(oddball_globals + player*4 + 0x64) -- (???)
  503.         oddball_ball_indexes = readdword(oddball_globals + 0x84) -- Tested. Idk what this is for but it holds oddball indexes that are differentiated by 0x1C2.
  504.             oddball_it_people = readdword(oddball_globals + 0x84) -- Tested. It's filled with stuff depending on the amount of 'it' people in jugg/tag
  505.         oddball_player_holding_ball = readident(oddball_globals + player*4 + 0xC4) -- Confirmed.
  506.         oddball_player_time_with_ball = readdword(oddball_globals + player*4 + 0x104) -- Confirmed. (1 second = 30 ticks)
  507.  
  508.         --race globals
  509.         race_checkpoint_value = readdword(race_globals) -- Confirmed. Total number of checkpoints required for a lap. Stored very awkwardly. (0x1 = 1, 0x3 = 2, 0x7 = 3, 0xF = 4, 0x1F = 5 etc)
  510.         -- to convert the checkpoint value do the following
  511.         race_checkpoint_count = math.log(race_checkpoint_value+1, 2)
  512.         -- to convert race_checkpoint_count to race_checkpoint_value
  513.         local race_checkpoint_value2 = 2^race_checkpoint_count-1
  514.         -- local always_true_bool = race_checkpoint_value == race_checkpoint_value2 or error("the universe has broken")
  515.        
  516.         race_player_current_checkpoint = readdword(race_globals + player*4 + 0x44) -- Confirmed. Current checkpoint the player needs to go to. Stored very awkwardly. (0x1 = 1st checkpoint, 0x3 = 2nd checkpoint, 0x7 = 3rd checkpoint, 0xF = 4th checkpoint, 0x1F = 5th checkpoint etc)
  517.        
  518.         race_team_score = readdword(race_globals + team*4 + 0x88) -- Confirmed.
  519.  
  520.         --race checkpoint locations
  521.         for i = 0,race_checkpoint_count do
  522.             race_checkpoint_x_coord = readfloat(race_locs + race_checkpoint_count*0x20) -- Confirmed.
  523.             race_checkpoint_y_coord = readfloat(race_locs + race_checkpoint_count*0x20 + 0x4) -- Confirmed.
  524.             race_checkpoint_z_coord = readfloat(race_locs + race_checkpoint_count*0x20 + 0x8) -- Confirmed.
  525.         end
  526.  
  527.         --slayer globals
  528.         slayer_team_score = readdword(slayer_globals + team*4) -- Confirmed.
  529.         slayer_player_score = readdword(slayer_globals + player*4 + 0x40) -- Confirmed.
  530.         slayer_game = readbyte(slayer_globals + 0x20) -- Tested. I think its always 1. I guess 1 if slayer, 0 if not? Something like that.
  531.  
  532.         -- camera struct
  533.         camera_size = 0x30
  534.         camera_xy = readfloat(camera_base + player*camera_size)
  535.         camera_z = readfloat(camera_base + player*camera_size + 0x4)
  536.         camera_x_aim = readfloat(camera_base + player*camera_size + 0x1C)
  537.         camera_y_aim = readfloat(camera_base + player*camera_size + 0x20)
  538.         camera_z_aim = readfloat(camera_base + player*camera_size + 0x24)
  539.  
  540.         -- mp flags table (race checkpoints, hill markers, vehicle spawns, etc)
  541.         -- REM figure out wth this is since I now know where flags really are...
  542.         flags_table_base = readdword(flags_pointer) -- Tested.
  543.         flags_count = readdword(flags_table_base + 0x378) -- Tested.
  544.         flags_table_address = readdword(flags_table_base + 0x37C) -- Tested.
  545.         for i = 0,flags_count do -- i is each individual flag index
  546.             flag_address = flags_table_address + i * 148
  547.             flag_x_coord = readfloat(flag_address) -- Confirmed.
  548.             flag_y_coord = readfloat(flag_address + 0x4) -- Confirmed.
  549.             flag_z_coord = readfloat(flag_address + 0x8) -- Confirmed.
  550.             flag_type = readword(flag_address + 0x10) -- Tested. (3 if race checkpoint, 6 if spawnpoint, sometimes 0 meaning something else)
  551.             --flag_something = readword(flag_address + 0x12) -- (???) Always 1?
  552.             flag_tagtype = readstring(flag_address + 0x14, 4) -- Tested. It's usually ITMC or WPCL, which makes no sense...
  553.         end
  554.  
  555.         -- player struct setup
  556.         m_player = getplayer(player)
  557.  
  558.         -- player struct
  559.         player_id = readword(m_player, 0x0) -- Confirmed. WORD ID of this player. (0xEC70 etc)
  560.         player_host = readword(m_player + 0x2) -- Confirmed. (Host = 0) (Not host = 0xFFFFFFFF)
  561.         player_name = readwidestring(m_player + 0x4, 12) -- Confirmed.
  562.         --unkIdent[1] 0x1C-0x20 (???)
  563.         player_team = readbyte(m_player + 0x20) -- Confirmed. (Red = 0) (Blue = 1)
  564.         --Padding[3] 0x21-0x24
  565.         player_interaction_obj_id = readident(m_player + 0x24) -- Confirmed. Returns vehi/weap id on interaction. (does not apply to weapons you're already holding)
  566.         player_interaction_object_type = readword(m_player + 0x28) -- Confirmed. (Vehicle = 8, Weapon = 7)
  567.         player_interaction_vehi_seat = readword(m_player + 0x2A) -- Confirmed. Takes seat number from vehi tag starting with 0. Warthog Seats: (0 = Driver, 1 = Gunner, 2 = Passenger)
  568.         player_respawn_time = readdword(m_player + 0x2C) -- Confirmed. Counts down when dead. When 0 you respawn. (1 sec = 30 ticks)
  569.         player_respawn_time_growth = readdword(m_player + 0x30) -- Confirmed. Current respawn time growth for player. (1 second = 30 ticks)
  570.         player_obj_id = readident(m_player + 0x34) -- Confirmed.
  571.         player_last_obj_id = readident(m_player + 0x38) -- Confirmed. 0xFFFFFFFF if player hasn't died/hasn't had their object destroyed yet. sv_kill or kill(player) DOES NOT AFFECT THIS AT ALL.
  572.         player_cluster_index = readword(m_player + 0x3C) -- Tested. Not sure what this is, but it's definitely something.
  573.         --  bitmask16:
  574.             player_weapon_pickup = readbit(m_player + 0x3E, 0) -- Confirmed. (True if picking up weapon, False if not.)
  575.         --  bitPadding[15] 1-15
  576.         --player_auto_aim_target_objId = readident(m_player + 0x40) -- (???) Always 0xFFFFFFFF
  577.         player_last_bullet_time = gameinfo_current_time - readdword(m_player + 0x44) -- Confirmed. Time since last shot fired. (1 second = 30 ticks). Auto_aim_update_time in OS.
  578.        
  579.         --This stuff comes directly from the client struct:
  580.         player_name2 = readwidestring(m_player + 0x48, 12) -- Confirmed.
  581.         player_color = readword(m_player + 0x60) -- Confirmed. Color of the player (FFA Gametypes Only.) (0 = white) (1 = black) (2 = red) (3 = blue) (4 = gray) (5 = yellow) (6 = green) (7 = pink) (8 = purple) (9 = cyan) (10 = cobalt) (11 = orange) (12 = teal) (13 = sage) (14 = brown) (15 = tan) (16 = maroon) (17 = salmon)
  582.         --player_icon_index = readword(m_player + 0x62) -- (???) Always 0xFFFF?
  583.         player_machine_index = readbyte(m_player + 0x64) -- Confirmed with resolveplayer(player). Player Machine Index (rconId - 1).
  584.         --player_controller_index = readbyte(m_player + 0x65) -- (???) Always 0?
  585.         player_team2 = readbyte(m_player + 0x66) -- Confirmed. (Red = 0) (Blue = 1)
  586.         player_index = readbyte(m_player + 0x67) -- Confirmed with rresolveplayer. Player memory id/index (0 - 15) (To clarify: this IS the 'player' argument passed to phasor functions)
  587.         --End of client struct stuff.
  588.        
  589.         player_invis_time = readword(m_player + 0x68) -- Confirmed. Time until player is no longer camouflaged. (1 sec = 30 ticks)
  590.         --unkWord[1] 0x6A-0x6C (???) Has something to do with player_invis_time.
  591.         player_speed = readfloat(m_player + 0x6C) -- Confirmed.
  592.         player_teleporter_flag_id = readident(m_player + 0x70) -- Tested. Index to a netgame flag in the scenario, or -1 (Always 0xFFFFFFFF?)
  593.         player_objective_mode = readdword(m_player + 0x74) -- From Smiley. (Hill = 0x22 = 34) (Juggernaut = It = 0x23 = 35) (Race = 0x16 = 22) (Ball = 0x29 = 41) (Others = -1)
  594.         player_objective_player_id = readident(m_player + 0x78) -- Confirmed. Becomes the full DWORD ID of this player once they interact with the objective. (DOES NOT APPLY TO CTF) (0xFFFFFFFF / -1 if not interacting)
  595.         player_target_player = readdword(m_player + 0x7C) -- From OS. Values (this and player_target_time) used for rendering a target player's name. (Always 0xFFFFFFFF?)
  596.         player_target_time = readdword(m_player + 0x80) -- From OS. Timer used to fade in the target player name.
  597.         player_last_death_time = gameinfo_current_time - readdword(m_player + 0x84) -- Confirmed. Time since last death. (1 sec = 30 ticks)
  598.         player_slayer_target = readident(m_player + 0x88) -- Confirmed. Slayer Target Player
  599.         --  bitmask32:
  600.             player_oddman_out = readbit(m_player + 0x8C, 0) -- Confirmed. (1 if oddman out, 0 if not)
  601.         --  bitPadding[31]
  602.         --Padding[6] 0x90-0x96
  603.         player_killstreak = readword(m_player + 0x96) -- Confirmed. How many kills the player has gotten in their lifetime.
  604.         player_multikill = readword(m_player + 0x98) -- (???) 0 on spawn, 1 when player gets a kill, then stays 1 until death.
  605.         player_last_kill_time = gameinfo_current_time - readword(m_player + 0x9A) -- Confirmed. Time since last kill time. (1 sec = 30 ticks)
  606.         player_kills = readword(m_player + 0x9C) -- Confirmed.
  607.         --unkByte[6] 0x9E-0xA4 (Padding Maybe?)
  608.         player_assists = readword(m_player + 0xA4) -- Confirmed.
  609.         --unkByte[6] 0xA6-0xAC (Padding Maybe?)
  610.         player_betrays_and_suicides = readword(m_player + 0xAC) -- Confirmed. betrays + suicides.
  611.         player_deaths = readword(m_player + 0xAE) -- Confirmed.
  612.         player_suicides = readword(m_player + 0xB0) -- Confirmed.
  613.        
  614.         player_betrayals = player_betrays_and_suicides - player_suicides
  615.         if player_betrayals < 0 then
  616.             player_betrayals = 0
  617.         end
  618.         --Padding[14] 0xB2-0xC0
  619.         player_teamkills = readword(m_player + 0xC0) -- From OS.
  620.         --Padding[2] 0xC2-0xC4
  621.        
  622.         --This is all copied from the stat struct
  623.         player_flag_steals = readword(m_player + 0xC4) -- Confirmed. Flag steals for CTF.
  624.             player_hill_time = readword(m_player + 0xC4) -- Confirmed. Time for KOTH. (1 sec = 30 ticks)
  625.             player_race_time = readword(m_player + 0xC4) -- Confirmed. Time for Race. (1 sec = 30 ticks)
  626.         player_flag_returns = readword(m_player + 0xC6) -- Confirmed. Flag returns for CTF.
  627.             player_oddball_target_kills = readword(m_player + 0xC6) -- Confirmed. Number of times you killed the Juggernaut or It.
  628.             player_race_laps = readword(m_player + 0xC6) -- Confirmed. Laps for Race.
  629.         player_flag_scores = readword(m_player + 0xC8) -- Confirmed. Flag scores for CTF.
  630.             player_oddball_kills = readword(m_player + 0xC8) -- Confirmed. Number of kills you have as Juggernaut or It.
  631.             player_race_best_time = readword(m_player + 0xC8) -- Confirmed. Best time for Race. (1 sec = 30 ticks)
  632.        
  633.         --unkByte[2] 0xCA-0xCC (Padding Maybe?)
  634.         player_telefrag_timer = readdword(m_player + 0xCC) -- Confirmed. Time spent blocking a tele. Counts down after other player stops trying to teleport. (1 sec = 30 ticks)
  635.         player_quit_time = gameinfo_current_time - readdword(m_player + 0xD0) -- Confirmed. Time since player quit. 0xFFFFFFFF if player not quitting. (1 sec = 30 ticks)
  636.         --  bitmask16:
  637.         --  player_telefrag_enabled = readbit(m_player + 0xD4, 0) -- (???) Always False?
  638.         --  bitPadding[7] 1-7
  639.         --  player_quit = readbit(m_player + 0xD4, 8) -- (???) Always False?
  640.         --  bitPadding[7] 9-15
  641.         --Padding[6] 0xD6-0xDC
  642.         player_ping = readdword(m_player + 0xDC) -- Confirmed.
  643.         player_teamkill_number = readdword(m_player + 0xE0) -- Confirmed.
  644.         player_teamkill_timer = readdword(m_player + 0xE4) -- Confirmed. Time since last betrayal. (1 sec = 30 ticks)
  645.         player_some_timer = readword(m_player + 0xE8) -- Tested. It increases once every half second until it hits 36, then repeats.
  646.         --unkByte[14] 0xEA-0xF8 (???)
  647.         player_x_coord = readfloat(m_player + 0xF8) -- Confirmed.
  648.         player_y_coord = readfloat(m_player + 0xFC) -- Confirmed.
  649.         player_z_coord = readfloat(m_player + 0x100) -- Confirmed.
  650.         --unkIdent[1] 0x104-0x108 (???)
  651.        
  652.        
  653.         --unkByte[8] 0x108-0x110 (???)
  654.         --unkLong[1] 0x110-0x114 (Some timer)
  655.         --unkByte[8] 0x114-0x11C (???)
  656.         --  Player Action Keypresses.
  657.             player_melee_key = readbit(m_player + 0x11C, 0) -- Confirmed.
  658.             player_action_key = readbit(m_player + 0x11C, 1) -- Confirmed.
  659.         --  unkBit[1] 2
  660.             player_flashlight_key = readbit(m_player + 0x11C, 3) -- Confirmed.
  661.         --  unkBit[9] 4-12
  662.             player_reload_key = readbit(m_player + 0x11C, 13) -- Confirmed.
  663.         --  unkBit[2] 14-15
  664.        
  665.         --unkByte[30] 0x11E-0x134 (???)
  666.         player_xy_aim = readfloat(m_player + 0x138) -- Confirmed. Lags. (0 to 2pi) In radians.
  667.         player_z_aim = readfloat(m_player + 0x13C) -- Confirmed. Lags. (-pi/2 to pi/2) In radians.
  668.         player_forward = readfloat(m_player + 0x140) -- Confirmed. Negative means backward. Lags. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  669.         player_left = readfloat(m_player + 0x144) -- Confirmed. Negative means right. Lags. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  670.         player_rateoffire_speed = readfloat(m_player + 0x148) -- Confirmed. As player is shooting, this will gradually increase until it hits the max (0 to 1 only)
  671.         player_weap_type = readword(m_player + 0x14C) -- Confirmed. Lags. (Primary = 0) (Secondary = 1) (Tertiary = 2) (Quaternary = 3)
  672.         player_nade_type = readword(m_player + 0x14E) -- Confirmed. Lags. (Frag = 0) (Plasma = 1)
  673.         --unkByte[4] 0x150-0x154 (Padding Maybe?)
  674.         player_x_aim2 = readfloat(m_player + 0x154) -- Confirmed. Lags.
  675.         player_y_aim2 = readfloat(m_player + 0x158) -- Confirmed. Lags.
  676.         player_z_aim2 = readfloat(m_player + 0x15C) -- Confirmed. Lags.
  677.         --unkByte[16] 0x160-0x170 (Padding Maybe?)
  678.         player_x_coord2 = readfloat(m_player + 0x170) -- Confirmed. Lags. (Possibly what the client reports is _its_ world coord?)
  679.         player_y_coord2 = readfloat(m_player + 0x174) -- Confirmed. Lags. (Possibly what the client reports is _its_ world coord?)
  680.         player_z_coord2 = readfloat(m_player + 0x178) -- Confirmed. Lags. (Possibly what the client reports is _its_ world coord?)
  681.         --unkByte[132] 0x17C-0x200
  682.  
  683.         -- obj/weap struct setup
  684.         m_player_object = getobject(player_obj_id) -- obj struct setup
  685.         m_vehicle = getobject(readdword(m_object + 0x11C)) -- vehi check setup
  686.  
  687.         -- vehi check
  688.         m_object = m_player_object
  689.         if m_vehicle then
  690.             m_object = m_vehicle
  691.         end
  692.  
  693.         -- obj struct. This struct applies to ALL OBJECTS. 0x0 - 0x1F4
  694.         obj_tag_id = readdword(m_object) -- Confirmed with HMT. Tag Meta ID / MapID / TagID.
  695.         --obj_object_role = readdword(m_object + 0x4) -- From OS. (0 = Master, 1 = Puppet, 2 = Puppet controlled by local player, 3 = ???) Always 0?
  696.         --  bitmask32:
  697.         --  unkBits[8] 0-7 (???)
  698.             obj_should_force_baseline_update = readbit(m_object + 0x8, 8) -- From OS.
  699.         --  unkBits[23] 9-32 (???)
  700.             obj_existance_time = readdword(m_object + 0xC) -- Confirmed. (1 second = 30 ticks)
  701.         --  Physics bitmask32:
  702.             obj_noCollision = readbit(m_object + 0x10, 0) -- Confirmed. (Ghost mode = True)
  703.             obj_is_on_ground = readbit(m_object + 0x10, 1) -- Confirmed. (Object is on the ground = True, otherwise False)
  704.             obj_ignoreGravity = readbit(m_object + 0x10, 2) -- From Phasor
  705.         --  obj_is_in_water = readbit(m_object + 0x10, 3) -- (???) Always 0?
  706.         --  unkBits[1] 0x10 4
  707.             obj_stationary = readbit(m_object + 0x10, 5) -- Confirmed. This bit is set (true) when the object is stationary.
  708.         --  unkBits[1] 0x10 6
  709.             obj_noCollision2 = readbit(m_object + 0x10, 7) -- From Phasor.
  710.         --  unkBits[3] 0x10 8-10
  711.         --  obj_connected_to_map = readbit(m_object + 0x10, 11) -- (???) Always True?
  712.         --  unkBits[4] 0x10 12-15
  713.             obj_garbage_bit = readbit(m_object + 0x10, 16) -- From OS.
  714.         --  unkBits[1] 0x10 17
  715.             obj_does_not_cast_shadow = readbit(m_object + 0x10, 18) -- From OS.
  716.         --  unkBits[2] 0x10 19-20
  717.             obj_is_outside_of_map = readbit(m_object + 0x10, 21) -- Confirmed. (True if outside of map, False if not)
  718.         --  obj_beautify_bit = readbit(m_object + 0x10, 22) -- (???) Always False?
  719.         --  unkBits[1] 0x10 23
  720.             obj_is_collideable = readbit(m_object + 0x10, 24) -- Confirmed. Set this to true to allow other objects to pass through you. (doesn't apply to vehicles).
  721.         --  unkBits[7] 0x10 25-31
  722.         obj_marker_id = readdword(m_object + 0x14) -- Tested. Continually counts up from like 89000...
  723.         --Padding[0x38] 0x18-0x50
  724.         --obj_owner_player_id = readident(m_object + 0x50) -- (???) Always 0?
  725.         --obj_owner_id = readident(m_object + 0x54) -- (???) Always 0?
  726.         --obj_timestamp = readdword(m_object + 0x58) -- (???) Always 0?
  727.         obj_x_coord = readfloat(m_object + 0x5C) -- Confirmed.
  728.         obj_y_coord = readfloat(m_object + 0x60) -- Confirmed.
  729.         obj_z_coord = readfloat(m_object + 0x64) -- Confirmed.
  730.         obj_x_vel = readfloat(m_object + 0x68) -- Confirmed.
  731.         obj_y_vel = readfloat(m_object + 0x6C) -- Confirmed.
  732.         obj_z_vel = readfloat(m_object + 0x70) -- Confirmed.
  733.         obj_pitch = readfloat(m_object + 0x74) -- Confirmed. In Radians. (-1 to 1)
  734.         obj_yaw = readfloat(m_object + 0x78) -- Confirmed. In Radians. (-1 to 1)
  735.         obj_roll = readfloat(m_object + 0x7C) -- Confirmed. In Radians. (-1 to 1)
  736.         obj_x_scale = readfloat(m_object + 0x80) -- Tested. 0 for bipd. Changes when in vehi. Known as 'up' in OS.
  737.         obj_y_scale = readfloat(m_object + 0x84) -- Tested. 0 for bipd. Changes when in vehi. Known as 'up' in OS.
  738.         obj_z_scale = readfloat(m_object + 0x88) -- Tested. 1 for bipd. Changes when in vehi. Known as 'up' in OS.
  739.         obj_pitch_vel = readfloat(m_object + 0x8C) -- Confirmed for vehicles. Current velocity for pitch.
  740.         obj_yaw_vel = readfloat(m_object + 0x90) -- Confirmed for vehicles. Current velocity for yaw.
  741.         obj_roll_vel = readfloat(m_object + 0x94) -- Confirmed for vehicles. Current velocity for roll.
  742.         obj_locId = readdword(m_object + 0x98) -- Confirmed. Each map has dozens of location IDs, used for general location checking.
  743.         --unkLong[1] 0x9C (Padding Maybe?)
  744.         -- Apparently these are coordinates, used for the game code's trigger volume point testing
  745.         obj_center_x_coord = readfloat(m_object + 0xA0) -- Tested. Very close to obj_x_coord, but not quite?
  746.         obj_center_y_coord = readfloat(m_object + 0xA4) -- Tested. Very close to obj_y_coord, but not quite?
  747.         obj_center_z_coord = readfloat(m_object + 0xA8) -- Tested. Very close to obj_z_coord, but not quite?
  748.         obj_radius = readfloat(m_object + 0xAC) -- Confirmed. Radius of object. In Radians. (-1 to 1)
  749.         obj_scale = readfloat(m_object + 0xB0) -- Tested. Seems to be some random float for all objects (all same objects have same value)
  750.         obj_type = readword(m_object + 0xB4) -- Confirmed. (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)
  751.         --Padding[2] 0xB6-0xB8
  752.         obj_game_objective = readword(m_object + 0xB8) -- Confirmed. If objective then this >= 0, -1 = is NOT game object. Otherwise: (Red = 0) (Blue = 1)
  753.         obj_namelist_index = readword(m_object + 0xBA) -- From OS.
  754.         --obj_moving_time = readword(m_object + 0xBC) -- (???) Always 0?
  755.         --obj_region_permutation_variant_id = readword(m_object + 0xBE) -- (???) Always 0?
  756.         obj_player_id = readident(m_object + 0xC0) -- Confirmed. Full DWORD ID of player.
  757.         obj_owner_obj_id = readident(m_object + 0xC4) -- Confirmed. Parent object ID of this object
  758.         --Padding[4] 0xC8-0xCC
  759.         --REM: figure out what this animation stuffz is.
  760.         obj_antr_meta_id = readident(m_object + 0xCC) -- From DZS. Remind me to look at eschaton to see what this actually is (Possible Struct?)
  761.         obj_animation_state = readword(m_object + 0xD0) -- Confirmed. (0 = Idle, 1 = Gesture, Turn Left = 2, Turn Right = 3, Move Front = 4, Move Back = 5, Move Left = 6, Move Right = 7, Stunned Front = 8, Stunned Back = 9, Stunned Left = 10, Stunned Right = 11, Slide Front = 12, Slide Back = 13, Slide Left = 14, Slide Right = 15, Ready = 16, Put Away = 17, Aim Still = 18, Aim Move = 19, Airborne = 20, Land Soft = 21, Land Hard = 22, ??? = 23, Airborne Dead = 24, Landing Dead = 25, Seat Enter = 26, Seat Exit = 27, Custom Animation = 28, Impulse = 29, Melee = 30, Melee Airborne = 31, Melee Continuous = 32, Grenade Toss = 33, Resurrect Front = 34, Ressurect Back = 35, Feeding = 36, Surprise Front = 37, Surprise Back = 38, Leap Start = 39, Leap Airborne = 40, Leap Melee = 41, Unused AFAICT = 42, Berserk = 43)
  762.         obj_time_since_animation_state_change = readword(m_object + 0xD2) -- Confirmed (0 to 60) Time since last animation_state change. Restarts at 0 when animation_state changes (1 sec = 30 ticks)
  763.         --unkWord[2] 0xD4-0xD8 (???)
  764.         obj_max_health = readfloat(m_object + 0xD8) -- Confirmed. Takes value from coll tag.
  765.         obj_max_shields = readfloat(m_object + 0xDC) -- Confirmed. Takes value from coll tag.
  766.         obj_health = readfloat(m_object + 0xE0) -- Confirmed. (0 to 1)
  767.         obj_shields = readfloat(m_object + 0xE4) -- Confirmed. (0 to 3) (Normal = 1) (Full overshield = 3)
  768.         obj_current_shield_damage = readfloat(m_object + 0xE8) -- Confirmed. CURRENT INSTANTANEOUS amount of shield being damaged.
  769.         obj_current_body_damage = readfloat(m_object + 0xEC) -- Confirmed. CURRENT INSTANTANEOUS amount of health being damaged.
  770.         --obj_some_obj_id = readident(m_object + 0xF0) -- (???) Always 0xFFFFFFFF?
  771.         obj_last_shield_damage_amount = readfloat(m_object + 0xF4) -- Tested. Total shield damage taken (counts back down to 0 after 2 seconds)
  772.         obj_last_body_damage_amount = readfloat(m_object + 0xF8) -- Tested. Total health damage taken (counts back down to 0 after 2 seconds)
  773.         obj_last_shield_damage_time = readdword(m_object + 0xFC) -- Tested. Counts up to 75 after shield is damaged, then becomes 0xFFFFFFFF.
  774.         obj_last_body_damage_time = readdword(m_object + 0x100) -- Tested. Counts up to 75 after health is damaged, then becomes 0xFFFFFFFF.
  775.         obj_shields_time_until_recharge = readword(m_object + 0x104) -- Tested. Counts down when shield is damaged. When 0 your shields recharge. (1 sec = 30 ticks). based on ftol(s_shield_damage_resistance->stun_time * 30f)
  776.         -- damageFlags bitmask16
  777.             --obj_body_damage_effect_applied = readbit(m_object + 0x106, 0) -- (???) Always False?
  778.             --obj_shield_damage_effect_applied = readbit(m_object + 0x106, 1) -- (???) Always False?
  779.             --obj_body_health_empty = readbit(m_object + 0x106, 2) -- (???) Always False?
  780.             --obj_shield_empty = readbit(m_object + 0x106, 3) -- (???) Always False?
  781.             --obj_kill = readbit(m_object + 0x106, 4) -- (???) Always False?
  782.             --obj_silent_kill_bit = readbit(m_object + 0x106, 5) -- (???) Always False?
  783.             --obj_damage_berserk = readbit(m_object + 0x106, 6) -- (???) Always False? (actor berserk related)
  784.         --  unkBits[4] 0x106 7-10
  785.             obj_cannot_take_damage = readbit(m_object + 0x106, 11) -- Confirmed. Set this to true to make object undamageable (even from backtaps!)
  786.             obj_shield_recharging = readbit(m_object + 0x106, 12) -- Confirmed. (True = shield recharging, False = not recharging)
  787.             --obj_killed_no_statistics = readbit(m_object + 0x106, 13) -- (???) Always False?
  788.         --  unkBits[2] 0x106 14-15
  789.         --Padding[4] 0x108
  790.         obj_cluster_partition_index = readident(m_object + 0x10C) -- Tested. This number continually counts up, and resumes even after object is destroyed and recreated (killed)
  791.         --obj_some_obj_id2 = readident(m_object + 0x110) -- object_index, garbage collection related
  792.         --obj_next_obj_id = readident(m_object + 0x114) -- (???) Always 0xFFFFFFFF?
  793.         obj_weap_obj_id = readident(m_object + 0x118) -- Confirmed. Current weapon  id.
  794.         obj_vehi_obj_id = readident(m_player_object + 0x11C) -- Confirmed. Current vehicle id. (Could also be known as the object's parent ID.)
  795.         obj_vehi_seat = readword(m_object + 0x120) -- Confirmed. Current seat index (same as player_interaction_vehi_seat once inside a vehicle)
  796.         --  bitmask8:
  797.             obj_force_shield_update = readbit(m_object + 0x122, 0) -- From OS.
  798.         --  unkBits[15] 1-15 (???)
  799.        
  800.         --Functions.
  801.         obj_shields_hit = readfloat(m_object + 0x124) -- Tested. Counts down from 1 after shields are hit (0 to 1)
  802.         obj_shields_target = readfloat(m_object + 0x128) -- Tested. When you have an overshield it stays at 1 which is why I think the overshield drains. (0 to 1) [2nd function]
  803.         obj_flashlight_scale = readfloat(m_object + 0x12C) -- Confirmed. Intensity of flashlight as it turns on and off. (0 to 1) (On > 0) (Off = 0) [3rd function]
  804.         obj_assaultrifle_function = readfloat(m_object + 0x130) -- The Assault rifle is the only one that uses this function.
  805.         obj_export_function1 = readfloat(m_object + 0x134) -- Tested. (Assault rifle = 1)
  806.         obj_flashlight_scale2 = readfloat(m_object + 0x138) -- Confirmed. Intensity of flashlight as it turns on and off. (0 to 1) (On > 0) (Off = 0) [2nd function]
  807.         obj_shields_hit2 = readfloat(m_object + 0x13C) -- Tested. Something to do with shields getting hit. [3rd function]
  808.         obj_export_function4 = readfloat(m_object + 0x140) -- Tested. (1 = Assault Rifle)
  809.         --End of functions.
  810.        
  811.         --Regions/Attachments.
  812.         obj_attachment_type = readbyte(m_object + 0x144) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  813.         obj_attachment_type2 = readbyte(m_object + 0x145) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  814.         obj_attachment_type3 = readbyte(m_object + 0x146) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  815.         obj_attachment_type4 = readbyte(m_object + 0x147) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  816.         obj_attachment_type5 = readbyte(m_object + 0x148) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  817.         obj_attachment_type6 = readbyte(m_object + 0x149) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  818.         obj_attachment_type7 = readbyte(m_object + 0x14A) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  819.         obj_attachment_type8 = readbyte(m_object + 0x14B) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  820.        
  821.         -- game state identity
  822.         -- ie, if Attachments[x]'s definition (object_attachment_block[x]) says it is a 'cont'
  823.         -- then the identity is a contrail_data handle
  824.         obj_attachment_id = readident(m_object + 0x14C) -- From OS.
  825.         obj_attachment2_id = readident(m_object + 0x150) -- From OS.
  826.         obj_attachment3_id = readident(m_object + 0x154) -- From OS.
  827.         obj_attachment4_id = readident(m_object + 0x158) -- From OS.
  828.         obj_attachment5_id = readident(m_object + 0x15C) -- From OS.
  829.         obj_attachment6_id = readident(m_object + 0x160) -- From OS.
  830.         obj_attachment7_id = readident(m_object + 0x164) -- From OS.
  831.         obj_attachment8_id = readident(m_object + 0x168) -- From OS.
  832.         obj_first_widget_id = readident(m_object + 0x16C) -- (???) Always 0xFFFFFFFF?
  833.         obj_cached_render_state_index = readident(m_object + 0x170) -- (???) Always 0xFFFFFFFF?
  834.         --unkByte[2] 0x174-0x176 (Padding Maybe?)
  835.         obj_shader_permutation = readword(m_object + 0x176) -- From OS. shader's bitmap block index
  836.         obj_health_region = readbyte(m_object + 0x178) -- From OS.
  837.         obj_health_region2 = readbyte(m_object + 0x179) -- From OS.
  838.         obj_health_region3 = readbyte(m_object + 0x17A) -- From OS.
  839.         obj_health_region4 = readbyte(m_object + 0x17B) -- From OS.
  840.         obj_health_region5 = readbyte(m_object + 0x17C) -- From OS.
  841.         obj_health_region6 = readbyte(m_object + 0x17D) -- From OS.
  842.         obj_health_region7 = readbyte(m_object + 0x17E) -- From OS.
  843.         obj_health_region8 = readbyte(m_object + 0x17F) -- From OS.
  844.         obj_region_permutation_index = readchar(m_object + 0x180) -- From OS.
  845.         obj_region_permutation2_index = readchar(m_object + 0x181) -- From OS.
  846.         obj_region_permutation3_index = readchar(m_object + 0x182) -- From OS.
  847.         obj_region_permutation4_index = readchar(m_object + 0x183) -- From OS.
  848.         obj_region_permutation5_index = readchar(m_object + 0x184) -- From OS.
  849.         obj_region_permutation6_index = readchar(m_object + 0x185) -- From OS.
  850.         obj_region_permutation7_index = readchar(m_object + 0x186) -- From OS.
  851.         obj_region_permutation8_index = readchar(m_object + 0x187) -- From OS.
  852.         --End of regions/attachments
  853.        
  854.         obj_color_change_red = readfloat(m_object + 0x188) -- From OS.
  855.         obj_color_change_green = readfloat(m_object + 0x18C) -- From OS.
  856.         obj_color_change_blue = readfloat(m_object + 0x190) -- From OS.
  857.         obj_color_change2_red = readfloat(m_object + 0x194) -- From OS.
  858.         obj_color_change2_green = readfloat(m_object + 0x198) -- From OS.
  859.         obj_color_change2_blue = readfloat(m_object + 0x19C) -- From OS.
  860.         obj_color_change3_red = readfloat(m_object + 0x1A0) -- From OS.
  861.         obj_color_change3_green = readfloat(m_object + 0x1A4) -- From OS.
  862.         obj_color_change3_blue = readfloat(m_object + 0x1A8) -- From OS.
  863.         obj_color_change4_red = readfloat(m_object + 0x1AC) -- From OS.
  864.         obj_color_change4_green = readfloat(m_object + 0x1B0) -- From OS.
  865.         obj_color_change4_blue = readfloat(m_object + 0x1B4) -- From OS.
  866.         obj_color2_change_red = readfloat(m_object + 0x1B8) -- From OS.
  867.         obj_color2_change_green = readfloat(m_object + 0x1BC) -- From OS.
  868.         obj_color2_change_blue = readfloat(m_object + 0x1C0) -- From OS.
  869.         obj_color2_change2_red = readfloat(m_object + 0x1C4) -- From OS.
  870.         obj_color2_change2_green = readfloat(m_object + 0x1C8) -- From OS.
  871.         obj_color2_change2_blue = readfloat(m_object + 0x1CC) -- From OS.
  872.         obj_color2_change3_red = readfloat(m_object + 0x1D0) -- From OS.
  873.         obj_color2_change3_green = readfloat(m_object + 0x1D4) -- From OS.
  874.         obj_color2_change3_blue = readfloat(m_object + 0x1D8) -- From OS.
  875.         obj_color2_change4_red = readfloat(m_object + 0x1DC) -- From OS.
  876.         obj_color2_change4_green = readfloat(m_object + 0x1E0) -- From OS.
  877.         obj_color2_change4_blue = readfloat(m_object + 0x1E4) -- From OS.
  878.        
  879.         --one of these are for interpolating:
  880.         obj_header_block_ref_node_orientation_size = readword(m_object + 0x1E8) -- From OS.
  881.         obj_header_block_ref_node_orientation_offset = readword(m_object + 0x1EA) -- From OS.
  882.         obj_header_block_ref_node_orientation2_size = readword(m_object + 0x1EC) -- From OS.
  883.         obj_header_block_ref_node_orientation2_offset = readword(m_object + 0x1EE) -- From OS.
  884.         obj_header_block_ref_node_matrix_block_size = readword(m_object + 0x1F0) -- From OS.
  885.         obj_header_block_ref_node_matrix_block_offset = readword(m_object + 0x1F2) -- From OS.
  886.        
  887.         --unkLong[2] 0x1E8-0x1F0 (???) Some sort of ID?
  888.         --obj_node_matrix_block = readdword(m_object + 0x1F0) -- From OS. (???)
  889.        
  890.         if obj_type == 0 or obj_type == 1 then -- check if object is biped or vehicle
  891.            
  892.             --unit struct (applies to bipeds (players and AI) and vehicles)
  893.             m_unit = m_object
  894.            
  895.             unit_actor_index = readident(m_unit + 0x1F4) -- From OS.
  896.             unit_swarm_actor_index = readident(m_unit + 0x1F8) -- From OS.
  897.             unit_swarm_next_actor_index = readident(m_unit + 0x1FC) -- Guess.
  898.             unit_swarm_prev_obj_id = readident(m_unit + 0x200) -- From OS.
  899.            
  900.             --  Client Non-Instantaneous bitmask32
  901.             --  unkBit[4] 0-3 (???)
  902.                 unit_is_invisible = readbit(m_unit + 0x204, 4) -- Confirmed. (True if currently invisible, False if not)
  903.                 unit_powerup_additional = readbit(m_unit + 0x204, 5) -- From OS. Guessing this is set if you have multiple powerups at the same time.
  904.                 unit_is_currently_controllable_bit = readbit(m_unit + 0x204, 6) -- From OS.
  905.             --  unkBit[9] 7-15 (???)
  906.             --  unit_doesNotAllowPlayerEntry = readbit(m_unit + 0x204, 16) -- From DZS. For vehicles. (True if vehicle is allowing players to enter, False if not)
  907.             --  unkBit[2] 17-18 (???)
  908.                 unit_flashlight = readbit(m_unit + 0x204, 19) -- Confirmed. (True/False)
  909.                 unit_doesnt_drop_items = readbit(m_unit + 0x204, 20) -- Confirmed. (True if object doesn't drop items on death, otherwise False). (Clients will see player drop items, then immediately despawn)
  910.             --  unkBit[1] 21 (???)
  911.             --  unit_can_blink = readbit(m_unit + 0x204, 22) -- (???) Always False?
  912.             --  unkBit[1] 23 (???)
  913.                 unit_is_suspended = readbit(m_unit + 0x204, 24) -- Confirmed. (True if frozen/suspended, False if not)
  914.             --  unkBit[2] 25-26 (???)
  915.             --  unit_is_possessed = readbit(m_unit + 0x204, 27) -- (???) Always False?
  916.             --  unit_flashlight_currently_on = readbit(m_unit + 0x204, 28) -- (???) Always False?
  917.             --  unit_flashlight_currently_off = readbit(m_unit + 0x204, 29) -- (???) Always False?
  918.             --  unkBit[2] 30-31 (???)
  919.  
  920.             --  Client Action Keypress bitmask32 (Instantaneous actions).
  921.                 unit_crouch_presshold = readbit(m_unit + 0x208, 0) -- Confirmed. (True when holding crouch, False when not)
  922.                 unit_jump_presshold = readbit(m_unit + 0x208, 1)    -- Confirmed. (True when holding jump key, False when not)
  923.             --  unit_user1 = readbit(m_unit + 0x208, 3) -- (???) Always False?
  924.             --  unit_user2 = readbit(m_unit + 0x208, 4) -- (???) Always False?
  925.                 unit_flashlightkey = readbit(m_unit + 0x208, 4)-- Confirmed. (True when pressing flashlight key, False when not)
  926.             --  unit_exact_facing = readbit(m_unit + 0x208, 5) -- (???) Always False?
  927.                 unit_actionkey = readbit(m_unit + 0x208, 6) -- Confirmed. (True when pressing action key, False when not)
  928.                 unit_meleekey = readbit(m_unit + 0x208, 7)      -- Confirmed. (True when pressing melee key, False when not)
  929.             --  unit_look_without_turn = readbit(m_unit + 0x208, 8) -- (???) Always False?
  930.             --  unit_force_alert = readbit(m_unit + 0x208, 9) -- (???) Always False?
  931.                 unit_reload_key = readbit(m_unit + 0x208, 10)   -- Confirmed. (True when pressing action/reload key, False when not)
  932.                 unit_primaryWeaponFire_presshold = readbit(m_unit + 0x208, 11)      -- Confirmed. (True when holding left click, False when not)
  933.                 unit_secondaryWeaponFire_presshold = readbit(m_unit + 0x208, 12)    -- Confirmed. (True when holding right click, False when not)
  934.                 unit_grenade_presshold = readbit(m_unit + 0x208, 13)    -- Confirmed. (True when holding right click, False when not)
  935.                 unit_actionkey_presshold = readbit(m_unit + 0x208, 14)  -- Confirmed. (True when holding action key,  False when not)
  936.             --  emptyBit[1] 15
  937.            
  938.             --unkWord[2] 0x20A-0x20E related to first two words in unit_global_data
  939.             --unit_shield_sapping = readchar(m_unit + 0x20E) -- (???) Always 0?
  940.             unit_base_seat_index = readchar(m_unit + 0x20F) -- From OS.
  941.             --unit_time_remaining = readdword(m_unit + 0x210) -- (???) Always 0?
  942.             unit_flags = readdword(m_unit + 0x214) -- From OS. Bitmask32
  943.             unit_player_id = readident(m_unit + 0x218) -- Confirmed. Full DWORD ID of the Player.
  944.             unit_ai_effect_type = readword(m_unit + 0x21C) -- From OS. ai_unit_effect
  945.             unit_emotion_animation_index = readword(m_unit + 0x21E) -- From OS.
  946.             unit_last_bullet_time = gameinfo_current_time - readdword(m_unit + 0x220) -- Confirmed. Time since last shot fired. (1 second = 30 ticks) Related to unit_ai_effect_type. Lags immensely behind player_last_bullet_time.
  947.             unit_x_facing = readfloat(m_unit + 0x224) -- Confirmed. Same as unit_x_aim.
  948.             unit_y_facing = readfloat(m_unit + 0x228) -- Confirmed. Same as unit_y_aim.
  949.             unit_z_facing = readfloat(m_unit + 0x22C) -- Confirmed. Same as unit_z_aim.
  950.             unit_desired_x_aim = readfloat(m_unit + 0x230)  -- Confirmed. This is where the unit WANTS to aim.
  951.             unit_desired_y_aim = readfloat(m_unit + 0x234)  -- Confirmed. This is where the unit WANTS to aim.
  952.             unit_desired_z_aim = readfloat(m_unit + 0x238)  -- Confirmed. This is where the unit WANTS to aim.
  953.             unit_x_aim = readfloat(m_unit + 0x23C) -- Confirmed.
  954.             unit_y_aim = readfloat(m_unit + 0x240) -- Confirmed.
  955.             unit_z_aim = readfloat(m_unit + 0x244) -- Confirmed.
  956.             unit_x_aim_vel = readfloat(m_vehicle + 0x248) -- Confirmed. Does not apply to multiplayer bipeds
  957.             unit_y_aim_vel = readfloat(m_vehicle + 0x24C) -- Confirmed. Does not apply to multiplayer bipeds
  958.             unit_z_aim_vel = readfloat(m_vehicle + 0x250) -- Confirmed. Does not apply to multiplayer bipeds
  959.             unit_x_aim2 = readfloat(m_unit + 0x254) -- Confirmed.
  960.             unit_y_aim2 = readfloat(m_unit + 0x258) -- Confirmed.
  961.             unit_z_aim2 = readfloat(m_unit + 0x25C) -- Confirmed.
  962.             unit_x_aim3 = readfloat(m_unit + 0x260) -- Confirmed.
  963.             unit_y_aim3 = readfloat(m_unit + 0x264) -- Confirmed.
  964.             unit_z_aim3 = readfloat(m_unit + 0x268) -- Confirmed.
  965.             --unit_x_aim_vel2 = readfloat(m_unit + 0x26C) -- (???) Always 0?
  966.             --unit_y_aim_vel2 = readfloat(m_unit + 0x26C) -- (???) Always 0?
  967.             --unit_z_aim_vel2 = readfloat(m_unit + 0x26C) -- (???) Always 0?
  968.  
  969.             unit_forward = readfloat(m_unit + 0x278) -- Confirmed. Negative means backward. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  970.             unit_left = readfloat(m_unit + 0x27C) -- Confirmed. Negative means right. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  971.             unit_up = readfloat(m_unit + 0x280) -- Confirmed. Negative means down. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1) (JUMPING/FALLING DOESNT COUNT)
  972.             unit_shooting = readfloat(m_unit + 0x284) -- Confirmed. (Shooting = 1, Not Shooting = 0)
  973.             --unkByte[2] 0x288-0x28A melee related (state enum and counter?)
  974.             unit_time_until_flaming_death = readchar(m_unit + 0x28A) -- From OS (1 second = 30 ticks)
  975.             --unkByte[2] 0x28B-0x28D looks like the amount of frames left for the ping animation. Also set to the same PersistentControlTicks value when an actor dies and they fire-wildly
  976.             unit_throwing_grenade_state = readbyte(m_unit + 0x28D) -- Confirmed. (0 = not throwing) (1 = Arm leaning back) (2 = Grenade leaving hand) (3 = Grenade Thrown, soon back to normal state)
  977.             --unkWord[2] 0x28E-0x292 (???)
  978.             --Padding[2] 0x292-0x294
  979.             unit_thrown_grenade_obj_id = readident(m_unit + 0x294) -- Confirmed. 0xFFFFFFFF after grenade leaves hand.
  980.             --unkBit[16] -- (???) 0x298-0x29A -- From OS.
  981.             --unit_action = readword(m_unit + 0x29A) -- Tested. Something to do with actions. (Crouching, throwing nade, walking) (animation index, weapon type)
  982.             --unkWord[1] 0x29C-0x29E animation index
  983.             --unkWord[1] 0x29E-0x2A0 appears unused except for getting initialized
  984.             unit_crouch = readbyte(m_unit + 0x2A0) -- Confirmed. (Standing = 4) (Crouching = 3) (Vehicle = 0)
  985.             unit_weap_slot = readbyte(m_unit + 0x2A1) -- Confirmed. Current weapon slot. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  986.             unit_weap_index_type = readbyte(m_unit + 0x2A2) -- Tested. (0 = Rocket Launcher) (1 = Plasma Pistol) (2 = Shotgun) (3 = Plasma Rifle) don't care to continue
  987.             unit_animation_state = readbyte(m_unit + 0x2A3) -- Confirmed. (0 = Idle, 1 = Gesture, Turn Left = 2, Turn Right = 3, Move Front = 4, Move Back = 5, Move Left = 6, Move Right = 7, Stunned Front = 8, Stunned Back = 9, Stunned Left = 10, Stunned Right = 11, Slide Front = 12, Slide Back = 13, Slide Left = 14, Slide Right = 15, Ready = 16, Put Away = 17, Aim Still = 18, Aim Move = 19, Airborne = 20, Land Soft = 21, Land Hard = 22, ??? = 23, Airborne Dead = 24, Landing Dead = 25, Seat Enter = 26, Seat Exit = 27, Custom Animation = 28, Impulse = 29, Melee = 30, Melee Airborne = 31, Melee Continuous = 32, Grenade Toss = 33, Resurrect Front = 34, Ressurect Back = 35, Feeding = 36, Surprise Front = 37, Surprise Back = 38, Leap Start = 39, Leap Airborne = 40, Leap Melee = 41, Unused AFAICT = 42, Berserk = 43)
  988.             unit_reloadmelee = readbyte(m_unit + 0x2A4) -- Confirmed. (Reloading = 5) (Meleeing = 7)
  989.             unit_shooting2 = readbyte(m_unit + 0x2A5) -- Confirmed. (Shooting = 1) (No = 0)
  990.             unit_animation_state2 = readbyte(m_unit + 0x2A6) -- Confirmed. (0 = Idle, 1 = Gesture, Turn Left = 2, Turn Right = 3, Move Front = 4, Move Back = 5, Move Left = 6, Move Right = 7, Stunned Front = 8, Stunned Back = 9, Stunned Left = 10, Stunned Right = 11, Slide Front = 12, Slide Back = 13, Slide Left = 14, Slide Right = 15, Ready = 16, Put Away = 17, Aim Still = 18, Aim Move = 19, Airborne = 20, Land Soft = 21, Land Hard = 22, ??? = 23, Airborne Dead = 24, Landing Dead = 25, Seat Enter = 26, Seat Exit = 27, Custom Animation = 28, Impulse = 29, Melee = 30, Melee Airborne = 31, Melee Continuous = 32, Grenade Toss = 33, Resurrect Front = 34, Ressurect Back = 35, Feeding = 36, Surprise Front = 37, Surprise Back = 38, Leap Start = 39, Leap Airborne = 40, Leap Melee = 41, Unused AFAICT = 42, Berserk = 43)
  991.             unit_crouch2 = readbyte(m_unit + 0x2A7) -- Confirmed. (Standing = 2) (Crouching = 3)
  992.             --unkByte[2] 0x2A8-0x2AA (???)
  993.             --unit_ping_state_animation_index = readword(m_unit + 0x2AA) -- (???) Always 0xFFFF?
  994.             unit_ping_state_frame_index = readword(m_unit + 0x2AC) -- Tested. Counts up from 0 after you perform an action (reload, melee, etc) until it hits a random final number depending on action.
  995.             --don't care enough to test these 4, if I don't know what above 2 are then there's no point.
  996.             unit_unknown_state_animation_index = readword(m_unit + 0x2AE) -- From OS.
  997.             unit_unknown_state_frame_index = readword(m_unit + 0x2B0) -- From OS.
  998.             unit_fpweapon_state_animation_index = readword(m_unit + 0x2B2) -- From OS.
  999.             unit_fpweapon_state_frame_index = readword(m_unit + 0x2B4) -- From OS.
  1000.             --unkByte[1] 0x2B6-0x2B7 (???) look related.
  1001.             --unkByte[1] 0x2B7-0x2B8 (???) aim related.
  1002.             unit_aim_rectangle_top_x = readfloat(m_unit + 0x2B8) -- Confirmed. Top-most aim possible.
  1003.             unit_aim_rectangle_bottom_x = readfloat(m_unit + 0x2BC) -- Confirmed. Bottom-most aim possible.
  1004.             unit_aim_rectangle_left_y = readfloat(m_unit + 0x2C0) -- Confirmed. Left-most aim possible.
  1005.             unit_aim_rectangle_right_y = readfloat(m_unit + 0x2C4) -- Confirmed. Right-most aim possible.
  1006.             unit_look_rectangle_top_x = readfloat(m_unit + 0x2C8) -- Confirmed. Top-most look possible. Same as unit_aim_rectangle_top_x.
  1007.             unit_look_rectangle_bottom_x = readfloat(m_unit + 0x2CC) -- Confirmed. Bottom-most look possible. Same as unit_aim_rectangle_bottom_x.
  1008.             unit_look_rectangle_left_y = readfloat(m_unit + 0x2D0) -- Confirmed. Left-most look possible. Same as unit_aim_rectangle_left_y.
  1009.             unit_look_rectangle_right_y = readfloat(m_unit + 0x2D4) -- Confirmed. Right-most look possible. Same as unit_aim_rectangle_right_y.
  1010.             --Padding[8] 0x2D8-0x2E0
  1011.             --unit_ambient = readfloat(m_unit + 0x2E0) -- (???) Always 0?
  1012.             --unit_illumination = readfloat(m_unit + 0x2E4) -- (???)
  1013.             unit_mouth_aperture = readfloat(m_unit + 0x2E8) -- From OS.
  1014.             --Padding[4] 0x2EC-0x2F0
  1015.             unit_vehi_seat = readword(m_unit + 0x2F0) -- Confirmed. (Warthog seats: Driver = 0, Passenger = 1, Gunner = 2 Not in vehicle = 0xFFFF)
  1016.             unit_weap_slot2 = readword(m_unit + 0x2F2) -- Confirmed. Current weapon slot. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  1017.             unit_next_weap_slot = readword(m_unit + 0x2F4) -- Confirmed. Weapon slot the player is trying to change to. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  1018.             --unkByte[2] 0x2F6-0x2F8 (Padding Maybe?)
  1019.                 unit_next_weap_obj_id = readident(m_unit + 0x2F8 + unit_next_weap_slot*4) -- Confirmed. Object ID of the weapon that the player is trying to change to.
  1020.             unit_primary_weap_obj_id = readident(m_unit + 0x2F8) -- Confirmed.
  1021.             unit_secondary_weap_obj_id = readident(m_unit + 0x2FC) -- Confirmed.
  1022.             unit_tertiary_weap_obj_id = readident(m_unit + 0x300) -- Confirmed.
  1023.             unit_quaternary_weap_obj_id = readident(m_unit + 0x304) -- Confirmed.
  1024.             unit_primaryWeaponLastUse = gameinfo_current_time - readdword(m_unit + 0x308) -- From DZS. Time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  1025.             unit_secondaryWeaponLastUse = gameinfo_current_time - readdword(m_unit + 0x30C) -- From DZS. Time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  1026.             unit_tertiaryWeaponLastUse = gameinfo_current_time - readdword(m_unit + 0x310) -- From DZS. Time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  1027.             unit_quaternaryWeaponLastUse = gameinfo_current_time - readdword(m_unit + 0x314) -- From DZS. Time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  1028.             unit_objective = readdword(m_unit + 0x318) -- Tested. Increases every time you interact with the objective.
  1029.             unit_current_nade_type = readchar(m_unit + 0x31C) -- Confirmed. (Frag = 0) (Plasma = 1)
  1030.             unit_next_nade_type = readbyte(m_unit + 0x31D) -- Confirmed. Grenade type the player is trying to change to. (Frag = 0) (Plasma = 1)
  1031.             unit_primary_nades = readbyte(m_unit + 0x31E) -- Confirmed. Amount of frag grenades you have.
  1032.             unit_secondary_nades = readbyte(m_unit + 0x31F) -- Confirmed. Amount of plasma grenades you have.
  1033.             unit_zoom_level = readbyte(m_unit + 0x320) -- Confirmed. The level of zoom the player is at. (0xFF = not zoomed, 0 = first zoom lvl, 1 = second zoom lvl)
  1034.             unit_desired_zoom_level = readbyte(m_unit + 0x321) -- Confirmed. Where the player wants to zoom. (0xFF = not zoomed, 0 = first zoom lvl, 1 = second zoom lvl)
  1035.             unit_vehicle_speech_timer = readchar(m_unit + 0x322) -- Tested. Counts up from 0 after reloading, shooting, or throwing nade.
  1036.             unit_aiming_change = readbyte(m_unit + 0x323) -- Tested. This is 'confirmed' except I don't know what units. Does not apply to multiplayer bipeds.
  1037.             unit_master_obj_id = readident(m_vehicle + 0x324) -- Confirmed. Object ID controlling this unit (driver)
  1038.             unit_masterofweapons_obj_id = readident(m_vehicle + 0x328) -- Confirmed. Object ID controlling the weapons of this unit (gunner)
  1039.             unit_passenger_obj_id = readident(m_vehicle + 0x32C) -- Confirmed for vehicles. 0xFFFFFFFF for bipeds
  1040.             unit_time_abandoned_parent = gameinfo_current_time - readdword(m_unit + 0x330) -- Confirmed. Time since player ejected from vehicle.
  1041.             unit_some_obj_id = readident(m_unit + 0x334) -- From OS.
  1042.             unit_vehicleentry_scale = readfloat(m_unit + 0x338) -- Tested. Intensity of vehicle entry as you enter a vehicle (0 to 1)
  1043.             --unit_power_of_masterofweapons = readfloat(m_unit + 0x33C) -- (???) Always 0?
  1044.             unit_flashlight_scale = readfloat(m_unit + 0x340) -- Confirmed. Intensity of flashlight as it turns on and off. (0 to 1) (On > 0) (Off = 0)
  1045.             unit_flashlight_energy = readfloat(m_unit + 0x344) -- Confirmed. Amount of flashlight energy left. (0 to ~1)
  1046.             unit_nightvision_scale = readfloat(m_unit + 0x348) -- Confirmed. Intensity of nightvision as it turns on and off. (0 to 1) (On = 1) (Off = 0)
  1047.             --unkFloat[12] 0x34C-0x37C Seat-related
  1048.             unit_invis_scale = readfloat(m_unit + 0x37C) -- Confirmed. How invisible you are. (0 to 1) (Completely = 1) (None = 0)
  1049.             --unit_fullspectrumvision_scale = readfloat(m_unit + 0x380) -- (???) Always 0, even when picking up a fullspectrum vision.
  1050.             unit_dialogue_definition = readident(m_unit + 0x384) -- From OS.
  1051.            
  1052.             -->>SPEECH<<--
  1053.             --AI Current Speech:
  1054.             unit_speech_priority = readword(m_unit + 0x388) -- From OS. (0 = None) (1 = Idle) (2 = Pain) (3 = Talk) (4 = Communicate) (5 = Shout) (6 = Script) (7 = Involuntary) (8 = Exclaim) (9 = Scream) (10 = Death)
  1055.             unit_speech_scream_type = readword(m_unit + 0x38A) -- From OS. (0 = Fear) (1 = Enemy Grenade) (2 = Pain) (3 = Maimed Limb) (4 = Maimed Head) (5 = Resurrection)
  1056.             unit_sound_definition = readident(m_unit + 0x38C) -- From OS.
  1057.             --unkWord[1] 0x390-0x392 time-related.
  1058.             --Padding[2] 0x392-0x394
  1059.             --unkLong[2] 0x394-0x39C (???)
  1060.             --unkWord[1] 0x39C-0x39E (???)
  1061.             unit_ai_current_communication_type = readword(m_unit + 0x39E) -- From OS. (0 = Death) (1 = Killing Spree) (2 = Hurt) (3 = Damage) (4 = Sighted Enemy) (5 = Found Enemy) (6 = Unexpected Enemy) (7 = Found dead friend) (8 = Allegiance Changed) (9 = Grenade Throwing) (10 = Grenade Startle) (11 = Grenade Sighted) (12 = Grenade Danger) (13 = Lost Contact) (14 = Blocked) (15 = Alert Noncombat) (16 = Search Start) (17 = Search Query) (18 = Search Report) (19 = Search Abandon) (20 = Search Group Abandon) (21 = Uncover Start) (22 = Advance) (23 = Retreat) (24 = Cover) (25 = Sighted Friend Player) (26 = Shooting) (27 = Shooting Vehicle) (28 = Shooting Berserk) (29 = Shooting Group) (30 = Shooting Traitor) (31 = Flee) (32 = Flee Leader Died) (33 = Flee Idle) (34 = Attempted Flee) (35 = Hiding Finished) (36 = Vehicle Entry) (37 = Vehicle Exit) (38 = Vehicle Woohoo) (39 = Vehicle Scared) (40 = Vehicle Falling) (41 = Surprise) (42 = Berserk) (43 = Melee) (44 = Dive) (45 = Uncover Exclamation) (46 = Falling) (47 = Leap) (48 = Postcombat Alone) (49 = Postcombat Unscathed) (50 = Postcombat Wounded) (51 = Postcombat Massacre) (52 = Postcombat Triumph) (53 = Postcombat Check Enemy) (54 = Postcombat Check Friend) (55 = Postcombat Shoot Corpse) (56 = Postcombat Celebrate)
  1062.             --unkWord[1] 0x3A0-0x3A2 (???)
  1063.             --Padding[2] 0x3A2-0x3A4
  1064.             --unkWord[1] 0x3A4-0x3A6 (???)
  1065.             --Padding[6] 0x3A6-0x3AC
  1066.             --unkWord[1] 0x3AC-0x3AE (???)
  1067.             --Padding[2] 0x3AE-0x3B0
  1068.             --unkWord[2] 0x3B0-0x3B4 (???)
  1069.             --  bitmask8
  1070.                 unit_ai_current_communication_broken = readbit(m_unit + 0x3B4, 0) -- From OS. 1C false = reformed
  1071.             --  unkBit[7] 1-7 (???)
  1072.             --Padding[3] 0x3B5-0x3B8
  1073.            
  1074.             --AI Next Speech (I think):
  1075.             unit_speech_priority2 = readword(m_unit + 0x3B8) -- From OS. (0 = None) (1 = Idle) (2 = Pain) (3 = Talk) (4 = Communicate) (5 = Shout) (6 = Script) (7 = Involuntary) (8 = Exclaim) (9 = Scream) (10 = Death)
  1076.             unit_speech_scream_type2 = readword(m_unit + 0x3BA) -- From OS. (0 = Fear) (1 = Enemy Grenade) (2 = Pain) (3 = Maimed Limb) (4 = Maimed Head) (5 = Resurrection)
  1077.             unit_sound_definition2 = readident(m_unit + 0x3BC) -- From OS.
  1078.             --unkWord[1] 0x3C0-0x3C2 time-related.
  1079.             --Padding[2] 0x3C2-0x3C4
  1080.             --unkLong[2] 0x3C4-0x3CC (???)
  1081.             --unkWord[1] 0x3CC-0x3CE (???)
  1082.             unit_ai_current_communication_type2 = readword(m_unit + 0x3CE) -- From OS. (0 = Death) (1 = Killing Spree) (2 = Hurt) (3 = Damage) (4 = Sighted Enemy) (5 = Found Enemy) (6 = Unexpected Enemy) (7 = Found dead friend) (8 = Allegiance Changed) (9 = Grenade Throwing) (10 = Grenade Startle) (11 = Grenade Sighted) (12 = Grenade Danger) (13 = Lost Contact) (14 = Blocked) (15 = Alert Noncombat) (16 = Search Start) (17 = Search Query) (18 = Search Report) (19 = Search Abandon) (20 = Search Group Abandon) (21 = Uncover Start) (22 = Advance) (23 = Retreat) (24 = Cover) (25 = Sighted Friend Player) (26 = Shooting) (27 = Shooting Vehicle) (28 = Shooting Berserk) (29 = Shooting Group) (30 = Shooting Traitor) (31 = Flee) (32 = Flee Leader Died) (33 = Flee Idle) (34 = Attempted Flee) (35 = Hiding Finished) (36 = Vehicle Entry) (37 = Vehicle Exit) (38 = Vehicle Woohoo) (39 = Vehicle Scared) (40 = Vehicle Falling) (41 = Surprise) (42 = Berserk) (43 = Melee) (44 = Dive) (45 = Uncover Exclamation) (46 = Falling) (47 = Leap) (48 = Postcombat Alone) (49 = Postcombat Unscathed) (50 = Postcombat Wounded) (51 = Postcombat Massacre) (52 = Postcombat Triumph) (53 = Postcombat Check Enemy) (54 = Postcombat Check Friend) (55 = Postcombat Shoot Corpse) (56 = Postcombat Celebrate)
  1083.             --unkWord[1] 0x3D0-0x3D2 (???)
  1084.             --Padding[2] 0x3D2-0x3D4
  1085.             --unkWord[1] 0x3D4-0x3D6 (???)
  1086.             --Padding[6] 0x3D6-0x3DC
  1087.             --unkWord[1] 0x3DC-0x3DE (???)
  1088.             --Padding[2] 0x3DE-0x3E0
  1089.             --unkWord[2] 0x3E0-0x3E4 (???)
  1090.             --  bitmask8
  1091.                 unit_ai_current_communication_broken2 = readbit(m_unit + 0x3E4, 0) -- From OS. 1C false = reformed
  1092.             --  unkBit[7] 1-7 (???)
  1093.             --Padding[3] 0x3E5-0x3E8
  1094.            
  1095.             --unkWord[4] 0x3E8-0x3F0
  1096.             --unkLong[1] 0x3F0 time related
  1097.             --unkBit[32] 0x3F4-0x3F8 0-31 (???)
  1098.             --unkWord[4] 0x3F8-0x400 (???)
  1099.             --unkLong[1] 0x400-0x404 (???)
  1100.             -->>END OF SPEECH<<--
  1101.            
  1102.             unit_damage_type = readword(m_unit + 0x404) -- Tested. (Not being damaged = 0) (Being damaged = 2) (Enum here)
  1103.             --unit_damage2 = readword(m_unit + 0x406) -- Tested. Changes when damaged. Changes back.
  1104.             --unit_damage3 = readfloat(m_unit + 0x408) -- Tested. Changes when damaged. Changes back.
  1105.             unit_causing_objId = readident(m_unit + 0x40C) -- Confirmed. ObjId causing damage to this object.
  1106.             --unit_flamer_causer_objId = readident(m_unit + 0x410) -- (???) Always 0xFFFFFFFF?
  1107.             --Padding[8] 0x414-0x41C
  1108.             --unit_death_time = readdword(m_unit + 0x41C) -- (???) Always 0xFFFFFFFF?
  1109.             --unit_feign_death_timer = readword(m_unit + 0x420) -- (???) Always 0xFFFFFFFF?
  1110.             unit_camo_regrowth = readword(m_unit + 0x422) -- Confirmed. (1 = Camo Failing due to damage/shooting)
  1111.             --unit_stun_amount = readfloat(m_unit + 0x424) -- (???) Always 0?
  1112.             --unit_stun_timer = readword(m_unit + 0x428) -- (???) Always 0?
  1113.             unit_killstreak = readword(m_unit + 0x42A) -- Tested. Same as player_killstreak.
  1114.             unit_last_kill_time = gameinfo_current_time - readdword(m_unit + 0x42C) -- Confirmed. Time since last kill time. (1 sec = 30 ticks)
  1115.            
  1116.             --I realize the below are confusing, and if you really don't understand them after looking at it, I will explain it if you contact me about them:
  1117.             --I have no idea why halo stores these, only thing I can think of is because of betrayals or something.. but still..
  1118.             unit_last_damage_time_by_mostrecent_objId = gameinfo_current_time - readdword(m_unit + 0x430) -- Confirmed. Time since last taken damage by MOST RECENT object. (1 second = 30 ticks)
  1119.             unit_total_damage_by_mostrecent_objId = readfloat(m_unit + 0x434) -- Confirmed. Total damage done by the MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1120.             unit_damage_mostrecent_causer_objId = readident(m_unit + 0x438) -- Confirmed. the MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1121.             unit_damage_mostrecent_causer_playerId = readident(m_unit + 0x43C) -- Confirmed. Full DWORD ID of the MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1122.             unit_last_damage_time_by_secondtomostrecent_obj = gameinfo_current_time - readdword(m_unit + 0x440) -- Confirmed. Time since last taken damage by the SECOND TO MOST RECENT object. (1 second = 30 ticks)
  1123.             unit_total_damage_by_secondtomostrecent_obj = readfloat(m_unit + 0x444) -- Confirmed. Total damage done by the SECOND TO MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1124.             unit_damage_secondtomostrecent_causing_objId = readident(m_unit + 0x448) -- Confirmed. the SECOND TO MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1125.             unit_damage_secondtomostrecent_causing_playerId = readident(m_unit + 0x44C) -- Confirmed. Full DWORD ID of the SECOND TO MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1126.             unit_last_damage_time_by_thirdtomostrecent_obj = gameinfo_current_time - readdword(m_unit + 0x450) -- Confirmed. Time since last taken damage by the THIRD TO MOST RECENT object. (1 second = 30 ticks)
  1127.             unit_total_damage_by_thirdtomostrecent_obj = readfloat(m_unit + 0x454) -- Confirmed. Total damage done by the THIRD TO MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1128.             unit_damage_thirdtomostrecent_causing_objId = readident(m_unit + 0x458) -- Confirmed. the THIRD TO MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1129.             unit_damage_thirdtomostrecent_causing_playerId = readident(m_unit + 0x45C) -- Confirmed. Full DWORD ID of the THIRD TO MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1130.             unit_last_damage_time_by_fourthtomostrecent_obj = gameinfo_current_time - readdword(m_unit + 0x460) -- Confirmed. Time since last taken damage by the FOURTH TO MOST RECENT object. (1 second = 30 ticks)
  1131.             unit_total_damage_by_fourthtomostrecent_obj = readfloat(m_unit + 0x464) -- Confirmed. Total damage done by the FOURTH TO MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1132.             unit_damage_fourthtomostrecent_causing_objId = readident(m_unit + 0x468) -- Confirmed. the FOURTH TO MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1133.             unit_damage_fourthtomostrecent_causing_playerId = readident(m_unit + 0x46C) -- Confirmed. Full DWORD ID of the FOURTH TO MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1134.             --Padding[4] 0x470-0x474
  1135.             unit_shooting3 = readbyte(m_unit + 0x474) -- Confirmed. (Shooting = 1) (No = 0) 'unused'
  1136.             --unkByte[1] 0x475-0x476 (???) 'unused'
  1137.             --Padding[2] 0x476-0x478
  1138.             --unit_animation_state3 = readbyte(m_unit + 0x478) -- (???) Always 3?
  1139.             --unit_aiming_speed2 = readbyte(m_unit + 0x479) -- (???) Always 0?
  1140.             --  Client Action Keypress bitmask32 (Instantaneous actions).
  1141.                 unit_crouch2_presshold = readbit(m_unit + 0x47A, 0) -- Confirmed. (True when holding crouch, False when not)
  1142.                 unit_jump2_presshold = readbit(m_unit + 0x47A, 1)   -- Confirmed. (True when holding jump key, False when not)
  1143.             --  unit_user1_2 = readbit(m_unit + 0x47A, 3) -- (???) Always false?
  1144.             --  unit_user2_2 = readbit(m_unit + 0x47A, 4) -- (???) Always false?
  1145.                 unit_flashlightkey2 = readbit(m_unit + 0x47A, 4)-- Confirmed. (True when pressing flashlight key, False when not)
  1146.             --  unit_exact_facing2 = readbit(m_unit + 0x47A, 5) -- (???) Always false?
  1147.                 unit_actionkey2 = readbit(m_unit + 0x47A, 6)    -- Confirmed. (True when pressing action key, False when not)
  1148.                 unit_meleekey2 = readbit(m_unit + 0x47A, 7)     -- Confirmed. (True when pressing melee key, False when not)
  1149.             --  unit_look_without_turn2 = readbit(m_unit + 0x47A, 8) -- (???) Always false?
  1150.             --  unit_force_alert2 = readbit(m_unit + 0x47A, 9) -- (???) Always false?
  1151.                 unit_reload_key2 = readbit(m_unit + 0x47A, 10)  -- Confirmed. (True when pressing action/reload key, False when not)
  1152.                 unit_primaryWeaponFire_presshold2 = readbit(m_unit + 0x47A, 11) -- Confirmed. (True when holding left click, False when not)
  1153.                 unit_secondaryWeaponFire_presshold2 = readbit(m_unit + 0x47A, 12)   -- Confirmed. (True when holding right click, False when not)
  1154.                 unit_grenade_presshold2 = readbit(m_unit + 0x47A, 13)   -- Confirmed. (True when holding right click, False when not)
  1155.                 unit_actionkey_presshold2 = readbit(m_unit + 0x47A, 14) -- Confirmed. (True when holding action key,  False when not)
  1156.             --  emptyBit[1] 15
  1157.             unit_weap_slot3 = readbyte(m_unit + 0x47C) -- Confirmed. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  1158.             unit_nade_type = readbyte(m_unit + 0x47E) -- Confirmed. (Frag = 0) (Plasma = 1)
  1159.             unit_zoom_level2 = readword(m_unit + 0x480) -- Confirmed. The level of zoom the player is at. (0xFFFF = not zoomed, 0 = first zoom lvl, 1 = next zoom lvl, etc...)
  1160.             --Padding[2] 0x482-0x484
  1161.             unit_x_vel2 = readfloat(m_unit + 0x484) -- Confirmed.
  1162.             unit_y_vel2 = readfloat(m_unit + 0x488) -- Confirmed.
  1163.             unit_z_vel2 = readfloat(m_unit + 0x48C) -- Confirmed.
  1164.             unit_primary_trigger = readfloat(m_unit + 0x490) -- Confirmed. (1 = Holding down primaryFire button) (0 = not firing) Doesn't necessarily mean unit is shooting.
  1165.             unit_x_aim4 = readfloat(m_unit + 0x494) -- Confirmed.
  1166.             unit_y_aim4 = readfloat(m_unit + 0x498) -- Confirmed.
  1167.             unit_z_aim4 = readfloat(m_unit + 0x49C) -- Confirmed.
  1168.             unit_x_aim5 = readfloat(m_unit + 0x4A0) -- Confirmed.
  1169.             unit_y_aim5 = readfloat(m_unit + 0x4A4) -- Confirmed.
  1170.             unit_z_aim5 = readfloat(m_unit + 0x4A8) -- Confirmed.
  1171.             unit_x_aim6 = readfloat(m_unit + 0x4AC) -- Confirmed.
  1172.             unit_y_aim6 = readfloat(m_unit + 0x4B0) -- Confirmed.
  1173.             unit_z_aim6 = readfloat(m_unit + 0x4B4) -- Confirmed.
  1174.             --  bitmask32:
  1175.                 unit_last_completed_client_update_id_valid = readbit(m_unit + 0x4B8, 0) -- From OS.
  1176.             --  unkBit[31] 1-31 (???)
  1177.             unit_last_completed_client_update_id = readdword(m_unit + 0x4BC) -- From OS.
  1178.             --Padding[12] 0x4C0-0x4CC unused.
  1179.         end
  1180.        
  1181.         if obj_type == 0 then -- check if object is a biped.
  1182.        
  1183.             -- Biped Struct. Definition is a two legged creature, but applies to ALL AI and all players.
  1184.             m_biped = m_object
  1185.            
  1186.             --  bitmask32:
  1187.                 bipd_is_airborne = readbit(m_biped + 0x4CC, 0) -- Confirmed. (Airborne = True, No = False)
  1188.             --  bipd_is_slipping = readbit(m_biped + 0x4CC, 1) -- (???) Always False?
  1189.             --  unkBit[30] 2-31
  1190.             --unkByte[1] 0x4D0 (???) 1
  1191.             --unkByte[2] 0x4D1 (???)
  1192.             bipd_movement_state = readbyte(m_biped + 0x4D2) -- Confirmed. (Standing = 0) (Walking = 1) (Idle/Turning = 2) (Gesturing?? = 3)
  1193.             --unkByte[5] 0x4D3-0x4D8 (Padding Maybe?)
  1194.             bipd_action = readbyte(m_biped + 0x4D8) -- Tested. Something to do with walking and jumping.
  1195.             --unkByte[1] 0x4D9-0x4DA (Padding Maybe?)
  1196.             bipd_action2 = readbyte(m_biped + 0x4DA) -- Tested. Something to do with walking and jumping.
  1197.             --unkByte[5] 0x4DB (???)
  1198.             bipd_x_coord = readfloat(m_biped + 0x4E0) -- Confirmed.
  1199.             bipd_y_coord = readfloat(m_biped + 0x4E4) -- Confirmed.
  1200.             bipd_z_coord = readfloat(m_biped + 0x4E8) -- Confirmed.
  1201.             --unkLong[4] 0x4EC-0x4FC (???)
  1202.             bipd_bumped_obj_id = readident(m_biped + 0x4FC) -- Confirmed. Object ID of any object you bump into (rocks, weapons, players, vehicles, ANY object)
  1203.             bipd_time_since_last_bump = readchar(m_biped + 0x500) -- Tested. Counts backwards from 0 to -15 when bumped. Glitchy. Don't rely on this.
  1204.             bipd_airborne_time = readchar(m_biped + 0x501) -- Confirmed. (1 sec = 30 ticks)
  1205.             --bipd_slipping_time = readchar(m_biped + 0x502) -- (???) Always 0?
  1206.             --unkChar[1] 0x503-0x504 (???)
  1207.             bipd_jump_time = readchar(m_biped + 0x504) -- Tested. Counts up from 0 after landing from a jump, and returns to 0 after you hit the ground (1 sec = 30 ticks).
  1208.             --unkChar[2] 0x505-0x507 sbyte timer, melee related.
  1209.             --Padding[1] 0x507-0x508
  1210.             --unkWord[1] 0x508-0x50A (???)
  1211.             --Padding[2] 0x50A-0x50C
  1212.             bipd_crouch_scale = readfloat(m_biped + 0x50C) -- Confirmed. How crouched you are. (0 to 1) (Crouching = 1) (Standing = 0)
  1213.             --unkFloat[1] 0x510-0x514 (???)
  1214.             --unk_realPlane3d[1] 0x514-0x524 physics related (xyzd)
  1215.             --unkChar[2] 0x524-0x526 (???)
  1216.             --  bitmask8
  1217.                 bipd_baseline_valid = readbit(m_biped + 0x526, 0) -- From OS.
  1218.             --  unkBit[7] 1-7 (???)
  1219.             bipd_baseline_index = readchar(m_biped + 0x527) -- From OS.
  1220.             bipd_message_index = readchar(m_biped + 0x528) -- From OS.
  1221.             --Padding[3] 0x529-0x52C
  1222.            
  1223.             --  baseline update
  1224.             bipd_primary_nades = readbyte(m_biped + 0x52C) -- Confirmed. Number of frag grenades.
  1225.             bipd_secondary_nades = readbyte(m_biped + 0x52D) -- Confirmed. Number of plasma grenades.
  1226.             --Padding[2] 0x52E-0x530
  1227.             bipd_health = readfloat(m_biped + 0x530) -- Confirmed. (0 to 1). Lags behind obj_health.
  1228.             bipd_shield = readfloat(m_biped + 0x534) -- Confirmed. (0 to 1). Lags behind obj_health.
  1229.             --  bitmask8
  1230.                 bipd_shield_stun_time_greater_than_zero = readbit(m_biped + 0x538, 0) -- From OS.
  1231.             --  unkBit[7] 1-7 (???)
  1232.             --Padding[3] 0x539-0x53C
  1233.             --  bitmask8
  1234.             --  unkBit[8] 0x53C 0-7 (???)
  1235.             --Padding[3] 0x53D-0x540
  1236.            
  1237.             --  delta update
  1238.             --bipd_primary_nades2 = readbyte(m_biped + 0x540) -- (???) Always 0?
  1239.             --bipd_secondary_nades2 = readbyte(m_biped + 0x541) -- (???) Always 0?
  1240.             --Padding[2] 0x542-0x544
  1241.             --bipd_health2 = readfloat(m_biped + 0x544) -- (???) Always 0? (0 to 1)
  1242.             --bipd_shield2 = readfloat(m_biped + 0x548) -- (???) Always 0? (0 to 1)
  1243.             --  bitmask8
  1244.                 bipd_shield_stun_time_greater_than_zero2 = readbit(m_biped + 0x54C, 0) -- From OS.
  1245.             --  unkBit[7] 1-7 (???)
  1246.             --Padding[3] 0x54D-0x550
  1247.            
  1248.             --these are all just friggin rediculous...
  1249.             function getBodyPart(address, offset)
  1250.                 address = address + (offset or 0x0)
  1251.                 local bodypart = {}
  1252.                 --this puts unknown floats in the table.
  1253.                 --accessed by hprintf(bodypart.unkfloat1) hprintf(bodypart.unkfloat2) etc...
  1254.                 for i = 0,9 do
  1255.                     bodypart["unkfloat"..i+1] = readfloat(address + i*4) -- (???) Probably rotations.
  1256.                 end
  1257.                 --accessed by hprintf(bodypart.x) hprintf(bodypart.y) etc...
  1258.                 bodypart.x = readfloat(address + 0x28) -- Confirmed.
  1259.                 bodypart.y = readfloat(address + 0x2C) -- Confirmed.
  1260.                 bodypart.z = readfloat(address + 0x30) -- Confirmed.
  1261.                 return bodypart
  1262.             end
  1263.            
  1264.             function getBodyPartLocation(address, offset)
  1265.                 address = address + (offset or 0x0)
  1266.                 --unkFloats[10] (???) Probably rotations.
  1267.                 bipd_bodypart_x = readfloat(m_biped + 0x28)
  1268.                 bipd_bodypart_y = readfloat(m_biped + 0x2C)
  1269.                 bipd_bodypart_z = readfloat(m_biped + 0x30)
  1270.                 return bipd_bodypart_x,bipd_bodypart_y,bipd_bodypart_z
  1271.             end
  1272.  
  1273.             --All of these are from SuperAbyll.
  1274.             --getBodyPart returns a table full of x,y,z coords + unknown floats
  1275.             --getBodyPartLocation returns 3 values (x, y, and z coordinates)
  1276.             bipd_left_thigh = getBodyPart(m_biped + 0x550)
  1277.                 --if you just want the coordinates, you can do this instead for each bodypart:
  1278.                 x,y,z = getBodyPartLocation(m_biped + 0x550) -- XYZ coordinates for the left thigh.
  1279.             bipd_right_thigh = getBodyPart(m_biped + 0x584)
  1280.             bipd_pelvis = getBodyPart(m_biped + 0x5B8)
  1281.             bipd_left_calf = getBodyPart(m_biped + 0x5EC)
  1282.             bipd_right_calf = getBodyPart(m_biped + 0x620)
  1283.             bipd_spine = getBodyPart(m_biped + 0x654)
  1284.             bipd_left_clavicle = getBodyPart(m_biped + 0x688)
  1285.             bipd_left_foot = getBodyPart(m_biped + 0x6BC)
  1286.             bipd_neck = getBodyPart(m_biped + 0x6F0)
  1287.             bipd_right_clavicle = getBodyPart(m_biped + 0x724)
  1288.             bipd_right_foot = getBodyPart(m_biped + 0x758)
  1289.             bipd_head = getBodyPart(m_biped + 0x78C)
  1290.             bipd_left_upper_arm = getBodyPart(m_biped + 0x7C0)
  1291.             bipd_right_upper_arm = getBodyPart(m_biped + 0x7F4)
  1292.             bipd_left_lower_arm = getBodyPart(m_biped + 0x828)
  1293.             bipd_right_lower_arm = getBodyPart(m_biped + 0x85C)
  1294.             bipd_left_hand = getBodyPart(m_biped + 0x890)
  1295.             bipd_right_hand = getBodyPart(m_biped + 0x8C4)
  1296.            
  1297.             --The coordinates from these can be accessed doing the following
  1298.             --let's say I want to tell the whole server the y coordinate of this object's right foot. I would do: say(bipd_right_foot.y)
  1299.             say(bipd_right_foot.y) -- **SERVER**: 52.7130341548629
  1300.        
  1301.         elseif obj_type == 1 then -- check if object is a vehicle
  1302.        
  1303.             -- vehi struct
  1304.             -- Thank you 002 and shaft for figuring out that there's a struct here:
  1305.             --  bitmask16:
  1306.             --  unkBit[2] 0x4CC 0-1
  1307.             vehi_crouch = readbit(m_vehicle + 0x4CC, 2)
  1308.             vehi_jump = readbit(m_vehicle + 0x4CC, 3)
  1309.             --  unkBit[4] 0x4CC 4-7
  1310.             --unkWord[1] 0x4CE
  1311.             --unkByte[4] 0x4D0-0x4D4
  1312.             vehi_speed = readfloat(m_vehicle + 0x4D4)
  1313.             vehi_slide = readfloat(m_vehicle + 0x4D8)
  1314.             vehi_turn = readfloat(m_vehicle + 0x4DC)
  1315.             vehi_tireposition = readfloat(m_vehicle + 0x4E0)
  1316.             vehi_treadpositionleft = readfloat(m_vehicle + 0x4E4)
  1317.             vehi_treadpositionright = readfloat(m_vehicle + 0x4E8)
  1318.             vehi_hover = readfloat(m_vehicle + 0x4EC)
  1319.             vehi_thrust = readfloat(m_vehicle + 0x4F0)
  1320.             --unkByte[4] 0x4F4-0x4F8 something to do with suspension states... enum?
  1321.             vehi_hoveringposition_x = readfloat(m_vehicle + 0x4FC)
  1322.             vehi_hoveringposition_y = readfloat(m_vehicle + 0x500)
  1323.             vehi_hoveringposition_z = readfloat(m_vehicle + 0x504)
  1324.             --unkLong[7] 0x508-0x524
  1325.             --  bitmask16
  1326.                 vehi_networkTimeValid = readbit(m_vehicle + 0x524, 0)
  1327.             --  unkBit[7] 1-7
  1328.                 vehi_baselineValid = readbit(m_vehicle + 0x524, 8)
  1329.             --  unkBit[7] 9-15
  1330.             vehi_baselineIndex = readbyte(m_vehicle + 0x526)
  1331.             vehi_messageIndex = readbyte(m_vehicle + 0x527)
  1332.             --  bitmask32
  1333.                 vehi_at_rest = readbit(m_vehicle + 0x528, 0)
  1334.             --  unkBit[30] 1-31
  1335.             vehi_x_coord = readfloat(m_vehicle + 0x52C)
  1336.             vehi_y_coord = readfloat(m_vehicle + 0x530)
  1337.             vehi_z_coord = readfloat(m_vehicle + 0x534)
  1338.             vehi_x_vel = readfloat(m_vehicle + 0x538)
  1339.             vehi_y_vel = readfloat(m_vehicle + 0x53C)
  1340.             vehi_z_vel = readfloat(m_vehicle + 0x540)
  1341.             vehi_x_aim_vel = readfloat(m_vehicle + 0x544)
  1342.             vehi_y_aim_vel = readfloat(m_vehicle + 0x548)
  1343.             vehi_z_aim_vel = readfloat(m_vehicle + 0x54C)
  1344.             vehi_pitch = readfloat(m_vehicle + 0x550)
  1345.             vehi_yaw = readfloat(m_vehicle + 0x554)
  1346.             vehi_roll = readfloat(m_vehicle + 0x558)
  1347.             vehi_x_scale = readfloat(m_vehicle + 0x55C)
  1348.             vehi_y_scale = readfloat(m_vehicle + 0x560)
  1349.             vehi_z_scale = readfloat(m_vehicle + 0x564)
  1350.             --Padding[4] 0x568-0x56C
  1351.             vehi_x_coord2 = readfloat(m_vehicle + 0x56C)
  1352.             vehi_y_coord2 = readfloat(m_vehicle + 0x570)
  1353.             vehi_z_coord2 = readfloat(m_vehicle + 0x574)
  1354.             vehi_x_vel2 = readfloat(m_vehicle + 0x578)
  1355.             vehi_y_vel2 = readfloat(m_vehicle + 0x57C)
  1356.             vehi_z_vel2 = readfloat(m_vehicle + 0x580)
  1357.             vehi_x_aim_vel2 = readfloat(m_vehicle + 0x584)
  1358.             vehi_y_aim_vel2 = readfloat(m_vehicle + 0x588)
  1359.             vehi_z_aim_vel2 = readfloat(m_vehicle + 0x58C)
  1360.             vehi_pitch2 = readfloat(m_vehicle + 0x590)
  1361.             vehi_yaw2 = readfloat(m_vehicle + 0x594)
  1362.             vehi_roll2 = readfloat(m_vehicle + 0x598)
  1363.             vehi_x_scale2 = readfloat(m_vehicle + 0x59C)
  1364.             vehi_y_scale2 = readfloat(m_vehicle + 0x5A0)
  1365.             vehi_z_scale2 = readfloat(m_vehicle + 0x5A4)
  1366.             --Padding[4] 0x5A8-0x5AC
  1367.             vehi_some_timer = readdword(m_vehicle + 0x5AC) -- Untested. 0xFFFFFFFF if vehicle not active.
  1368.  
  1369.             --block index of the scenario datum used for respawning
  1370.             --For all game engines besides race, this will be a scenario vehicle datum
  1371.             --For race, it's a scenario_netpoint, aka "scenario_netgame_flags_block"
  1372.             vehi_respawn_timer = readword(m_vehicle + 0x5B0) -- Confirmed. (1 sec = 30 ticks)
  1373.             --Padding[2] 0x5B2-0x5B4
  1374.             vehi_some_x_coord = readfloat(m_vehicle + 0x5B4) -- (???)
  1375.             vehi_some_y_coord = readfloat(m_vehicle + 0x5B8) -- (???)
  1376.             vehi_some_z_coord = readfloat(m_vehicle + 0x5BC) -- (???)
  1377.         end
  1378.  
  1379.     --server network struct
  1380.     network_machine_pointer = readdword(network_struct) -- Confirmed.
  1381.     network_state = readword(network_struct + 0x4) -- Confirmed. (Inactive = 0, Game = 1, Results = 2)
  1382.     --unkWord[1] 0x6 (???)
  1383.     network_name = readwidestring(network_struct + 0x8, 0x42) -- Confirmed. Current server name.
  1384.     --unkWord[3] 0x86 (Padding Maybe?)
  1385.     network_current_map = readstring(network_struct + 0x8C, 0x80) -- Confirmed. Current map the server is currently running.
  1386.     network_current_gametype = readwidestring(network_struct + 0x10C, 0x18) -- Confirmed. Current gametype that the server is currently running.
  1387.     --  partial of Gametype need to break them down.
  1388.     --  unkByte[39] (???)
  1389.     --  unkFloat[1] 0x160 (???) Always 1.
  1390.     network_score_limit = readbyte(network_struct + 0x164) -- Confirmed. Current score limit for gametype. (1 second = 30 ticks)
  1391.     --Padding[3] 0x165
  1392.     local ce = 0x0
  1393.     if game == "CE" then
  1394.         --This exists in CE but not PC, therefore making the struct size larger in CE.
  1395.         --unkByte[64] 0x168 (???)
  1396.         ce = 0x40
  1397.     end
  1398.     --unkFloat[1] 0x1A0+ce (???) --0xBAADF00D (lol)
  1399.     network_max_players = readbyte(network_struct + (0x1A5+ce)) -- Confirmed. The maximum amount of players allowed to join the server (sv_maxplayers)
  1400.     network_difficulty_level = readword(network_struct + (0x1A6+ce)) -- Tested. For SP only. Always 1 for server.
  1401.     network_player_count = readword(network_struct + (0x1A8+ce)) -- Confirmed. Total number of players currently in the server.
  1402.     --  client network struct
  1403.         client_struct_size = 0x20 -- Confirmed.
  1404.         client_network_struct = network_struct + 0x1AA+ce + player * client_struct_size -- Strange. It starts in the middle of the dword.
  1405.         client_name = readwidestring(client_network_struct, 12) -- Confirmed. Name of player.
  1406.         client_color = readword(client_network_struct + 0x18) -- Confirmed. Color of the player (ffa gametypes only.) (0 = white) (1 = black) (2 = red) (3 = blue) (4 = gray) (5 = yellow) (6 = green) (7 = pink) (8 = purple) (9 = cyan) (10 = cobalt) (11 = orange) (12 = teal) (13 = sage) (14 = brown) (15 = tan) (16 = maroon) (17 = salmon)
  1407.         client_icon_index = readword(client_network_struct + 0x1A) -- From OS.
  1408.         client_machine_index = readbyte(client_network_struct + 0x1C) -- Confirmed. Player machine index (or rconId - 1)
  1409.         client_status = readbyte(client_network_struct + 0x1D) -- From Phasor. (1 = Genuine, 2 = Invalid hash (or auth, or w/e))
  1410.         client_team = readbyte(client_network_struct + 0x1E) -- Confirmed. (0 = red) (1 = blue)
  1411.         client_player_id = readbyte(client_network_struct + 0x1F) -- Confirmed. Player memory id/index (0 - 15) (To clarify: this IS the 'player' argument passed to phasor functions)
  1412.     --Padding[2] 0x3AA+ce
  1413.     network_game_random_seed = readdword(network_struct + (0x3AC+ce)) -- Tested.
  1414.     network_games_played = readdword(network_struct + (0x3B0+ce)) -- Confirmed. Total number of games played. (First game = 1, Second game = 2, etc..)
  1415.     network_local_data = readdword(network_struct + (0x3B4+ce)) -- From OS.
  1416.     --  client_machine_info struct
  1417.         client_machineinfo_size = 0x60
  1418.         if game == "CE" then
  1419.             client_machineinfo_size = 0xEC
  1420.         end
  1421.         client_machineinfo_struct = network_struct + 0x3B8+ce + player * client_machineinfo_size
  1422.         client_connectioninfo_pointer = readdword(client_machineinfo_struct) -- From Phasor.
  1423.     --  Padding[8] 0x4
  1424.         client_machine_index = readword(client_machineinfo_struct + 0xC) -- Confirmed. Player machine index (or rconId - 1)
  1425.     --  unkWord[1] 0xE (Padding Maybe?)
  1426.         client_machine_unknown = readword(client_machineinfo_struct + 0x10) -- From DZS. First is 1, then 3, then 7 and back to 0 if not in used (1 is found during the CD Hash Check, 7 if currently playing the game)
  1427.     --  unkWord[1] 0x12 (Padding Maybe?)
  1428.     --  unkLong[2] 0x14 (???)
  1429.     --  unkLong[1] 0x1C (???) most of the time 1, but sometimes changes to 2 for a moment.
  1430.     --  unkLong[1] 0x20 (???)
  1431.     --      action bitmask 16
  1432.             client_crouch = readbit(client_machineinfo_struct + 0x24, 0) -- From DZS.
  1433.             client_jump = readbit(client_machineinfo_struct + 0x24, 1) -- From DZS.
  1434.             client_flashlight = readbit(client_machineinfo_struct + 0x24, 2) -- From DZS.
  1435.     --      unkBit[5] 3-7
  1436.             client_reload = readbit(client_machineinfo_struct + 0x24, 8) -- From DZS.
  1437.             client_fire = readbit(client_machineinfo_struct + 0x24, 9) -- From DZS.
  1438.             client_actionkey = readbit(client_machineinfo_struct + 0x24, 10) -- From DZS.
  1439.             client_grenade = readbit(client_machineinfo_struct + 0x24, 11) -- From DZS.
  1440.     --      unkBit[4] 12-15
  1441.     --  unkWord[1] 0x26 (Padding Maybe?)
  1442.         client_yaw = readfloat(client_machineinfo_struct + 0x28) -- From DZS.
  1443.         client_pitch = readfloat(client_machineinfo_struct + 0x2C) -- From DZS.
  1444.         client_roll = readfloat(client_machineinfo_struct + 0x30) -- From DZS.
  1445.     --  unkByte[8] 0x34 (???)
  1446.         client_forwardVelocityMultiplier = readfloat(client_machineinfo_struct + 0x3C) -- From DZS.
  1447.         client_horizontalVelocityMultiplier = readfloat(client_machineinfo_struct + 0x40) -- From DZS.
  1448.         client_ROFVelocityMultiplier = readfloat(client_machineinfo_struct + 0x44) -- From DZS.
  1449.         client_weap_type = readword(client_machineinfo_struct + 0x48) -- Confirmed. (Primary = 0, Secondary = 1, Tertiary = 2, Quaternary = 3)
  1450.         client_nade_type = readword(client_machineinfo_struct + 0x4A) -- Confirmed. (Frag Grenades = 0, Plasma Grenades = 1)
  1451.         --unkWord[1] 0x4C The index is -1 if no choices are even available.
  1452.         --unkWord[2] 0x4E
  1453.         client_machine_encryption_key = readstring(client_machineinfo_struct + 0x52, 0xA) -- From Phasor. Used for encrypting packets.
  1454.         client_machineNum = readdword(client_machineinfo_struct + 0x5C) -- From Phasor. 0 - 0xFFFFFFFF Increased for each connection in server's life.
  1455.         if game == "CE" then
  1456.             client_last_player_name = readstring(client_machineinfo_struct + 0x60) -- Confirmed. Changes to the player name when they quit. (Could be useful for BOS if PC had this too :/)
  1457.             client_machine_ip_address = readstring(client_machineinfo_struct + 0x80, 32) -- From Phasor.
  1458.             client_machine_player_cdhash = readstring(client_machineinfo_struct + 0xA0, 32) -- From Phasor.
  1459.             --unkByte[76] 0xC0 (???) Maybe Padding? Nothing here. Possibly was going to be used for something else?
  1460.         end
  1461.        
  1462.     -- machine struct
  1463.     --I've found two methods of getting this struct :D
  1464.     local method = 1
  1465.     if method == 1 then
  1466.         machine_base = readdword(network_machine_pointer) -- Confirmed.
  1467.         machine_table = machine_base + 0xAA0 -- Confirmed. Player machine table
  1468.         machine_struct = readdword(machine_table + player_machine_index*4) -- Confirmed. Player machine struct
  1469.     elseif method == 2 then
  1470.         --This is the way most server apps do it (including Phasor) since it's less lines of code.
  1471.         machine_table = readdword(client_connectioninfo_pointer)
  1472.         machine_struct = readdword(machine_table)
  1473.         machine_network = readdword(machine_network)
  1474.     end
  1475.     machine_player_first_ip_byte = readbyte(machine_struct) -- Confirmed. 127 if host.
  1476.     machine_player_second_ip_byte = readbyte(machine_struct + 0x1) -- Confirmed. 0 if host.
  1477.     machine_player_third_ip_byte = readbyte(machine_struct + 0x2) -- Confirmed. 0 if host.
  1478.     machine_player_fourth_ip_byte = readbyte(machine_struct + 0x3) -- Confirmed. 1 if host.
  1479.     machine_player_ip_address = string.format("%i.%i.%i.%i", machine_player_first_ip_byte, machine_player_second_ip_byte, machine_player_third_ip_byte, machine_player_fourth_ip_byte) -- Player's IP Address (127.0.0.1 if host)
  1480.     machine_player_port = readword(machine_struct + 0x4) -- Confirmed. Usually 2303.
  1481.        
  1482.         -- address/offset checker
  1483.         --hprintf("---")
  1484.  
  1485.         --[[local offset = 0x0
  1486.  
  1487.         while offset < camera_size do
  1488.  
  1489.             if readbyte(camera_base, offset) ~= nil then
  1490.                 hprintf(string.format("%X", offset) .. " - " .. readbyte(camera_base, offset))
  1491.             end
  1492.  
  1493.             offset = offset + 0x1
  1494.  
  1495.         end]]--
  1496.     end
  1497. end
  1498.  
  1499. function OnObjectCreation(m_objectId)
  1500.     local m_object = getobject(m_objectId)
  1501.     if m_object then
  1502.         local obj_type = readword(m_object + 0xB4)
  1503.         if obj_type == 2 or obj_type == 3 or obj_type == 4 then
  1504.             -- item struct
  1505.             -- This applies to equipment, weapons, and garbage only.
  1506.             item_struct = m_object
  1507.            
  1508.             --  bitmask32:
  1509.                 item_in_inventory = readbit(item_struct + 0x1F4, 0) -- From OS.
  1510.             --  unkBit[31] 1-31 (Padding Maybe?)
  1511.             item_detonation_countdown = readword(item_struct + 0x1F8) -- Confirmed. (1 sec = 30 ticks)
  1512.             item_collision_surface_index = readword(item_struct + 0x1FA) -- From OS.
  1513.             item_structure_bsp_index = readword(item_struct + 0x1FC) -- From OS.
  1514.             --Padding[2] 0x1FE-0x200
  1515.             item_unknown_obj_id = readident(item_struct + 0x200)
  1516.             item_last_update_time = readdword(item_struct + 0x204) -- From OS.
  1517.             item_unknown_obj_id2 = readident(item_struct + 0x208)
  1518.             item_unknown_x_coord = readfloat(item_struct + 0x20C)
  1519.             item_unknown_y_coord = readfloat(item_struct + 0x210)
  1520.             item_unknown_z_coord = readfloat(item_struct + 0x214)
  1521.             item_unknown_x_vel = readfloat(item_struct + 0x218)
  1522.             item_unknown_y_vel = readfloat(item_struct + 0x21C)
  1523.             item_unknown_z_vel = readfloat(item_struct + 0x220)
  1524.             item_unknown_xy_angle = readfloat(item_struct + 0x224)
  1525.             item_unknown_z_angle = readfloat(item_struct + 0x228)
  1526.            
  1527.             if obj_type == 2 then -- weapons
  1528.            
  1529.                 -- weap struct
  1530.                 weap_struct = m_object
  1531.                
  1532.                 weap_meta_id = readdword(weap_struct) -- Confirmed with HMT. Tag Meta ID.
  1533.                 weap_fuel = readfloat(weap_struct + 0x124) -- Confirmed. Only for Flamethrower. (0 to 1)
  1534.                 weap_charge = readfloat(weap_struct + 0x140) -- Confirmed. Only for Plasma Pistol. (0 to 1)
  1535.                 --  weapon flags bitmask32:
  1536.                 --  unkBit[3] 0-2 (???)
  1537.                     weap_must_be_readied = readbit(weap_struct + 0x22C, 3) -- From OS.
  1538.                 --  unkBit[28] 4-31 (???)
  1539.                 --  ownerObjFlags bitmask16:
  1540.                 --  unkBit[16] 0x230 0-15 (???)
  1541.                 --Padding[2] 0x232-0x234
  1542.                 weap_primary_trigger = readfloat(weap_struct + 0x234) -- From OS.
  1543.                 weap_state = readbyte(weap_struct + 0x238) -- From OS. (0 = Idle) (1 = PrimaryFire) (2 = SecondaryFire) (3 = Chamber1) (4 = Chamber2) (5 = Reload1) (6 = Reload2) (7 = Charged1) (8 = Charged2) (9 = Ready) (10 = Put Away)
  1544.                 --Padding[1] 0x239-0x23A
  1545.                 weap_readyWaitTime = readword(weap_struct + 0x23A) -- From DZS.
  1546.                 weap_heat = readfloat(weap_struct + 0x23C) -- Confirmed. (0 to 1)
  1547.                 weap_age = readfloat(weap_struct + 0x240) -- Confirmed. Equal to 1 - batteries. (0 to 1)
  1548.                 weap_illumination_fraction = readfloat(weap_struct + 0x244) -- From OS.
  1549.                 weap_light_power = readfloat(weap_struct + 0x248) -- From OS.
  1550.                 --Padding[4] 0x24C-0x250 Unused.
  1551.                 weap_tracked_objId = readident(weap_struct + 0x250) -- From OS.
  1552.                 --Padding[8] 0x254-0x25C Unused.
  1553.                 weap_alt_shots_loaded = readword(weap_struct + 0x25C) -- From OS.
  1554.                 --Padding[2] 0x25E-0x260
  1555.        
  1556.                 --Trigger State:
  1557.                 --Padding[1] 0x260-0x261
  1558.                 weap_trigger_state = readbyte(weap_struct + 0x261) -- From OS. Some counter.
  1559.                 weap_trigger_time = readword(weap_struct + 0x262) -- From OS.
  1560.                 --  trigger_flags bitmask32:
  1561.                 weap_trigger_currently_not_firing = readbit(weap_struct + 0x264, 0) -- From DZS.
  1562.                 --  unkBit[31] 0x264-0x268 1-31 (???)
  1563.                 weap_trigger_autoReloadCounter = readdword(weap_struct + 0x268) -- From DZS.
  1564.                 --unkWord[2] 0x26C-0x26E firing effect related.
  1565.                 weap_trigger_rounds_since_last_tracer = readword(weap_struct + 0x26E) -- From OS.
  1566.                 weap_trigger_rate_of_fire = readfloat(weap_struct + 0x270) -- From OS.
  1567.                 weap_trigger_ejection_port_recovery_time = readfloat(weap_struct + 0x274) -- From OS.
  1568.                 weap_trigger_illumination_recovery_time = readfloat(weap_struct + 0x278) -- From OS.
  1569.                 --unkFloat[1] 0x27C-0x280 used in the calculation of projectile error angle
  1570.                 weap_trigger_charging_effect_id = readident(weap_struct + 0x280) -- From OS.
  1571.                 --unkByte[4] 0x284-0x288 (???)
  1572.                 --Padding[1] 0x288-0x289
  1573.                 weap_trigger2_state = readbyte(weap_struct + 0x289) -- From OS. Some counter.
  1574.                 weap_trigger2_time = readword(weap_struct + 0x28A) -- From OS.
  1575.                 --  trigger_flags bitmask32:
  1576.                     weap_trigger2_currently_not_firing = readbit(weap_struct + 0x28C, 0) -- From DZS.
  1577.                 --  unkBit[31] 0x28C-0x290 1-31 (???)
  1578.                 weap_trigger2_autoReloadCounter = readdword(weap_struct + 0x290) -- From DZS.
  1579.                 --unkWord[2] 0x294-0x296 firing effect related.
  1580.                 weap_trigger2_rounds_since_last_tracer = readword(weap_struct + 0x296) -- From OS.
  1581.                 weap_trigger2_rate_of_fire = readfloat(weap_struct + 0x298) -- From OS.
  1582.                 weap_trigger2_ejection_port_recovery_time = readfloat(weap_struct + 0x29C) -- From OS.
  1583.                 weap_trigger2_illumination_recovery_time = readfloat(weap_struct + 0x2A0) -- From OS.
  1584.                 --unkFloat[1] 0x2A4-0x2A8 used in the calculation of projectile error angle
  1585.                 weap_trigger2_charging_effect_id = readident(weap_struct + 0x2A8) -- From OS.
  1586.                 --unkByte[4] 0x2AC-0x2B0 (???)
  1587.        
  1588.                 --Primary Magazine State:
  1589.                 weap_mag1_state = readword(weap_struct + 0x2B0) -- From OS. (0 = Idle) (1 = Chambering Start) (2 = Chambering Finish) (3 = Chambering)
  1590.                 weap_mag1_chambering_time = readword(weap_struct + 0x2B2) -- From OS. Can set to 0 to finish reloading. (1 sec = 30 ticks)
  1591.                 --unkWord[1] 0x2B4-0x2B6 game tick based value (animations?)
  1592.                 weap_primary_ammo = readword(weap_struct + 0x2B6) -- Confirmed. Unloaded ammo for magazine 1.
  1593.                 weap_primary_clip = readword(weap_struct + 0x2B8) -- Confirmed. Loaded clip for magazine 1.
  1594.                 --unkWord[3] 0x2BA-0x2C0 game tick value,unkWord,possible enum
  1595.        
  1596.                 --Secondary Magazine State:
  1597.                 weap_mag2_state = readword(weap_struct + 0x2C0) -- From OS. (0 = Idle) (1 = Chambering Start) (2 = Chambering Finish) (3 = Chambering)
  1598.                 weap_mag2_chambering_time = readword(weap_struct + 0x2C2) -- From OS. Can set to 0 to finish reloading. (1 sec = 30 ticks)
  1599.                 --unkWord[1] 0x2C4-0x2C6 game tick based value (animations?)
  1600.                 weap_secondary_ammo = readword(weap_struct + 0x2C6) -- Confirmed. Unloaded ammo for magazine 1.
  1601.                 weap_secondary_clip = readword(weap_struct + 0x2C8) -- Confirmed. Loaded clip for magazine 1.
  1602.                 --unkWord[3] 0x2CA-0x2D0 game tick value,unkWord,possible enum
  1603.                 weap_last_fired_time = gameinfo_current_time - readdword(weap_struct + 0x2D0) -- From DZS. Time since this weapon was fired. (1 second = 30 ticks)
  1604.                 weap_mag1_starting_total_rounds = readword(weap_struct + 0x2D4) -- From OS. The total unloaded primary ammo the weapon has by default.
  1605.                 weap_mag1_starting_loaded_rounds = readword(weap_struct + 0x2D6) -- From OS. The total loaded primary clip the weapon has by default.
  1606.                 weap_mag2_starting_total_rounds = readword(weap_struct + 0x2D8) -- From OS. The total unloaded secondary ammo the weapon has by default.
  1607.                 weap_mag2_starting_loaded_rounds = readword(weap_struct + 0x2DA) -- From OS. The total loaded secondary clip the weapon has by default.
  1608.                 --unkByte[4] 0x2DC-0x2E0 (Padding Maybe?)
  1609.                 weap_baseline_valid = readbyte(weap_struct + 0x2E0) -- From OS.
  1610.                 weap_baseline_index = readbyte(weap_struct + 0x2E1) -- From OS.
  1611.                 weap_message_index = readbyte(weap_struct + 0x2E2) -- From OS.
  1612.                 --Padding[1] 0x2E3-0x2E4
  1613.                 weap_x_coord = readfloat(weap_struct + 0x2E4) -- From OS.
  1614.                 weap_y_coord = readfloat(weap_struct + 0x2E8) -- From OS.
  1615.                 weap_z_coord = readfloat(weap_struct + 0x2EC) -- From OS.
  1616.                 weap_x_vel = readfloat(weap_struct + 0x2F0) -- From OS.
  1617.                 weap_y_vel = readfloat(weap_struct + 0x2F2) -- From OS.
  1618.                 weap_z_vel = readfloat(weap_struct + 0x2F4) -- From OS.
  1619.                 --Padding[12] 0x2F8-0x300
  1620.                 weap_primary_ammo2 = readword(weap_struct + 0x300) -- From OS. Unloaded ammo for magazine 1.
  1621.                 weap_secondary_ammo2 = readword(weap_struct + 0x302) -- From OS. Unloaded ammo for magazine 2.
  1622.                 weap_age2 = readfloat(weap_struct + 0x304) -- From OS. Equal to 1 - batteries. (0 to 1)
  1623.                 --Duplicates of above below this point, will add later.
  1624.             elseif obj_type == 3 then -- equipment
  1625.                
  1626.                 -- eqip struct
  1627.                 eqip_struct = item_struct
  1628.                
  1629.                 --unkByte[16] 0x22C-0x23C (???) possibly unused?
  1630.                 --unkByte[8] 0x23C-0x244 (???) possibly unused?
  1631.                 --  bitmask8:
  1632.                     eqip_baseline_valid = readbit(eqip_struct + 0x244, 0) -- From OS.
  1633.                 --  unkBit[7] 1-7 (Padding Maybe?)
  1634.                 eqip_baseline_index = readchar(eqip_struct + 0x245) -- From OS.
  1635.                 eqip_message_index = readchar(eqip_struct + 0x246) -- From OS.
  1636.                 --Padding[1] 0x247-0x248
  1637.                 -- baseline update
  1638.                 eqip_x_coord = readfloat(eqip_struct + 0x248) -- From OS.
  1639.                 eqip_y_coord = readfloat(eqip_struct + 0x24C) -- From OS.
  1640.                 eqip_z_coord = readfloat(eqip_struct + 0x250) -- From OS.
  1641.                 eqip_x_vel = readfloat(eqip_struct + 0x254) -- From OS.
  1642.                 eqip_y_vel = readfloat(eqip_struct + 0x258) -- From OS.
  1643.                 eqip_z_vel = readfloat(eqip_struct + 0x25C) -- From OS.
  1644.                 eqip_pitch_vel = readfloat(eqip_struct + 0x260) -- From OS.
  1645.                 eqip_yaw_vel = readfloat(eqip_struct + 0x264) -- From OS.
  1646.                 eqip_roll_vel = readfloat(eqip_struct + 0x268) -- From OS.
  1647.                
  1648.                 --  delta update
  1649.                 --  bitmask8:
  1650.                     eqip_delta_valid = readbit(eqip_struct + 0x26C, 0) -- Guess.
  1651.                 --  unkBit[7] 1-7 (Padding Maybe?)
  1652.                 --Padding[3] 0x26D-0x270
  1653.                 eqip_x_coord2 = readfloat(eqip_struct + 0x270) -- From OS.
  1654.                 eqip_y_coord2 = readfloat(eqip_struct + 0x274) -- From OS.
  1655.                 eqip_z_coord2 = readfloat(eqip_struct + 0x278) -- From OS.
  1656.                 eqip_x_vel2 = readfloat(eqip_struct + 0x27C) -- From OS.
  1657.                 eqip_y_vel2 = readfloat(eqip_struct + 0x280) -- From OS.
  1658.                 eqip_z_vel2 = readfloat(eqip_struct + 0x284) -- From OS.
  1659.                 eqip_pitch_vel2 = readfloat(eqip_struct + 0x288) -- From OS.
  1660.                 eqip_yaw_vel2 = readfloat(eqip_struct + 0x28C) -- From OS.
  1661.                 eqip_roll_vel2 = readfloat(eqip_struct + 0x290) -- From OS.
  1662.                
  1663.             elseif obj_type == 4 then -- garbage object
  1664.                
  1665.                 -- garbage struct
  1666.                 garb_struct = item_struct
  1667.                
  1668.                 garb_time_until_garbage = readword(garb_struct + 0x22C) -- From OS.
  1669.                 --Padding[2] 0x22E-0x230
  1670.                 --Padding[20] 0x230-0x244 unused
  1671.                
  1672.             elseif obj_type == 5 then -- projectile
  1673.                
  1674.                 -- proj struct
  1675.                 proj_struct = m_object
  1676.                
  1677.                 --It appears Smiley didn't know how to read Open-Sauce very effectively, which explains the previous failure in this projectile structure's documentation:
  1678.                
  1679.                 proj_mapId = readident(proj_struct + 0x0) -- Confirmed.
  1680.                 --Object struct 0x4 TO 0x1F4 referenced elsewhere
  1681.                 --Padding[52] 0x1F4-0x22C -- Item data struct not used in projectile.
  1682.                 --unkBit[32] 0x22C-0x230 (???)
  1683.                 proj_action = readword(proj_struct + 0x230) -- From OS. (enum)
  1684.                 --unkWord[1] 0x232-0x234 looks like some kind of index.
  1685.                 proj_source_obj_id = readident(proj_struct + 0x234) -- From OS.
  1686.                 proj_target_obj_id = readident(proj_struct + 0x238) -- From OS.
  1687.                 proj_contrail_attachment_index = readdword(proj_struct + 0x23C) -- From OS. index for the proj's definition's object_attachment_block, index is relative to object.attachments.attachment_indices or -1
  1688.                 proj_time_remaining = readfloat(proj_struct + 0x240) -- From OS. Time remaining to target.
  1689.                 --unkFloat[1] 0x244-0x248 (???) related to detonation countdown timer
  1690.                 --unkFloat[1] 0x248-0x24C (???)
  1691.                 --unkFloat[1] 0x24C-0x250 (???) related to arming_time
  1692.                 proj_range_traveled = readword(proj_struct + 0x250) -- From OS. If the proj definition's "maximum range" is > 0, divide this value by "maximum range" to get "range remaining".
  1693.                 proj_x_vel = readfloat(proj_struct + 0x254) -- From OS.
  1694.                 proj_y_vel = readfloat(proj_struct + 0x258) -- From OS.
  1695.                 proj_z_vel = readfloat(proj_struct + 0x25C) -- From OS.
  1696.                 --unkFloat[1] 0x260-0x264 set to water_damage_range's maximum.
  1697.                 proj_pitch = readfloat(proj_struct + 0x264) -- From OS.
  1698.                 proj_yaw = readfloat(proj_struct + 0x268) -- From OS.
  1699.                 proj_roll = readfloat(proj_struct + 0x26C) -- From OS.
  1700.                 --unkFloat[2] 0x270-0x278 real_euler_angles2d
  1701.                 --unkBit[8] 0x278-0x279 (???)
  1702.                 --  bitmask8:
  1703.                     proj_baseline_valid = readbit(proj_struct + 0x279, 0) -- From OS.
  1704.                 --  unkBit[7] 1-7
  1705.                 proj_baseline_index = readchar(proj_struct + 0x27A) -- From OS.
  1706.                 proj_message_index = readchar(proj_struct + 0x27B) -- From OS.
  1707.                
  1708.                 --  baseline update
  1709.                 proj_x_coord = readfloat(proj_struct + 0x27C) -- From OS.
  1710.                 proj_y_coord = readfloat(proj_struct + 0x280) -- From OS.
  1711.                 proj_z_coord = readfloat(proj_struct + 0x284) -- From OS.
  1712.                 proj_x_vel2 = readfloat(proj_struct + 0x288) -- From OS.
  1713.                 proj_y_vel2 = readfloat(proj_struct + 0x28C) -- From OS.
  1714.                 proj_z_vel2 = readfloat(proj_struct + 0x290) -- From OS.
  1715.                 --unkBit[8] 0x294-0x295 delta_valid?
  1716.                 --Padding[3] 0x295-0x298
  1717.                
  1718.                 --  delta update
  1719.                 proj_x_coord2 = readfloat(proj_struct + 0x298) -- From OS.
  1720.                 proj_y_coord2 = readfloat(proj_struct + 0x29C) -- From OS.
  1721.                 proj_z_coord2 = readfloat(proj_struct + 0x2A0) -- From OS.
  1722.                 proj_x_vel3 = readfloat(proj_struct + 0x2A4) -- From OS.
  1723.                 proj_y_vel3 = readfloat(proj_struct + 0x2A8) -- From OS.
  1724.                 proj_z_vel3 = readfloat(proj_struct + 0x2AC) -- From OS.
  1725.                
  1726.             elseif obj_type >= 6 and obj_type <= 9 then -- device
  1727.                
  1728.                 -- device struct
  1729.                 device_struct = m_object
  1730.                
  1731.                 device_flags = readdword(device_struct + 0x1F4) -- From OS.
  1732.                 device_power_group_index = readword(device_struct + 0x1F8) -- From OS.
  1733.                 --Padding[2] 0x1FA-0x1FC
  1734.                 device_power_amount = readfloat(device_struct + 0x1FC) -- From OS.
  1735.                 device_power_change = readfloat(device_struct + 0x200) -- From OS.
  1736.                 device_position_group_index = readword(device_struct + 0x204) -- From OS.
  1737.                 --Padding[2] 0x206-0x208
  1738.                 device_position_amount = readfloat(device_struct + 0x208) -- From OS.
  1739.                 device_position_change = readfloat(device_struct + 0x20C) -- From OS.
  1740.                 --  user interaction bitmask32:
  1741.                     device_one_sided = readbit(device_struct + 0x210, 0) -- From OS.
  1742.                     device_operates_automatically = readbit(device_struct + 0x210, 1) -- From OS.
  1743.                 --  unkBit[30] 2-31 (Padding Maybe?)
  1744.                
  1745.                 if obj_type == 7 then -- machine
  1746.                    
  1747.                     -- mach struct
  1748.                     mach_struct = device_struct
  1749.                    
  1750.                     mach_flags = readdword(mach_struct + 0x214) -- From OS.
  1751.                     mach_door_timer = readdword(mach_struct + 0x218) -- Tested. looks like a timer used for door-type machines.
  1752.                     mach_elevator_x_coord = readdword(mach_struct + 0x21C) -- From OS.
  1753.                     mach_elevator_y_coord = readdword(mach_struct + 0x220) -- From OS.
  1754.                     mach_elevator_z_coord = readdword(mach_struct + 0x224) -- From OS.
  1755.                    
  1756.                 elseif obj_type == 8 then -- control
  1757.                    
  1758.                     -- ctrl struct
  1759.                     ctrl_struct = device_struct
  1760.                    
  1761.                     ctrl_flags = readdword(mach_struct + 0x214) -- From OS.
  1762.                     ctrl_custom_name_index = readword(mach_struct + 0x218) -- From OS.
  1763.                     --Padding[2] 0x21A-0x21C
  1764.                
  1765.                 elseif obj_type == 9 then -- lightfixture
  1766.                    
  1767.                     --lightfixture struct
  1768.                     lifi_struct = device_struct
  1769.                    
  1770.                     lifi_red_color = readfloat(lifi_struct + 0x214) -- From OS.
  1771.                     lifi_green_color = readfloat(lifi_struct + 0x218) -- From OS.
  1772.                     lifi_blue_color = readfloat(lifi_struct + 0x21C) -- From OS.
  1773.                     lifi_intensity = readfloat(lifi_struct + 0x220) -- From OS.
  1774.                     lifi_falloff_angle = readfloat(lifi_struct + 0x224) -- From OS.
  1775.                     lifi_cutoff_angle = readfloat(lifi_struct + 0x228) -- From OS.
  1776.                    
  1777.                 end
  1778.             end
  1779.         end
  1780.     end
  1781. end
  1782.  
  1783. --I will rewrite this function to work less retardedly.
  1784. function objIsProjectile(objId)
  1785.     local m_object = getobject(objId)
  1786.     if m_object then
  1787.         local mapId = readident(m_object + 0x0)
  1788.         local tag_type = gettaginfo(mapId)
  1789.         return tag_type == "proj"
  1790.     end
  1791. end
  1792.  
  1793. function readident(address, offset)
  1794.     address = address + (offset or 0)
  1795.     identity = readdword(address) -- DWORD ID.
  1796.     --  Thank you WaeV for helping me wrap my head around this.
  1797.         ident_table_index = readword(address) -- Confirmed. This is what most functions use. (player number, object index, etc)
  1798.         ident_table_flags = readbyte(address + 0x2) -- Tested. From Phasor. 0x44 by default, dunno what they're for.
  1799.         ident_type = readbyte(address + 0x3) -- Confirmed. [Object values: (Weapon = 6) (Vehicle = 8) (Others = -1) (Probably more)]
  1800.     return identity
  1801. end
  1802.  
  1803. function getplayermachinenum(player_number)
  1804.     player_number = tonumber(player_number) or raiseerror("bad argument #1 to getplayermachinenum (valid player required, got " .. tostring(type(player_number)) .. ")")
  1805.     local client_machineinfo_size = 0x60
  1806.     local ce = 0x0
  1807.     if game == "CE" then
  1808.         client_machineinfo_size = 0xEC
  1809.         ce = 0x40
  1810.     end
  1811.     local client_machineinfo_struct = network_struct + 0x3B8+ce + player_number*client_machineinfo_size
  1812.     local machineNum = readdword(client_machineinfo_struct + 0x5C) -- From Phasor. 0 - 0xFFFFFFFF Increased for each connection in server's life.
  1813.     return machineNum
  1814. end
  1815.  
  1816. --Thank you Kennan for helping me test this function
  1817. function gethash(player_number)
  1818.     player_number = tonumber(player_number) or raiseerror("bad argument #1 to gethash (valid player required, got " .. tostring(type(player_number)) .. ")")
  1819.    
  1820.     --need to get player machineNum.
  1821.     local machineNum = getplayermachinenum(player_number)
  1822.    
  1823.     --hash table
  1824.     local hash_table_address = readdword(hash_table_base + 0x0) -- Confirmed.
  1825.     local hash_table_data_size = 0x50 -- Confirmed.
  1826.     local hash_table_data_address = readdword(hash_table_base + 0x0) -- Confirmed. Pointer to the hash table data.
  1827.     local hash_next_hash_table = readdword(hash_table_base + 0x4) -- Confirmed. Next hash table in the list
  1828.     local hash_prev_hash_table = readdword(hash_table_base + 0x8) -- Confirmed. Previous hash table in the list.
  1829.    
  1830.     --hash table data
  1831.     hash_table = hash_next_hash_table -- There's nothing in the first table except for the next table.
  1832.     local hash_table_data = readdword(hash_table_address) -- There's no data in the first table.
  1833.     local hash_table_data_id = readdword(hash_table_data_address) -- Confirmed. Machine num index for hash table data.
  1834.     local hash = readstring(hash_table_data + 0x4, 32) -- Confirmed. Hash of the player.
  1835.     --unkByte[44] 0x8 (???)
  1836.  
  1837.     while hash_table ~= 0 and hash_table_data ~= 0 do
  1838.         if hash_table_data_id == machineNum then
  1839.             hash = readstring(hash_table_data + 0x4, 32)
  1840.             return hash
  1841.         end
  1842.         hash_table = readdword(hash_table + 0x4)
  1843.         if hash_table ~= 0 then
  1844.             hash_table_data = readdword(hash_table)
  1845.             hash_table_data_id = readdword(hash_table_data)
  1846.         end
  1847.     end
  1848. end
  1849.  
  1850. function getplayer(player_number)
  1851.     player_number = tonumber(player_number) or raiseerror("bad argument #1 to getplayer (valid player required, got " .. tostring(type(player_number)) .. ")")
  1852.     -- player header setup
  1853.     local player_header = readdword(player_header_pointer) - 0x8 -- Confirmed. (0x4029CE88)
  1854.     local player_header_size = 0x40 -- Confirmed.
  1855.    
  1856.     -- player header
  1857.     --Padding[8] 0x0-0x8
  1858.     local player_header_name = readstring(player_header + 0x8, 0xE) -- Confirmed. Always "players".
  1859.     --Padding[24] 0x10-0x20
  1860.     local player_header_maxplayers = readword(player_header + 0x28) -- Confirmed. (0 - 16)
  1861.     local player_struct_size = readword(player_header + 0x2A) -- Confirmed. (0x200 = 512)
  1862.     local player_header_data_string = readstring(player_header + 0x30, 0x4) -- Tested. Always "@t@d". Translates to data?
  1863.     local player_header_ingame = readword(player_header + 0x34) -- Tested. Always seems to be 0 though... (In game = 0) (Not in game = 1)
  1864.     local player_header_current_players = readword(player_header + 0x36) -- Confirmed.
  1865.     local player_header_next_player_id = readident(player_header + 0x38) -- Confirmed. Full DWORD ID of the next player to join.
  1866.     local player_header_first_player_struct = readident(player_header + 0x3C) -- Confirmed with getplayer(0). Player struct of the first player. (0x4029CEC8 for PC/CE)
  1867.  
  1868.     -- player struct setup
  1869.     local player_base = player_header + player_header_size -- Confirmed. (0x4029CEC8)
  1870.     local player_struct = player_base + (player_number * player_struct_size) -- Confirmed with getplayer(player).
  1871.  
  1872.     return player_struct
  1873.  
  1874. end
  1875.  
  1876. function getLowerWord16(x)
  1877.     local highervals = math.floor(x / 2 ^ 16)
  1878.     highervals = highervals * 2 ^ 16
  1879.     local lowervals = x - highervals
  1880.     return lowervals
  1881. end
  1882.  
  1883. function rshift(x, by)
  1884.     return math.floor(x / 2 ^ by)
  1885. end
  1886.  
  1887. function getobject(m_objectId)
  1888.  
  1889.     -- obj header setup
  1890.     local obj_header = readdword(obj_header_pointer) -- Confirmed. (0x4005062C)
  1891.     local obj_header_size = 0x38 -- Confirmed.
  1892.  
  1893.     -- obj header
  1894.     local obj_header_name = readstring(obj_header, 0x6) -- Confirmed. Always "object".
  1895.     local obj_header_maxobjs = readword(obj_header + 0x20) -- Confirmed. (0x800 = 2048 objects)
  1896.     local obj_table_size = readword(obj_header + 0x22) -- Confirmed. (0xC = 12)
  1897.     local obj_header_data = readstring(obj_header + 0x28, 0x3) -- Confirmed. Always "@t@d". Translates to data?
  1898.     local obj_header_objs = readword(obj_header + 0x2C) -- Needs to be tested.
  1899.     local obj_header_current_maxobjs = readword(obj_header + 0x2E) -- Tested.
  1900.     local obj_header_current_objs = readword(obj_header + 0x30) -- Tested.
  1901.     local obj_header_next_obj_index = readword(obj_header + 0x32) -- Tested. Corresponds with obj_struct_obj_index.
  1902.     local obj_table_base_pointer = readdword(obj_header + 0x34) -- Confirmed. (0x40050664)
  1903.     --local obj_header_next_obj_id = readident(obj_header + 0x34) -- Incorrect?
  1904.     --local obj_header_first_obj = readident(obj_header + 0x36) -- Incorrect?
  1905.  
  1906.     -- obj table setup
  1907.     local obj_table_index = getLowerWord16(m_objectId) -- grab last two bytes of objId
  1908.     local obj_table_flags = rshift(m_objectId, 4*4) - rshift(m_objectId, 6*4) * 0x100 -- part of the objId salt
  1909.     local obj_table_type = rshift(m_objectId, 6*4) -- part of the objId salt
  1910.     local obj_table_base = obj_header + obj_header_size -- Confirmed. (0x40050664)
  1911.     local obj_table_address = obj_table_base + (obj_table_index * obj_table_size) + 0x8 -- Confirmed.
  1912.  
  1913.     -- obj_table (needs testing)
  1914.     local obj_struct = readdword(obj_table_address + 0x0) -- Confirmed with getobject().
  1915.     local obj_struct_obj_id = readword(obj_table_address + 0x2) -- (???)
  1916.     local obj_struct_obj_index = readword(obj_table_address + 0x4) -- Tested. Corresponds with obj_header_next_obj_index.
  1917.     local obj_struct_size = readword(obj_table_address + 0x6) -- Wrong offset?
  1918.  
  1919.     return obj_struct
  1920.  
  1921. end
  1922.  
  1923. function gettagaddress(tagtype_or_mapId, tagname)
  1924.  
  1925.     -- map header
  1926.     local map_header_size = 0x800 -- Confirmed. (2048 bytes)
  1927.     local map_header_head = readstring(map_header_base, 4, true) -- Confirmed. "head" (head = daeh)
  1928.     local map_header_version = readbyte(map_header_base + 0x4) -- Confirmed. (Xbox = 5) (Trial = 6) (PC = 7) (CE = 0x261 = 609)
  1929.     local map_header_map_size = readdword(map_header_base + 0x8, 0x3) -- Confirmed. (Bytes)
  1930.     local map_header_index_offset = readdword(map_header_base + 0x10, 0x2) -- Confirmed. (Hex)
  1931.     local map_header_meta_data_size = readdword(map_header_base + 0x14, 0x2) -- Confirmed. (Hex)
  1932.     local map_header_map_name = readstring(map_header_base + 0x20, 0x9) -- Confirmed.
  1933.     local map_header_build = readstring(map_header_base + 0x40, 12) -- Confirmed.
  1934.     local map_header_map_type = readbyte(map_header_base + 0x60) -- Confirmed. (SP = 0) (MP = 1) (UI = 2)
  1935.     -- Something's here from 0x64 to 0x67.
  1936.     local map_header_foot = readstring(map_header_base + 0x7FC, 4, true) -- Confirmed. "foot" (foot = toof)
  1937.  
  1938.     --tag table setup
  1939.     local map_base = readdword(map_pointer) -- Confirmed. (0x40440000)
  1940.     local tag_table_base_pointer = readdword(map_base)
  1941.     local tag_table_first_tag_id = readdword(map_base + 0x4) -- Confirmed. Also known as the scenario tagId.
  1942.     local tag_table_tag_id = readdword(map_base + 0x8) -- Confirmed. MapId/TagId for specified tag
  1943.     local tag_table_count = readdword(map_base + 0xC) -- Confirmed. Number of tags in the tag table.
  1944.     local map_verticie_count = readdword(map_base + 0x10)
  1945.     local map_verticie_offset = readdword(map_base + 0x14)
  1946.     local map_indicie_count = readdword(map_base + 0x18)
  1947.     local map_indicie_offset = readdword(map_base + 0x1C)
  1948.     local map_model_data_size = readdword(map_base + 0x20)
  1949.     local tag_table_tags = readstring(map_base + 0x24, 4, true) -- Confirmed. "tags" (tags = sgat)
  1950.     local tag_table_base = readdword(map_base) -- Confirmed. (0x40440028)
  1951.     local tag_table_size = 0x20 -- Confirmed.
  1952.     local tag_allocation_size = 0x01700000 -- From OS.
  1953.     local tag_max_address = map_base + tag_allocation_size -- From OS. (0x41B40000)
  1954.    
  1955.     -- tag table
  1956.     -- the scenario is always the first tag located in the table.
  1957.     local scnr_tag_class1 = readstring(tag_table_base, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew). Never 0xFFFF.
  1958.     local scnr_tag_class2 = readstring(tag_table_base + 0x4, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew) 0xFFFF if not existing.
  1959.     local scnr_tag_class3 = readstring(tag_table_base + 0x8, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew) 0xFFFF if not existing.
  1960.     local scnr_tag_id = readident(tag_table_base + 0xC) -- Confirmed. TagID/MapID/MetaID
  1961.     local scnr_tag_name_address = readdword(tag_table_base + 0x10) -- Confirmed. Pointer to the tag name.
  1962.         local scnr_tag_name = readstring(scnr_tag_name_address) -- Confirmed. Name of the tag ("weapons\\pistol\\pistol")
  1963.     local scnr_tag_data_address = readdword(tag_table_base + 0x14) -- Confirmed. This is where map mods made with Eschaton/HMT/HHT are stored.
  1964.     --unkByte[8]
  1965.    
  1966.     local tag_address = 0
  1967.     for i=0,(tag_table_count - 1) do
  1968.    
  1969.         local tag_class = readstring(tag_table_base, (tag_table_size * i), 4)
  1970.         local tag_id = readdword(tag_table_base + 0xC + (tag_table_size * i))
  1971.         local tag_name_address = readdword(tag_table_base + 0x10 + tag_table_size * i)
  1972.         local tag_name = readstring(tag_name_address)
  1973.        
  1974.         --this function can accept mapId or tagtype, tagname
  1975.         if tag_id == tagtype_or_mapId or (tag_class == tagtype_or_mapId and tag_name == tagname) then
  1976.             tag_address = todec(readdword(tag_table_base + 0x14 + (tag_table_size * i)))
  1977.             break
  1978.         end
  1979.        
  1980.     end
  1981.  
  1982.     return tag_address
  1983.  
  1984. end
  1985.  
  1986. function gettagdata(tag_address)
  1987.     --All of these are thanks to Sparky's plugin pack for Eschaton.
  1988.     --There's no way I'm going to list them all, I'm only listing some to show you how you need to read from the tagdata to get the mapmod you want to read from/write to.
  1989.     --Download Sparky's plugin pack (google it) and open up the '.ent' files  with a text editor to get started. The offset should be right next to the value.
  1990.    
  1991.     -- tag table
  1992.     local tag_class1 = readstring(tag_address, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew). Never 0xFFFF.
  1993.     local tag_class2 = readstring(tag_address + 0x4, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew) 0xFFFF if not existing.
  1994.     local tag_class3 = readstring(tag_address + 0x8, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew) 0xFFFF if not existing.
  1995.     local tag_id = readdword(tag_address + 0xC) -- Confirmed. TagID/MapID/MetaID
  1996.     local tag_name_address = readdword(tag_address + 0x10) -- Confirmed. Pointer to the tag name.
  1997.         local tag_name = readstring(tag_name_address) -- Confirmed. Name of the tag ("weapons\\pistol\\pistol")
  1998.     local tag_data_address = readdword(tag_address + 0x14) -- Confirmed. This is where map mods made with Eschaton/HMT/HHT are stored.
  1999.     --unkByte[0x8]
  2000.     if tag_class1 == "weap" then
  2001.         --  Flags
  2002.             local does_not_cast_shadow = readbit(tag_data_address + 0x2, 0)
  2003.             local transparent_self_occlusion = readbit(tag_data_address + 0x2, 1)
  2004.             local brighter_than_should_be = readbit(tag_data_address + 0x2, 2)
  2005.             local not_pathfinding_obstacle = readbit(tag_data_address + 0x2, 3)
  2006.            
  2007.         local bounding_radius = readfloat(tag_data_address + 0x4) -- In world units.
  2008.         local bounding_offset_x = readfloat(tag_data_address + 0x8)
  2009.         local bounding_offset_y = readfloat(tag_data_address + 0xC)
  2010.         local bounding_offset_z = readfloat(tag_data_address + 0x10)
  2011.         local origin_offset_x = readfloat(tag_data_address + 0x14)
  2012.         local origin_offset_y = readfloat(tag_data_address + 0x18)
  2013.         local origin_offset_z = readfloat(tag_data_address + 0x1C)
  2014.         local acceleration_scale = readfloat(tag_data_address + 0x20)
  2015.         local render_bounding_radius = readfloat(tag_data_address + 0x104) -- In world units.
  2016.        
  2017.         --  magazines.
  2018.             local address_magazines = readdword(tag_data_address + 0x4F0 + 0x4)
  2019.             local magazine_count = readdword(tag_data_address + 0x4F0)
  2020.             local address_magazines_size = 0x70 -- Confirmed.
  2021.             --  Flags
  2022.                 local wastes_rounds_when_reloading = readbit(address_magazines + 0x0, 1)
  2023.                 local every_round_must_be_chambered = readbit(address_magazines + 0x0, 2)
  2024.             --  emptyBits[30]
  2025.             local rounds_recharged = readshort(address_magazines + 0x4) -- per second.
  2026.             local rounds_total_initial = readshort(address_magazines + 0x6)
  2027.             local rounds_total_maximum = readshort(address_magazines + 0x8)
  2028.             local rounds_loaded_maximum = readshort(address_magazines + 0xA)
  2029.             local reload_time = readfloat(address_magazines + 0x14) -- the length of time it takes to load a single magazine into the weapon.
  2030.             local rounds_reloaded = readshort(address_magazines + 0x18)
  2031.             local chamber_time = readfloat(address_magazines + 0x1C) -- the length of time it takes to chamber the next round
  2032.         --  some dependencies from 0x38 to 0x64
  2033.            
  2034.             --  Equipment Magazines.
  2035.             --  Seriously another struct?
  2036.                 local address_equipment_magazines = readdword(address_magazines + 0x64)
  2037.                 local address_equipment_magazines_size = 0x1C -- Confirmed.
  2038.                 local equipment_rounds = readshort(address_equipment_magazines + 0x0)
  2039.             --  some dependency here at 0xC.
  2040.         --  end of magazine struct.
  2041.        
  2042.         --  triggers
  2043.             local address_triggers = readdword(tag_data_address + 0x4FC + 0x4)
  2044.             local trigger_count = readdword(tag_data_address + 0x4FC)
  2045.             local address_triggers_size = 0x114 -- Confirmed.
  2046.         --      bitmask32 flags
  2047.                 local tracks_fired_projectile = readbit(address_triggers, 0)
  2048.                 local random_firing_effects = readbit(address_triggers, 1) -- Rather than being chosen sequentially, firing effects are chosen randomly.
  2049.                 local can_fire_with_partial_ammo = readbit(address_triggers, 2)
  2050.                 local does_not_repeat_automatically = readbit(address_triggers, 3)
  2051.                 local locks_in_on_off_state = readbit(address_triggers, 4)
  2052.                 local projectiles_use_weapon_origin = readbit(address_triggers, 5)
  2053.                 local sticks_when_dropped = readbit(address_triggers, 6)
  2054.                 local ejects_during_chamber = readbit(address_triggers, 7)
  2055.                 local discharging_spews = readbit(address_triggers, 8)
  2056.                 local analog_rate_of_fire = readbit(address_triggers, 9) -- May help with lag.
  2057.                 local error_when_unzoom = readbit(address_triggers, 10)
  2058.                 local projectile_vector_not_adjustable = readbit(address_triggers, 11)
  2059.                 local projectile_identical_error = readbit(address_triggers, 12)
  2060.                 local projectile_client_side_only = readbit(address_triggers, 13)
  2061.         --      emptyBits[18] 14-31.
  2062.             local rateOfFireFrom = readfloat(address_triggers + 0x4)
  2063.             local rateOfFireTo = readfloat(address_triggers + 0x8)
  2064.             local firingAccelerationTime = readfloat(address_triggers + 0xC)
  2065.             local firingDecelerationTime = readfloat(address_triggers + 0x10)
  2066.             local firingBlurredRateOfFire = readfloat(address_triggers + 0x14)
  2067.             local magazine = readword(address_triggers + 0x20)
  2068.             local roundsPerShot = readword(address_triggers + 0x22)
  2069.             local minimumRounds = readword(address_triggers + 0x24)
  2070.             local roundsBetweenTracers = readword(address_triggers + 0x26)
  2071.             local weaponFiringNoise = readword(address_triggers + 0x2E)
  2072.             local errorFrom = readfloat(address_triggers + 0x30)
  2073.             local errorTo = readfloat(address_triggers + 0x34)
  2074.             local errorAccelerationTime = readfloat(address_triggers + 0x38)
  2075.             local errorDecelerationTime = readfloat(address_triggers + 0x3C)
  2076.             local chargingTime = readfloat(address_triggers + 0x48)
  2077.             local chargedTime = readfloat(address_triggers + 0x4C)
  2078.             local weaponFiringOverchargeAction = readword(overchargeAction + 0x50)
  2079.             local chargedIllumination = readfloat(address_triggers + 0x54)
  2080.             local overchargeSpewTime = readfloat(address_triggers + 0x58)
  2081.             local chargingEffect = readdword(address_triggers + 0x5C)
  2082.         --  enum weaponFiringDistributionFunction projectileDistributionFunction; //0x6C
  2083.             local projectilesPerShot = readdword(address_triggers + 0x6E)
  2084.             local projectileDistributionAngle = readfloat(address_triggers + 0x70)
  2085.         --  emptyBytes[0x4] 0x74
  2086.             local projectileMinimumError = readfloat(address_triggers + 0x78)
  2087.             local projectileErrorAngleFrom = readfloat(address_triggers + 0x7C)
  2088.             local projectileErrorAngleTo = readfloat(address_triggers + 0x80)
  2089.             local firstPersonOffset_x = readfloat(address_triggers + 0x84)
  2090.             local firstPersonOffset_y = readfloat(address_triggers + 0x88)
  2091.             local firstPersonOffset_z = readfloat(address_triggers + 0x8C)
  2092.         --  emptyBytes[0x4] 0x90
  2093.         --  TagDependency projectile; //0x94
  2094.             local ejectionPortRecoveryTime = readfloat(address_triggers + 0xA4)
  2095.             local illuminationRecoveryTime = readfloat(address_triggers + 0xA8)
  2096.         --  emptyBytes[0xC] 0xAC
  2097.             local heatGeneratedPerRound = readfloat(address_triggers + 0xB8)
  2098.             local ageGeneratedPerRound = readfloat(address_triggers + 0xBC)
  2099.         --  emptyBytes[0x4] 0xC0
  2100.             local overloadTime = readfloat(address_triggers + 0xC4)
  2101.         --  emptyBytes[0x40] 0xC8
  2102.         --  Reflexive firingEffects; //0x108
  2103.     end
  2104.     return tag_data_address
  2105. end
  2106.  
  2107. function endian(address, offset, length)
  2108.     if offset and not length then
  2109.         length = offset
  2110.         offset = nil
  2111.     end
  2112.     local data_table = {}
  2113.     local data = ""
  2114.  
  2115.     for i=0,length do
  2116.  
  2117.         local hex = string.format("%X", readbyte(address, offset + i))
  2118.  
  2119.         if tonumber(hex, 16) < 16 then
  2120.             hex = 0 .. hex
  2121.         end
  2122.  
  2123.         table.insert(data_table, hex)
  2124.  
  2125.     end
  2126.  
  2127.     for k,v in pairs(data_table) do
  2128.         data = v .. data
  2129.     end
  2130.  
  2131.     return data
  2132.  
  2133. end
  2134.  
  2135. function tohex(number)
  2136.     return string.format("%X", number)
  2137. end
  2138.  
  2139. function todec(number)
  2140.     return tonumber(number, 16)
  2141. end
  2142.  
  2143. function setgametypeparameters(friendsonlyradar, startingequipment, invisibleplayers, shields, infinitegrenades, friendindicators, radar)
  2144.  
  2145.     local binary = tonumber(0 .. friendsonlyradar .. startingequipment .. invisibleplayers .. shields .. infinitegrenades .. friendindicators .. radar)
  2146.     writebyte(gametype_base + 0x38, convertbase(2, 10, binary))
  2147.  
  2148. end
  2149.  
  2150. function setvehicleparameters(team, vehicleset, warthog, ghost, scorpion, rocketwarthog, banshee, gunturret)
  2151.  
  2152.     if vehicleset == "default" then
  2153.         vehicleset = convertbase(10, 2, 0)
  2154.     elseif vehicleset == "none" then
  2155.         vehicleset = convertbase(10, 2, 1)
  2156.     elseif vehicleset == "warthogs" then
  2157.         vehicleset = convertbase(10, 2, 2)
  2158.     elseif vehicleset == "ghosts" then
  2159.         vehicleset = convertbase(10, 2, 3)
  2160.     elseif vehicleset == "scorpions" then
  2161.         vehicleset = convertbase(10, 2, 4)
  2162.     elseif vehicleset == "rocket warthogs" then
  2163.         vehicleset = convertbase(10, 2, 5)
  2164.     elseif vehicleset == "banshees" then
  2165.         vehicleset = convertbase(10, 2, 6)
  2166.     elseif vehicleset == "gun turrets" then
  2167.         vehicleset = convertbase(10, 2, 7)
  2168.     elseif vehicleset == "custom" then
  2169.         vehicleset = convertbase(10, 2, 8)
  2170.     end
  2171.  
  2172.     warthog = warthog or 0
  2173.  
  2174.     ghost = ghost or 0
  2175.  
  2176.     scorpion = scorpion or 0
  2177.  
  2178.     rocketwarthog = rocketwarthog or 0
  2179.  
  2180.     banshee = banshee or 0
  2181.  
  2182.     gunturret = gunturret or 0
  2183.  
  2184.     warthog = convertbase(10, 2, warthog)
  2185.     ghost = convertbase(10, 2, ghost)
  2186.     scorpion = convertbase(10, 2, scorpion)
  2187.     rocketwarthog = convertbase(10, 2, rocketwarthog)
  2188.     banshee = convertbase(10, 2, banshee)
  2189.     gunturret = convertbase(10, 2, gunturret)
  2190.  
  2191.     if vehicleset/10 < 1 then
  2192.         vehicleset = 0 .. vehicleset
  2193.     end
  2194.  
  2195.     if vehicleset/100 < 1 then
  2196.         vehicleset = 0 ..vehicleset
  2197.     end
  2198.  
  2199.     if vehicleset/1000 < 1 then
  2200.         vehicleset = 0 .. vehicleset
  2201.     end
  2202.  
  2203.     if warthog/10 < 1 then
  2204.         warthog = 0 .. warthog
  2205.     end
  2206.  
  2207.     if warthog/100 < 1 then
  2208.         warthog = 0 ..warthog
  2209.     end
  2210.  
  2211.     if ghost/10 < 1 then
  2212.         ghost = 0 .. ghost
  2213.     end
  2214.  
  2215.     if ghost/100 < 1 then
  2216.         ghost = 0 ..ghost
  2217.     end
  2218.  
  2219.     if scorpion/10 < 1 then
  2220.         scorpion = 0 .. scorpion
  2221.     end
  2222.  
  2223.     if scorpion/100 < 1 then
  2224.         scorpion = 0 ..scorpion
  2225.     end
  2226.  
  2227.     if rocketwarthog/10 < 1 then
  2228.         rocketwarthog = 0 .. rocketwarthog
  2229.     end
  2230.  
  2231.     if rocketwarthog/100 < 1 then
  2232.         rocketwarthog = 0 ..rocketwarthog
  2233.     end
  2234.  
  2235.     if banshee/10 < 1 then
  2236.         banshee = 0 .. banshee
  2237.     end
  2238.  
  2239.     if banshee/100 < 1 then
  2240.         banshee = 0 ..banshee
  2241.     end
  2242.  
  2243.     if gunturret/10 < 1 then
  2244.         gunturret = 0 .. gunturret
  2245.     end
  2246.  
  2247.     if gunturret/100 < 1 then
  2248.         gunturret = 0 ..gunturret
  2249.     end
  2250.  
  2251.     local binary = 0 .. 0 .. 0 .. 0 .. 0 .. 0 .. 0 .. 0 .. 0 .. 0 .. gunturret .. banshee .. rocketwarthog .. scorpion .. ghost .. warthog .. vehicleset
  2252.     local set1 = tonumber(string.sub(binary, 1, 8))
  2253.     local set2 = tonumber(string.sub(binary, 9, 16))
  2254.     local set3 = tonumber(string.sub(binary, 17, 24))
  2255.     local set4 = tonumber(string.sub(binary, 25, 32))
  2256.     writebyte(gametype_base + 0x60 + (0x4 * team), convertbase(2, 10, set4))
  2257.     writebyte(gametype_base + 0x61 + (0x4 * team), convertbase(2, 10, set3))
  2258.     writebyte(gametype_base + 0x62 + (0x4 * team), convertbase(2, 10, set2))
  2259.     writebyte(gametype_base + 0x63 + (0x4 * team), convertbase(2, 10, set1))
  2260.  
  2261. end
  2262.  
  2263. function convertbase(inputbase, outputbase, input)
  2264.  
  2265.     local power = 0
  2266.     local answer = 0
  2267.     local number = math.floor(input / (outputbase^power))
  2268.     local check = true
  2269.  
  2270.     for word in string.gmatch(tostring(input), "%d") do
  2271.         if tonumber(word) >= inputbase then
  2272.             check = false
  2273.             break
  2274.         end
  2275.     end
  2276.  
  2277.     if check == false then
  2278.         answer = 0
  2279.     else
  2280.         if input == 0 then
  2281.             answer = 0
  2282.         else
  2283.  
  2284.             while number ~= 1 do
  2285.                 power = power + 1
  2286.                 number = math.floor(input / (outputbase^power))
  2287.             end
  2288.  
  2289.             while power >= 0 do
  2290.                 number = math.floor(input / (outputbase^power))
  2291.                 input = input - (number * (outputbase^power))
  2292.                 answer = answer + (number * (inputbase^power))
  2293.                 power = power - 1
  2294.             end
  2295.  
  2296.         end
  2297.     end
  2298.  
  2299.     return answer
  2300.  
  2301. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement