Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local autohaste = {}
- local gamestate = GetGameState()
- autohaste.open = true
- autohaste.visible = true
- autohaste.hue = 125
- function autohaste.Draw( event, ticks )
- if ( autohaste.open ) then
- 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.
- autohaste.visible, autohaste.open = GUI:Begin("Autohaste", autohaste.open)
- 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
- GUI:Text("Launched")
- local FarPC = EntityList("type=1,nearest,maxdistance=140")
- local MediumPC = EntityList("type=1,nearest,maxdistance=100")
- local ClosePC = EntityList("type=1,nearest,maxdistance=60")
- if (table.valid(ClosePC)) then
- GUI:Text("PC < 60 away")
- Player:ResetSpeed(0) -- default flying 20
- Player:ResetSpeed(1) -- default walking 6
- Player:ResetSpeed(2) -- default mounted 9
- elseif (table.valid(MediumPC)) then
- GUI:Text("PC 60-99 away")
- Player:ResetSpeed(0)
- Player:ResetSpeed(1)
- Player:ResetSpeed(2)
- elseif (table.valid(FarPC)) then
- GUI:Text("PC 100-140 away")
- Player:SetSpeed(0,30,30,30)
- Player:SetSpeed(1,9,9,9)
- Player:SetSpeed(2,16,16,16)
- else
- GUI:Text("No PC in 140")
- Player:SetSpeed(0,40,40,40)
- Player:SetSpeed(1,12,12,12)
- Player:SetSpeed(2,22,22,22)
- end
- end
- GUI:End()
- end
- end
- RegisterEventHandler("Gameloop.Draw", autohaste.Draw, "autohaste-AnyNameHereToIdentYourCodeInCaseOfError") -- register our function to the hardcoded c++ event which is called every frame
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement