Advertisement
HR_Shaft

Invis-While-Crouched v1 for Phasor v2

Apr 26th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.27 KB | None | 0 0
  1. --[[ ###  Invis-While-Crouched v1   ###]]--
  2. --[[ ### for Phasor v2 by H® Shaft  ###]]--
  3.  
  4. -- To activate: Press and hold down the crouch the key to remain invisible - when released, you will reappear.
  5. -- Does not accidentally activate on impact/falling crouch.
  6. -- Players may still use the powerup active-camouflage when not crouched and it will behave normally.
  7.  
  8. -- Related Similar Script: http://pastebin.com/wA06DicK  "Crouch-ActiveCamo" which allows players to activate active camouflage by crouching for a [editable] duration.
  9.  
  10. -- edit --
  11. red_allow  = true       --| Enable for red team set to true, to disable set to false.
  12. blue_allow = true       --| Enable for blue team set to true, to disable set to false.
  13.  
  14. function GetRequiredVersion()
  15.     return 200
  16. end
  17.  
  18. function OnScriptLoad(processid, game, persistent)
  19.     checkstance = registertimer(66, "CheckStance") 
  20. end
  21.  
  22. function CheckStance(id, count)
  23.     for i = 0,15 do
  24.         if getplayer(i) then
  25.             local m_objectId = getplayerobjectid(i)
  26.             if m_objectId then
  27.                 if readbit(getobject(m_objectId) + 0x208, 0) and not isinvehicle(i) then
  28.                     OnPlayerCrouch(i)
  29.                 elseif readbyte(getobject(m_objectId) + 0x2A0) == 4 then
  30.                     OnPlayerStand(i)
  31.                 end
  32.             end
  33.         end
  34.     end
  35.     return true
  36. end
  37.  
  38. function OnPlayerCrouch(player)
  39.     if getplayer(player) then
  40.         local team = getteam(player)
  41.         local m_objectId = getplayerobjectid(player)
  42.         if m_objectId then
  43.             if readdword(getobject(m_objectId) + 0x204) == 0x41 then
  44.                 if (team == 0 and red_allow) or (team == 1 and blue_allow) then
  45.                     applycamo(player, 2)
  46.                 end
  47.             end
  48.         end
  49.     end
  50. end
  51.  
  52. function OnPlayerStand(player)
  53.     if getplayer(player) then
  54.         local team = getteam(player)
  55.         local m_objectId = getplayerobjectid(player)
  56.         if m_objectId then
  57.             if readdword(getobject(m_objectId) + 0x204) == 0x51 then
  58.                 if (team == 0 and red_allow) or (team == 1 and blue_allow) then
  59.                     applycamo(player, 0.1)
  60.                 end
  61.             end
  62.         end
  63.     end    
  64. end
  65.  
  66. function OnGameEnd(stage)
  67.     if stage == 1 then
  68.         if checkstance then
  69.             removetimer(checkstance)
  70.             checkstance = nil
  71.         end
  72.     end
  73. end
  74.  
  75. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  76. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  77. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement