Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Vehicle Fly Mode by H® Shaft
- -- a derivation/re-write of Flymo v0.6 By =GG=DLBon
- -- This is a script which makes vehicles fly if the space bar/brake is pressed and held by the driver in a vehicle.
- -- Fall and distance damage are blocked while a player is in a vehicle
- -- works with any vehicle, any map, any gametype in Halo PC/CE -- NOT tested with stationary turrets
- -- How fast should a vehicle move up when driver presses space bar/brake? Default = 0.07
- movespeed = 0.07
- -- Do not change anything below
- api_version = "1.9.0.0"
- currentjump = {}
- previousjump = {}
- vid = {}
- permi = {}
- function OnScriptLoad()
- register_callback(cb["EVENT_TICK"],"OnTick")
- register_callback(cb['EVENT_SPAWN'],"OnPlayerSpawn")
- register_callback(cb['EVENT_DAMAGE_APPLICATION'], "OnDamageApplication")
- if get_var(0, "$gt") ~= "n/a" then
- GetMetaIDs()
- for i = 1, 16 do
- if player_present(i) then
- OnPlayerSpawn(i)
- end
- end
- end
- end
- function OnPlayerSpawn(PlayerIndex)
- currentjump[PlayerIndex] = 0
- previousjump[PlayerIndex] = 0
- permi[PlayerIndex] = 0
- end
- function OnTick()
- for PlayerIndex=1,16 do
- if player_alive(PlayerIndex) then
- local player = get_dynamic_player(PlayerIndex)
- currentjump[PlayerIndex] = read_bit(player + 0x208,1)
- if isinvehicle(PlayerIndex) and PlayerIsDriver(PlayerIndex) then
- vid[PlayerIndex] = read_bit(player + 0x11C,0)
- if currentjump[PlayerIndex] == 1 then
- if get_var(0, "$gt") ~= "race" then
- if (vid[PlayerIndex] ~= 1) then
- permi[PlayerIndex] = 1
- end
- else
- if (vid[PlayerIndex] ~= 0) then
- permi[PlayerIndex] = 1
- end
- end
- else
- permi[PlayerIndex] = 0
- end
- end
- if isinvehicle(PlayerIndex) and PlayerIsDriver(PlayerIndex) then
- local vehicle_objectid = read_dword(player + 0x11C)
- local vehicle_object = get_object_memory(vehicle_objectid)
- if permi[PlayerIndex] == 1 then
- if vehicle_object ~= 0 then
- write_float(vehicle_object + 0x70, movespeed)
- end
- end
- previousjump[PlayerIndex] = currentjump[PlayerIndex]
- end
- end
- end
- end
- function OnDamageApplication(PlayerIndex, CauserIndex, MetaID, Damage, HitString, Backtap)
- if MetaID == falling_damage then
- if isinvehicle(PlayerIndex) then
- return true, 0
- else
- return true, Damage
- end
- elseif MetaID == distance_damage then
- if isinvehicle(PlayerIndex) then
- return true, 0
- else
- return true, Damage
- end
- end
- end
- function GetMetaIDs()
- falling_damage = read_dword(lookup_tag("jpt!", "globals\\falling") + 12)
- distance_damage = read_dword(lookup_tag("jpt!", "globals\\distance") + 12)
- end
- function PlayerIsDriver(PlayerIndex)
- if (player_present(PlayerIndex) == false) then return false end
- local player_object = get_dynamic_player(PlayerIndex)
- local player_object_id = read_dword(get_player(PlayerIndex) + 0x34)
- local vehicleId = read_dword(player_object + 0x11C)
- if (vehicleId == 0xFFFFFFFF) then return false end
- local obj_id = get_object_memory(vehicleId)
- return read_dword(obj_id + 0x324) == player_object_id
- end
- function isinvehicle(PlayerIndex)
- if (player_alive(PlayerIndex) == false) then return false end
- local player_object = get_dynamic_player(PlayerIndex)
- local vehicleId = read_dword(player_object + 0x11C)
- if vehicleId == 0xFFFFFFFF then
- return false
- else
- return true
- end
- end
- function OnScriptUnload() end
- function OnError(Message)
- print(debug.traceback())
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement