SHARE
TWEET

Addresses and Offsets for Halo PC/CE

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