Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Auto Vehicle Flip for Phasor V2+
- -- by Giraffe, converted to phasor by H® Shaft
- -- 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 --
- object_table_ptr = nil
- riderejection = 1
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- riderejection = readbyte(0x6163EC)
- writebyte(0x6163EC, 0)
- else
- GAME = "CE"
- riderejection = readbyte(0x59A34C)
- writebyte(0x59A34C, 0)
- end
- end
- function OnNewGame(map)
- if GAME == "PC" then
- riderejection = readbyte(0x6163EC)
- writebyte(0x6163EC, 0)
- else
- riderejection = readbyte(0x59A34C)
- writebyte(0x59A34C, 0)
- end
- end
- function OnGameEnd(stage)
- if GAME == "PC" then
- writebyte(0x6163EC, 1)
- else
- writebyte(0x59A34C, 1)
- end
- end
- function OnClientUpdate(player)
- if(PLAYER_VEHICLES_ONLY) then
- for i=0,15 do
- if getplayer(i) then
- local player_obj_id = getplayerobjectid(i)
- if player_obj_id then
- local player_object = getobject(player_obj_id)
- if player_object then
- local player_vehicle_id = readdword(player_object + 0x11C)
- if player_vehicle_id then
- local vehicle_object = getobject(player_vehicle_id)
- flip_vehicle(vehicle_object)
- end
- end
- end
- end
- end
- else
- local object_table = readdword(readdword(object_table_ptr + 2))
- local object_count = readword(object_table + 0x2E)
- local first_object = readdword(object_table + 0x34)
- for i=0,object_count-1 do
- local object = readdword(first_object + i * 0xC + 0x8)
- if(object ~= 0 and object ~= 0xFFFFFFFF) then
- if(readword(object + 0xB4) == 1) then
- flip_vehicle(object)
- end
- end
- end
- end
- end
- function flip_vehicle(vehicle_object)
- if vehicle_object then
- if readbit(vehicle_object + 0x8B, 7) then
- if (WAIT_FOR_IMPACT and not readbit(vehicle_object + 0x10, 1)) then
- return
- end
- writefloat(vehicle_object + 0x80, 0)
- writefloat(vehicle_object + 0x84, 0)
- writefloat(vehicle_object + 0x88, 1)
- end
- end
- end
- function OnScriptUnload()
- if GAME == "PC" then
- writebyte(0x6163EC, riderejection)
- else
- writebyte(0x59A34C, riderejection)
- end
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement