Advertisement
HR_Shaft

Super Jump for Phasor v2+

Dec 21st, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.64 KB | None | 0 0
  1. -- Super Jump for Phasor v2+
  2. -- by H® Shaft
  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. function GetRequiredVersion()
  9.     return 200
  10. end
  11.  
  12. function OnScriptLoad(process, game, persistent)
  13.     GAME = game
  14.     GetGameAddresses(GAME)
  15.     game_started = false
  16.     for i=0,15 do
  17.         if getplayer(i) then
  18.             if isalive(i) then
  19.                 writedword(getplayer(i) + 0xF0, 0)
  20.                 writedword(getplayer(i) + 0x164, 0)    
  21.             end
  22.         end
  23.     end
  24. end
  25.  
  26. function OnClientUpdate(player)
  27.     if getplayer(player) then
  28.         if isalive(player) then
  29.             writedword(getplayer(player) + 0xF0, 0)
  30.             writedword(getplayer(player) + 0x164, 0)
  31.         end
  32.     end
  33. end
  34.  
  35. function OnPlayerSpawn(player, m_objectId)
  36.     if isalive(player) then
  37.         writedword(getplayer(player) + 0xF0, 0)
  38.         writedword(getplayer(player) + 0x164, 0)
  39.     end
  40. end
  41.  
  42. function OnNewGame(map)
  43.     game_started = true
  44.     GetGameAddresses(GAME)
  45. end
  46.  
  47. function OnPlayerJoin(player)
  48.     if getplayer(player) then
  49.         if game_started then
  50.             svcmd("set cheat_super_jump true")
  51.             svcmd("set cheat_jetpack true")
  52.         end
  53.     end
  54. end
  55.  
  56. function OnGameEnd(stage)
  57.     if stage == 1 then
  58.         game_started = false
  59.         if not game_started then
  60.             svcmd("set cheat_super_jump false")
  61.             svcmd("set cheat_jetpack false")
  62.         end    
  63.     end
  64. end
  65.  
  66. function isalive(player)
  67.     local m_objectId = getplayerobjectid(player)
  68.     if m_objectId then
  69.         local m_object = getobject(m_objectId)
  70.         if m_object then
  71.             return true
  72.         else
  73.             return false
  74.         end
  75.     end
  76. end
  77.  
  78. function GetGameAddresses(GAME)
  79.     if (GAME == nil) then return end
  80.     if GAME == "PC" then
  81.         map_name = readstring(0x698F21)
  82.         gametype_base = 0x671340
  83.         devmode_patch1 = 0x4A4DBF
  84.         devmode_patch2 = 0x4A4E7F  
  85.     else
  86.         map_name = readstring(0x61D151)
  87.         gametype_base = 0x5F5498
  88.         devmode_patch1 = 0x47DF0C
  89.         devmode_patch2 = 0x47DFBC
  90.     end
  91.     writeword(devmode_patch1, 0x9090)
  92.     writeword(devmode_patch2, 0x9090)  
  93. end
  94.  
  95. map_reset = false
  96. function ScriptLoad()
  97.     if map_reset == true then
  98.         map_reset = false
  99.         game_started = true
  100.         for i=0,15 do
  101.             if getplayer(i) then
  102.                 if isalive(i) then
  103.                     svcmd("set cheat_super_jump true")
  104.                     svcmd("set cheat_jetpack true")
  105.                 end
  106.             end
  107.         end        
  108.     end
  109. end
  110.  
  111. function OnServerCommand(player, command)
  112.     local allow = nil
  113.     local t = tokenizecmdstring(command)
  114.     local count = #t
  115.     if t[1] == "sv_script_reload" then
  116.         map_reset = true
  117.         ScriptLoad()   
  118.         allow = true
  119.     end    
  120.     return allow
  121. end
  122.  
  123. -- Created by H® Shaft
  124. -- Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement