Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Vehicle Leap & Emergency Brake 2.0
- -- by H® Shaft for SAPP
- -- Allows drivers to activate a vehicle leap (brake key/space bar) and will notify them by message: Vehicle Leap Activated!
- -- Allows drivers to activate an emergency brake (crouch key) and will notify them by message: Emergency Brake Activated! this halts forward/reverse and lateral movement
- -- Editable parameters allow admins to enable/disable leap/brake per-map, and velocity of the leap
- -- Emergency Brake: Can cause the appearance of a lag twich if crouch is pressed and held down, but does not cause any lag whatsoever
- -- Supports all stock maps for Halo PC/CE, and you can add your own to the tables below, and should be added to all 3 tables (see bottom)
- -- Designed for movable ground vehicles only! Does not work properly for flying vehicles
- -- Added most CE maps listed here (vehicle races):
- -- Complete List of Halo CE Race Maps: http://halorace.org/forum/index.php?topic=499.msg1673#msg1673
- -- SAPP api version --
- api_version = "1.9.0.0"
- -- do not touch --
- brakes = {}
- jumps = {}
- function OnScriptLoad()
- register_callback(cb['EVENT_TICK'],"OnTick")
- register_callback(cb['EVENT_JOIN'],"OnPlayerJoin")
- register_callback(cb['EVENT_LEAVE'],"OnPlayerLeave")
- register_callback(cb['EVENT_GAME_START'],"OnNewGame")
- OnNewGame()
- end
- function OnScriptUnload()
- end
- function OnNewGame()
- map_name = get_var(1,"$map")
- LoadDefaults()
- enable_vehicle_leap[map_name] = enable_vehicle_leap[map_name] or false
- vehicle_velocity[map_name] = vehicle_velocity[map_name] or 0
- emergency_brake[map_name] = emergency_brake[map_name] or false
- end
- function OnTick()
- for i=1,16 do
- local player_dyn = get_dynamic_player(i)
- local name = get_var(i,"$name")
- if (player_dyn ~= 0) then
- local vehicle_objectid = read_dword(player_dyn + 0x11C)
- local vehicle_object = get_object_memory(vehicle_objectid)
- if (vehicle_object ~= 0) then
- if PlayerIsDriver(i) then
- if brakes[i] > 0 then brakes[i] = brakes[i] - 1 end
- if jumps[i] > 0 then jumps[i] = jumps[i] - 1 end
- if enable_vehicle_leap[map_name] then
- -- activated on brake key/space bar
- if (jumps[i] == 0) and (read_bit(player_dyn + 0x208, 1) == 1) then
- local vel = (vehicle_velocity[map_name] / 10)
- jumps[i] = math.floor(4*30)
- say(i, name .. ": You Activated Vehicle Leap!")
- write_float(vehicle_object + 0x70, vel)
- end
- end
- if emergency_brake[map_name] then
- -- activated on crouch key
- if (brakes[i] == 0) and (bit.band(read_dword(player_dyn + 0x208),7) == 1) then
- brakes[i] = math.floor(1.25*30)
- say(i, name .. ": You Activated Emergency Brake!")
- write_float(vehicle_object + 0x68, read_float(vehicle_object + 0x68)*0.05)
- write_float(vehicle_object + 0x6C, read_float(vehicle_object + 0x6C)*0.05)
- end
- end
- end
- end
- end
- end
- end
- function OnPlayerJoin(PlayerIndex)
- if player_present(PlayerIndex) then
- brakes[PlayerIndex] = 0
- jumps[PlayerIndex] = 0
- end
- end
- function OnPlayerLeave(PlayerIndex)
- if player_present(PlayerIndex) then
- brakes[PlayerIndex] = {}
- jumps[PlayerIndex] = {}
- end
- end
- -- Thanks to 002 for this piece:
- 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 LoadDefaults()
- -- Adding a map? add to tables: enable_vehicle_leap, vehicle_velocity, emergency_brake You should include the map name in all THREE sections below (yes, tedious)
- -- If the boolean is true for the map then vehicle leap will be enabled for the map, activated by brake key (space bar)
- -- Enable/Disable Leap Table: ensure each line separated by a comma between each line
- -- NOTE: SAPP may not be case sensitive, but LUA IS case sensitive!
- -- The map names shown should be exactly the same as the map's FILE name. Example: "Bigass" is not the same as "bigass"
- --Note: enclose the 'map name' like ["this"] in the tables below:
- --Example: ["Classic Coagulation"] = true OR ["[h3]_sandtrap_race"] = true
- enable_vehicle_leap = {
- ["beavercreek"] = false,
- ["bloodgulch"] = true,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["chillout"] = false,
- ["damnation"] = false,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["hangemhigh"] = false,
- ["icefields"] = true,
- ["infinity"] = true,
- ["longest"] = false,
- ["prisoner"] = false,
- ["putput"] = false,
- ["ratrace"] = false,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["wizard"] = false,
- ["atephobia__V2"] = true,
- ["baconsracetrack"] = true,
- ["bc_raceway_mp"] = true,
- ["bc_raceway_final_bfm_mp"] = true,
- ["Beryl_Rescue"] = true,
- ["Bigass"] = true,
- ["bigassv2,104"] = true,
- ["blizzard"] = true,
- ["Blockfort__Race"] = true,
- ["broadsword_race"] = true,
- ["Camtrack-Arena-FX"] = true,
- ["Camtrack-Arena-Race"] = true,
- ["casualty_isle__V2"] = true,
- ["Cityscape-Adrenaline"] = true,
- ["ChaosGulchv2"] = true,
- ["Classic Coagulation"] = true,
- ["Celebration_Island"] = true,
- ["Chronopolis_C3_Public_Beta0.2"] = true,
- ["cliffhanger"] = true,
- ["cmt_Snow_Grove"] = false,
- ["CMT_Fragment_v3"] = true,
- ["cmt_g3_vestigial"] = true,
- ["coldsnap"] = true,
- ["coldgulch"] = true,
- ["concealed"] = true,
- ["Crimson_Woods"] = true,
- ["DeathIsland_Race"] = true,
- ["death_karts"] = true,
- ["decoy"] = true,
- ["decoy_race"] = true,
- ["Devils_Drop_Race"] = true,
- ["Equinox_V2"] = true,
- ["extinction"] = true,
- ["fates_gulch"] = true,
- ["Freezing_Point"] = true,
- ["Gallows"] = true,
- ["Gauntlet_Race"] = true,
- ["Greenvalley_Canyon"] = true,
- ["grove_final"] = true,
- ["h3 foundry"] = true,
- ["halo_hq_race"] = true,
- ["highlow_race"] = true,
- ["Hillbilly Mudbog"] = true,
- ["hogracing_day"] = true,
- ["hogracing_night"] = true,
- ["Hornets_Nest"] = true,
- ["Hypothermia_Race"] = true,
- ["infested"] = true,
- ["islandthunder_race"] = true,
- ["Lake-Natalie"] = true,
- ["Launch_Bay_X"] = true,
- ["Launch Bay"] = true,
- ["LostCove_Race"] = true,
- ["luigi_raceway"] = true,
- ["Massacre_Mountain_Race"] = true,
- ["Mayan_Sacrifice"] = true,
- ["MeatLocker_Race"] = true,
- ["Mongoose_Point"] = true,
- ["Mombasa_Race"] = true,
- ["mudwinder"] = true,
- ["mystic_mod"] = true,
- ["neophobia_beta2"] = true,
- ["Nervous_Canyon_Race"] = true,
- ["Nervous_King"] = true,
- ["nervousking"] = true,
- ["New_Mombasa_Race"] = true,
- ["nightcamp"] = true,
- ["nightcamp_ce"] = true,
- ["Outpost_Rio_Classic"] = true,
- ["pandora_swamp"] = true,
- ["Phantom"] = true,
- ["pit_race"] = true,
- ["pit_v2"] = true,
- ["pit_v2_top_race"] = true,
- ["portent"] = true,
- ["Prime_C3_Race"] = true,
- ["Quagmire_Daylight"] = true,
- ["siege"] = true,
- ["skullcanyon"] = true,
- ["SkyHarbor [FINAL]"] = true,
- ["snowgrove_1"] = true,
- ["snowtorn_cove"] = true,
- ["starcanyon"] = true,
- ["storm"] = true,
- ["starwars-beta_904"] = true,
- ["the_great_war"] = true,
- ["TLSstronghold"] = true,
- ["Train.Station"] = true,
- ["TrainStation"] = true,
- ["Tusken_Raid"] = true,
- ["twist_beta"] = true,
- ["V993_Down"] = true,
- ["vendetta"] = true,
- ["vestige"] = true,
- ["winder_pass"] = true,
- ["wpitest1_race"] = true,
- ["Yoyorast_Island"] = true,
- ["Yoyorast Island V2"] = true,
- ["[h3] core"] = true,
- ["[h3]_sandtrap_race"] = true,
- }
- -- Specify the upward leap velocity value for each map that you want
- -- Leap Velocity Table: ensure each line separated by a comma between each line
- vehicle_velocity = {
- ["beavercreek"] = 0,
- ["bloodgulch"] = 1.85,
- ["boardingaction"] = 0,
- ["carousel"] = 0,
- ["chillout"] = 0,
- ["damnation"] = 0,
- ["dangercanyon"] = 1.65,
- ["deathisland"] = 2,
- ["gephyrophobia"] = 1.9,
- ["hangemhigh"] = 0,
- ["icefields"] = 1.8,
- ["infinity"] = 1.85,
- ["longest"] = 0,
- ["prisoner"] = 0,
- ["putput"] = 0,
- ["ratrace"] = 0,
- ["sidewinder"] = 2.2,
- ["timberland"] = 1.8,
- ["wizard"] = 0,
- ["atephobia__V2"] = 2,
- ["baconsracetrack"] = 2,
- ["Bacons_race_track_v2"] = 1.9,
- ["bc_raceway_mp"] = 1.8,
- ["bc_raceway_final_bfm_mp"] = 1.8,
- ["Beryl_Rescue"] = 1.8,
- ["bigassv2,104"] = 1.9,
- ["Bigass"] = 1.9,
- ["blizzard"] = 1.8,
- ["Blockfort__Race"] = 1.8,
- ["broadsword_race"] = 1.8,
- ["Camtrack-Arena-FX"] = 1.8,
- ["Camtrack-Arena-Race"] = 1.8,
- ["Chronopolis_C3_Public_Beta0.2"] = 1.8,
- ["Classic Coagulation"] = 1.8,
- ["casualty_isle__V2"] = 1.8,
- ["celebration_island"] = 1.8,
- ["Cityscape-Adrenaline"] = 1.8,
- ["ChaosGulchv2"] = 1.8,
- ["cliffhanger"] = 1.8,
- ["CMT_Fragment_v3"] = 1.8,
- ["cmt_g3_vestigial"] = 1.8,
- ["cmt_snow_grove"] = 1.8,
- ["coldgulch"] = 1.8,
- ["concealed"] = 1.8,
- ["Crimson_Woods"] = 1.8,
- ["death_karts"] = 1.8,
- ["DeathIsland_Race"] = 1.8,
- ["decoy"] = 1.8,
- ["decoy_race"] = 1.8,
- ["Devils_Drop_Race"] = 1.8,
- ["Equinox_V2"] = 1.8,
- ["Facing_WorldsRX"] = 1.8,
- ["fates_gulch"] = 1.8,
- ["Freezing_Point"] = 1.8,
- ["Gallows"] = 1.8,
- ["Gauntlet_Race"] = 1.8,
- ["Greenvalley_Canyon"] = 1.8,
- ["grove_final"] = 1.8,
- ["h3 foundry"] = 1.8,
- ["halo_hq_race"] = 1.8,
- ["highlow_race"] = 1.8,
- ["Hillbilly Mudbog"] = 1.8,
- ["hogracing_day"] = 2.5,
- ["hogracing_night"] = 2.5,
- ["Hornets_Nest"] = 1.8,
- ["Hypothermia_Race"] = 1.8,
- ["infested"] = 1.8,
- ["islandthunder_race"] = 1.8,
- ["Lake-Natalie"] = 1.8,
- ["Launch_Bay_X"] = 2,
- ["Launch Bay"] = 2,
- ["LostCove_Race"] = 2,
- ["luigi_raceway"] = 1.8,
- ["Massacre_Mountain_Race"] = 2,
- ["Mayan_Sacrifice"] = 1.8,
- ["MeatLocker_Race"] = 1.8,
- ["Mongoose_Point"] = 1.8,
- ["Mombasa_Race"] = 1.8,
- ["Mudwinder"] = 1.8,
- ["mystic_mod"] = 2,
- ["neophobia_beta2"] = 1.8,
- ["Nervous_Canyon_Race"] = 1.8,
- ["Nervous_King"] = 1.8,
- ["New_Mombasa_Race"] = 2.5,
- ["nightglow_v2"] = 1.8,
- ["nightcamp"] = 1.8,
- ["nightcamp_ce"] = 1.8,
- ["Outpost_Rio_Classic"] = 2.5,
- ["pandora_swamp"] = 1.8,
- ["Phantom"] = 1.8,
- ["pit_v2"] = 1.5,
- ["pit_v2_top_race"] = 2,
- ["portent"] = 1.8,
- ["Prime_C3_Race"] = 1.8,
- ["Quagmire_Daylight"] = 1.8,
- ["revelations"] = 1.8,
- ["siege"] = 1.8,
- ["SkyHarbor [FINAL]"] = 1.8,
- ["skullcanyon"] = 1.9,
- ["snowtorn_cove"] = 2,
- ["starcanyon"] = 1.8,
- ["storm"] = 1.8,
- ["TLSstronghold"] = 1.8,
- ["Train.Station"] = 1.8,
- ["TrainStation"] = 1.8,
- ["Tusken_Raid"] = 1.8,
- ["twist_beta"] = 1.8,
- ["vendetta"] = 1.8,
- ["wpitest1_race"] = 1.8,
- ["nightglow_v2"] = 1.8,
- ["Yoyorast_Island"] = 2.5,
- ["Yoyorast Island V2"] = 1.8,
- ["[h3] core"] = 1.8,
- ["[h3]_sandtrap_race"] = 1.8,
- }
- -- Specify if you want emergency brake enabled each map, activated by crouch key
- -- Enable/Disable Brake Table: ensure each line separated by a comma between each line
- emergency_brake = {
- ["beavercreek"] = false,
- ["bloodgulch"] = true,
- ["boardingaction"] = false,
- ["carousel"] = false,
- ["chillout"] = false,
- ["damnation"] = false,
- ["dangercanyon"] = true,
- ["deathisland"] = true,
- ["gephyrophobia"] = true,
- ["hangemhigh"] = false,
- ["icefields"] = true,
- ["infinity"] = true,
- ["longest"] = false,
- ["prisoner"] = false,
- ["putput"] = false,
- ["ratrace"] = false,
- ["sidewinder"] = true,
- ["timberland"] = true,
- ["wizard"] = false,
- ["atephobia__V2"] = true,
- ["baconsracetrack"] = true,
- ["bc_raceway_mp"] = true,
- ["bc_raceway_final_bfm_mp"] = true,
- ["Beryl_Rescue"] = true,
- ["Bigass"] = true,
- ["bigassv2,104"] = true,
- ["blizzard"] = true,
- ["Blockfort__Race"] = true,
- ["broadsword_race"] = true,
- ["Camtrack-Arena-FX"] = true,
- ["Camtrack-Arena-Race"] = true,
- ["casualty_isle__V2"] = true,
- ["Cityscape-Adrenaline"] = true,
- ["ChaosGulchv2"] = true,
- ["Classic Coagulation"] = true,
- ["Celebration_Island"] = true,
- ["Chronopolis_C3_Public_Beta0.2"] = true,
- ["cliffhanger"] = true,
- ["cmt_Snow_Grove"] = false,
- ["CMT_Fragment_v3"] = true,
- ["cmt_g3_vestigial"] = true,
- ["coldsnap"] = true,
- ["coldgulch"] = true,
- ["concealed"] = true,
- ["Crimson_Woods"] = true,
- ["DeathIsland_Race"] = true,
- ["death_karts"] = true,
- ["decoy"] = true,
- ["decoy_race"] = true,
- ["Devils_Drop_Race"] = true,
- ["Equinox_V2"] = true,
- ["extinction"] = true,
- ["fates_gulch"] = true,
- ["Freezing_Point"] = true,
- ["Gallows"] = true,
- ["Gauntlet_Race"] = true,
- ["Greenvalley_Canyon"] = true,
- ["grove_final"] = true,
- ["h3 foundry"] = true,
- ["halo_hq_race"] = true,
- ["highlow_race"] = true,
- ["Hillbilly Mudbog"] = true,
- ["hogracing_day"] = true,
- ["hogracing_night"] = true,
- ["Hornets_Nest"] = true,
- ["Hypothermia_Race"] = true,
- ["infested"] = true,
- ["islandthunder_race"] = true,
- ["Launch_Bay_X"] = true,
- ["Launch Bay"] = true,
- ["LostCove_Race"] = true,
- ["luigi_raceway"] = true,
- ["Massacre_Mountain_Race"] = true,
- ["Mayan_Sacrifice"] = true,
- ["MeatLocker_Race"] = true,
- ["Mongoose_Point"] = true,
- ["Mombasa_Race"] = true,
- ["mudwinder"] = true,
- ["mystic_mod"] = true,
- ["neophobia_beta2"] = true,
- ["Nervous_Canyon_Race"] = true,
- ["Nervous_King"] = true,
- ["nervousking"] = true,
- ["New_Mombasa_Race"] = true,
- ["nightcamp"] = true,
- ["nightcamp_ce"] = true,
- ["Outpost_Rio_Classic"] = true,
- ["pandora_swamp"] = true,
- ["Phantom"] = true,
- ["pit_race"] = true,
- ["pit_v2"] = true,
- ["pit_v2_top_race"] = true,
- ["portent"] = true,
- ["Prime_C3_Race"] = true,
- ["Quagmire_Daylight"] = true,
- ["siege"] = true,
- ["skullcanyon"] = true,
- ["SkyHarbor [FINAL]"] = true,
- ["snowgrove_1"] = true,
- ["snowtorn_cove"] = true,
- ["starcanyon"] = true,
- ["storm"] = true,
- ["starwars-beta_904"] = true,
- ["the_great_war"] = true,
- ["TLSstronghold"] = true,
- ["Train.Station"] = true,
- ["TrainStation"] = true,
- ["Tusken_Raid"] = true,
- ["twist_beta"] = true,
- ["V993_Down"] = true,
- ["vendetta"] = true,
- ["vestige"] = true,
- ["winder_pass"] = true,
- ["wpitest1_race"] = true,
- ["Yoyorast_Island"] = true,
- ["Yoyorast Island V2"] = true,
- ["[h3] core"] = true,
- ["[h3]_sandtrap_race"] = true,
- }
- end
- function OnError(Message)
- print(debug.traceback())
- end
- -- Created by H® Shaft
- -- Visit http://halorace.org
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement