Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Anti-Gravity + Super Jump
- -- by H® Shaft for SAPP
- -- Script allows use of dev-mode super-jump in multiplayer combined with editable per-map gravity settings.
- -- Reduced gravity on: hangemhigh, boardingaction, prisoner (edit/add your own see gravity_setting in "function LoadDefaults()" - line 139
- -- Notes:
- -- fall damage is off to prevent player damage when landing IF super jump is enabled see gravity_setting in "function LoadDefaults()" - line 159
- -- deathplane kills players who fall too far (since fall damage is removed by this script)
- -- players sometimes de-sync, (can't see themselves jumping high), it resolves itself shortly, or upon death
- -- visually it might seem laggy or twitchy - this is DE-SYNC
- -- don't edit --
- api_version = "1.9.0.0"
- game_started = false
- gravity_default = 0.003565
- super_jump = false
- deathplane = -500
- function OnScriptLoad()
- register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_TICK'],"OnTick")
- register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
- register_callback(cb['EVENT_JOIN'], "OnPlayerJoin")
- if get_var(0, "$gt") ~= "n/a" then
- game_started = true
- map_name = get_var(0,"$map")
- LoadDefaults()
- for i = 1, 16 do
- if player_present(i) then
- OnPlayerSpawn(i)
- end
- end
- -- deathplane kills players who fall too far (since fall damage is removed by this script)
- if map_name == "boardingaction" then
- deathplane = -10
- elseif map_name == "gephyrophobia" then
- deathplane = -50
- elseif map_name == "damnation" then
- deathplane = -10
- end
- execute_command("gravity " .. gravity_default or 0.003565)
- end
- end
- function OnGameEnd()
- game_started = false
- gravity_default = 0.003565
- super_jump = false
- end
- function OnScriptUnload()
- gravity_setting = {}
- gravity_default = 0.003565
- set_super_jump = {}
- execute_command_sequence('cheat_super_jump 0;cheat_jetpack 0')
- end
- function OnPlayerSpawn(PlayerIndex)
- if (game_started == true) then
- if player_alive(PlayerIndex) then
- write_dword(get_player(PlayerIndex) + 0xF0, 0)
- write_dword(get_player(PlayerIndex) + 0x164, 0)
- if super_jump then
- execute_command_sequence('cheat_super_jump 1;cheat_jetpack 1', PlayerIndex)
- else
- execute_command_sequence('cheat_super_jump 0;cheat_jetpack 0', PlayerIndex)
- end
- end
- end
- end
- function OnPlayerJoin(PlayerIndex)
- if (game_started == true) then
- if player_present(PlayerIndex) then
- OnPlayerSpawn(PlayerIndex)
- if gravity_default ~= 0.003565 then
- rprint(PlayerIndex, "|cANTI-GRAVITY!! - IT AFFECTS EVERYTHING!")
- if super_jump then
- rprint(PlayerIndex, "|cSUPER JUMP!! - BE CAREFUL WHEN JUMPING!")
- end
- rprint(PlayerIndex, " ")
- rprint(PlayerIndex, " ")
- end
- end
- end
- end
- function OnNewGame()
- game_started = true
- map_name = get_var(0,"$map")
- LoadDefaults()
- for i = 1, 16 do
- if player_present(i) then
- if player_present(i) then
- OnPlayerSpawn(i)
- if gravity_default ~= 0.003565 then
- rprint(i, "|cANTI-GRAVITY!! - IT AFFECTS EVERYTHING!")
- if super_jump then
- rprint(i, "|cSUPER JUMP!! - BE CAREFUL WHEN JUMPING!")
- end
- rprint(i, " ")
- rprint(i, " ")
- end
- end
- if super_jump then
- execute_command_sequence('cheat_super_jump 1;cheat_jetpack 1', i)
- else
- execute_command_sequence('cheat_super_jump 0;cheat_jetpack 0', i)
- end
- end
- end
- execute_command("gravity " .. gravity_default or 0.003565)
- end
- function OnTick()
- if (game_started == true) then
- for PlayerIndex=1,16 do
- if player_present(PlayerIndex) then
- if player_alive(PlayerIndex) then
- local player_object = get_dynamic_player(PlayerIndex)
- local x,y,z = read_vector3d(get_dynamic_player(PlayerIndex) + 0x5C)
- if (player_object ~= 0) then
- write_dword(get_player(PlayerIndex) + 0xF0, 0)
- write_dword(get_player(PlayerIndex) + 0x164, 0)
- if map_name == "boardingaction" or map_name == "gephyrophobia" or map_name == "damnation" then
- if z < deathplane then kill(PlayerIndex) end
- end
- end
- end
- end
- end
- end
- end
- function LoadDefaults()
- -- note: setting gravity to higher than 0.003565 (default gravity) can result in player deaths
- gravity_setting = {
- ["bloodgulch"] = 0.003565,
- ["dangercanyon"] = 0.003565,
- ["deathisland"] = 0.003565,
- ["gephyrophobia"] = 0.003565,
- ["icefields"] = 0.003565,
- ["infinity"] = 0.003565,
- ["sidewinder"] = 0.003565,
- ["timberland"] = 0.003565,
- ["hangemhigh"] = 0.001248,
- ["ratrace"] = 0.003565,
- ["beavercreek"] = 0.003565,
- ["damnation"] = 0.003565,
- ["boardingaction"] = 0.001248,
- ["carousel"] = 0.003565,
- ["putput"] = 0.003565,
- ["prisoner"] = 0.001248,
- ["wizard"] = 0.003565
- }
- set_super_jump = {
- ["bloodgulch"] = false,
- ["dangercanyon"] = false,
- ["deathisland"] = false,
- ["gephyrophobia"] = false,
- ["icefields"] = false,
- ["infinity"] = false,
- ["sidewinder"] = false,
- ["timberland"] = false,
- ["hangemhigh"] = true,
- ["ratrace"] = false,
- ["beavercreek"] = false,
- ["damnation"] = false,
- ["boardingaction"] = true,
- ["carousel"] = false,
- ["putput"] = false,
- ["prisoner"] = true,
- ["wizard"] = false
- }
- gravity_default = gravity_setting[map_name]
- super_jump = set_super_jump[map_name]
- end
- -- Created by H® Shaft
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement