Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Auto Vehicle Flip
- -- by Giraffe
- -- This script disables rider ejection (forcing players to exit vehicle when vehicle is upside down)
- -- and automatically flips upside down vehicles right-side up.
- -- true or false, whether or not to only auto flip vehicles that players are in
- PLAYER_VEHICLES_ONLY = true
- -- true or false, whether or not to wait until impact before auto flipping vehicle
- WAIT_FOR_IMPACT = true
- --don't edit below--
- api_version = "1.9.0.0"
- object_table_ptr = nil
- rider_ejection = nil
- function OnScriptLoad()
- object_table_ptr = sig_scan("8B0D????????8B513425FFFF00008D")
- register_callback(cb['EVENT_TICK'],"OnTick")
- if (halo_type == "CE") then
- rider_ejection = read_byte(0x59A34C)
- write_byte(0x59A34C, 0)
- else
- rider_ejection = read_byte(0x6163EC)
- write_byte(0x6163EC, 0)
- end
- end
- function OnTick()
- if(PLAYER_VEHICLES_ONLY) then
- for i=1,16 do
- if(player_alive(i)) then
- local player = get_dynamic_player(i)
- local player_vehicle_id = read_dword(player + 0x11C)
- if(player_vehicle_id ~= 0xFFFFFFFF) then
- local vehicle = get_object_memory(player_vehicle_id)
- flip_vehicle(vehicle)
- end
- end
- end
- else
- local object_table = read_dword(read_dword(object_table_ptr + 2))
- local object_count = read_word(object_table + 0x2E)
- local first_object = read_dword(object_table + 0x34)
- for i=0,object_count-1 do
- local object = read_dword(first_object + i * 0xC + 0x8)
- if(object ~= 0 and object ~= 0xFFFFFFFF) then
- if(read_word(object + 0xB4) == 1) then
- flip_vehicle(object)
- end
- end
- end
- end
- end
- function flip_vehicle(Object)
- if(read_bit(Object + 0x8B, 7) == 1) then
- if(WAIT_FOR_IMPACT and read_bit(Object + 0x10, 1) == 0) then
- return
- end
- write_vector3d(Object + 0x80, 0, 0, 1)
- end
- end
- function OnScriptUnload()
- if( halo_type == "CE") then
- write_byte(0x59A34C, rider_ejection)
- else
- write_byte(0x6163EC, rider_ejection)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement