Advertisement
HR_Shaft

Super Jump for SAPP

Feb 2nd, 2016
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. -- Super Jump
  2. -- by H® Shaft for SAPP
  3.  
  4. -- Script allows use of dev-mode super-jump in multiplayer.
  5. -- fall damage is off to prevent player damage when landing
  6. -- players sometimes de-sync, (can't see themselves jumping high), it resolves itself shortly, or upon death
  7.  
  8. api_version = "1.9.0.0"
  9. game_started = false
  10. team_play = false
  11.  
  12. function OnScriptLoad()
  13.     register_callback(cb['EVENT_JOIN'], "OnPlayerJoin")
  14.     register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
  15.     register_callback(cb['EVENT_GAME_START'], "OnNewGame")
  16.     register_callback(cb['EVENT_TICK'],"OnTick")
  17.     register_callback(cb['EVENT_DIE'], "OnPlayerDeath")
  18.     if get_var(0, "$gt") ~= "n/a" then
  19.         game_started = true
  20.         for i = 1, 16 do
  21.             if player_present(i) then
  22.                 OnPlayerSpawn(i)
  23.             end
  24.         end    
  25.     end
  26. end
  27.  
  28. function OnPlayerSpawn(PlayerIndex)
  29.     if (game_started == true) then
  30.         if player_alive(PlayerIndex) then
  31.             write_dword(get_player(PlayerIndex) + 0xF0, 0)
  32.             write_dword(get_player(PlayerIndex) + 0x164, 0)    
  33.             execute_command_sequence('cheat_super_jump 1;cheat_jetpack 1', PlayerIndex)
  34.         end
  35.     end
  36. end
  37.    
  38. function OnPlayerJoin(PlayerIndex)
  39.     if (game_started == true) then
  40.         write_dword(get_player(PlayerIndex) + 0x2C, 60)
  41.     end
  42. end
  43.  
  44. function OnNewGame()
  45.     game_started = true
  46.     for i = 1, 16 do
  47.         if player_present(i) then
  48.             write_dword(get_player(i) + 0x2C, 60)
  49.             execute_command_sequence('cheat_super_jump 1;cheat_jetpack 1', i)  
  50.         end
  51.     end
  52. end
  53.  
  54. function OnTick()
  55.     if (game_started == true) then
  56.         for PlayerIndex=1,16 do
  57.             if player_present(PlayerIndex) then
  58.                 if player_alive(PlayerIndex) then
  59.                     local player_object = get_dynamic_player(PlayerIndex)  
  60.                     if (player_object ~= 0) then   
  61.                         write_dword(get_player(PlayerIndex) + 0xF0, 0)
  62.                         write_dword(get_player(PlayerIndex) + 0x164, 0)
  63.                     end
  64.                 end
  65.             end
  66.         end
  67.     end
  68. end
  69.  
  70. function OnPlayerDeath(PlayerIndex, KillerIndex)
  71.     if (game_started == true) then
  72.         -- sets respawn to 1.5 seconds
  73.         execute_command_sequence('nades me 0;wdel me *', PlayerIndex)
  74.         local player_obj_id = read_dword(get_player(PlayerIndex) + 0x34)
  75.         if (player_obj_id ~= 0xFFFFFFFF) then
  76.             write_dword(get_player(PlayerIndex) + 0x2C, 60)
  77.         end
  78.     end
  79. end
  80.  
  81. function OnScriptUnload()
  82.     execute_command_sequence('cheat_super_jump 0;cheat_jetpack 0')
  83. end
  84.  
  85. function getteamplay()
  86.     if readbyte(gametype_base + 0x34) == 1 then
  87.         return true
  88.     else
  89.         return false
  90.     end
  91. end
  92.    
  93. -- Created by H® Shaft
  94. -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement