SHARE
TWEET

Untitled

a guest Jun 25th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local autohaste = {}   
  2. local gamestate = GetGameState()
  3. autohaste.open = true
  4. autohaste.visible = true
  5. autohaste.hue = 125
  6.  
  7. function autohaste.Draw( event, ticks )    
  8.     if ( autohaste.open ) then 
  9.         GUI:SetNextWindowSize(250,400,GUI.SetCond_FirstUseEver) -- set the next window size, only on first ever, GUI.SetCond_FirstUseEver is one of many possible enums.
  10.         autohaste.visible, autohaste.open = GUI:Begin("Autohaste", autohaste.open)
  11.         if ( autohaste.visible ) then -- visible is true/false depending if the window is collapsed or not, we don't have to render anything in it when it is collapsed
  12.              GUI:Text("Launched")            
  13.              local FarPC = EntityList("type=1,nearest,maxdistance=140")
  14.              local MediumPC = EntityList("type=1,nearest,maxdistance=100")
  15.              local ClosePC = EntityList("type=1,nearest,maxdistance=60")
  16.  
  17.                 if (table.valid(ClosePC)) then
  18.                     GUI:Text("PC < 60 away")                   
  19.                     Player:ResetSpeed(0) -- default flying 20
  20.                     Player:ResetSpeed(1) -- default walking 6
  21.                     Player:ResetSpeed(2) -- default mounted 9                  
  22.                 elseif (table.valid(MediumPC)) then
  23.                     GUI:Text("PC 60-99 away")                  
  24.                     Player:ResetSpeed(0)
  25.                     Player:ResetSpeed(1)
  26.                     Player:ResetSpeed(2)
  27.                 elseif (table.valid(FarPC)) then
  28.                     GUI:Text("PC 100-140 away")                
  29.                     Player:SetSpeed(0,30,30,30)
  30.                     Player:SetSpeed(1,9,9,9)
  31.                     Player:SetSpeed(2,16,16,16)                
  32.                 else
  33.                     GUI:Text("No PC in 140")
  34.                     Player:SetSpeed(0,40,40,40)
  35.                     Player:SetSpeed(1,12,12,12)
  36.                     Player:SetSpeed(2,22,22,22)
  37.                 end
  38.        end
  39.        GUI:End()
  40.     end
  41. end
  42. RegisterEventHandler("Gameloop.Draw", autohaste.Draw, "autohaste-AnyNameHereToIdentYourCodeInCaseOfError") -- register our function to the hardcoded c++ event which is called every frame
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top