ARSEnic69

Client

Dec 21st, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. local ChallengeCount = 5;
  2. local ButtonPress = "";
  3. local Client = FindLocalPlayer();
  4. local InChallenge = false;
  5. local OnAir = false;
  6. local MainServerDirectory = "Main/Main.nut"
  7. class ChallengeSelect{
  8. Window = GUIWindow(VectorScreen(ScreenWidth/10*2, ScreenHeight/10*4), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*4), "Choose your challenge!")
  9. Info = GUILabel(VectorScreen(ScreenWidth/10*6/1/2, ScreenHeight/10*2/3*0), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "-")
  10. Description1 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*2), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  11. Description2 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*2.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  12. Description3 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*3), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  13. Description4 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*3.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  14. Description5 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*4), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  15. Description6 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*4.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  16. Description7 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  17. Description8 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*5.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  18. }
  19. class Detail{
  20. Window = GUIWindow(VectorScreen(ScreenWidth/10*8, ScreenHeight/10*8), ScreenSize(ScreenWidth/10*2, ScreenHeight/10*2), "Details")
  21. Gear = GUILabel(VectorScreen(0, 0), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  22. Speed = GUILabel(VectorScreen(0, ScreenHeight/10*2/5*2), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
  23. }
  24. function SetChallengeCount(Count){
  25. ChallengeCount = Count;
  26. local i = 1;
  27. while(i <= ChallengeCount){
  28. local Button = GUIButton(VectorScreen(ScreenWidth/10*6/ChallengeCount*(i-1), ScreenHeight/10*2/3*1), ScreenSize(ScreenWidth/10*6/ChallengeCount, ScreenHeight/10*2/3*1), i + "")
  29. ChallengeSelect.Window.AddChild(Button);
  30. i++;
  31. }
  32. }
  33.  
  34. function onScriptLoad(){
  35. AddGUILayer(ChallengeSelect.Window)
  36. ChallengeSelect.Window.AddChild(ChallengeSelect.Description1)
  37. ChallengeSelect.Window.AddChild(ChallengeSelect.Description2)
  38. ChallengeSelect.Window.AddChild(ChallengeSelect.Description3)
  39. ChallengeSelect.Window.AddChild(ChallengeSelect.Description4)
  40. ChallengeSelect.Window.AddChild(ChallengeSelect.Description5)
  41. ChallengeSelect.Window.AddChild(ChallengeSelect.Description6)
  42. ChallengeSelect.Window.AddChild(ChallengeSelect.Description7)
  43. ChallengeSelect.Window.AddChild(ChallengeSelect.Description8)
  44. ChallengeSelect.Window.AddChild(ChallengeSelect.Info)
  45.  
  46.  
  47. ChallengeSelect.Window.Colour = Colour(50, 50, 50)
  48.  
  49. ChallengeSelect.Info.Text = "Select your challenge and double click the button to start"
  50. ChallengeSelect.Info.FontSize = ScreenWidth*ScreenHeight/100000;
  51. ChallengeSelect.Info.TextAlignment = ALIGN_TOP_CENTER;
  52.  
  53. ChallengeSelect.Description1.FontSize = ScreenWidth*ScreenHeight/90000;
  54. ChallengeSelect.Description2.FontSize = ScreenWidth*ScreenHeight/90000;
  55. ChallengeSelect.Description3.FontSize = ScreenWidth*ScreenHeight/90000;
  56. ChallengeSelect.Description4.FontSize = ScreenWidth*ScreenHeight/90000;
  57. ChallengeSelect.Description5.FontSize = ScreenWidth*ScreenHeight/90000;
  58. ChallengeSelect.Description6.FontSize = ScreenWidth*ScreenHeight/90000;
  59. ChallengeSelect.Description7.FontSize = ScreenWidth*ScreenHeight/90000;
  60. ChallengeSelect.Description8.FontSize = ScreenWidth*ScreenHeight/90000;
  61. ChallengeSelect.Window.Visible = false;
  62.  
  63. AddGUILayer(Detail.Window)
  64. Detail.Window.Colour = Colour(25, 25, 25)
  65. Detail.Window.Visible = false;
  66. Detail.Window.AddChild(Detail.Gear)
  67. Detail.Window.AddChild(Detail.Speed)
  68.  
  69. Detail.Gear.FontSize = ScreenWidth*ScreenHeight/40000;
  70. Detail.Speed.FontSize = ScreenWidth*ScreenHeight/75000;
  71.  
  72. }
  73. function onClientSpawn(Spawn){
  74. ShowSelectChallenge();
  75. }
  76. function onClientEnteredVehicle(Vehicle, Seat){
  77. if(Vehicle.Model == 126){
  78. Client.Frozen = true;
  79. ChallengeSelect.Window.Visible = true;
  80. }
  81. }
  82. function onClientExitingVehicle(Vehicle){
  83. return 0;
  84. }
  85. function onClientClickButton(Button){
  86. if(Button.ID == 0){
  87. //Challenge One
  88. if(ButtonPress == 1){
  89. StartChallenge(1)
  90. }else{
  91. ChallengeSelect.Description1.Text = "Start off at Shoreside airport, fly under the Shoreside Bridge,"
  92. ChallengeSelect.Description2.Text = "then fly under the PikeCreek/Cedar Grove Bridge, fly under the Callahan Bridge"
  93. ChallengeSelect.Description3.Text = "and then under the rocky arc at Portland Bridge."
  94. ChallengeSelect.Description4.Text = "Finally, land the plane safely at shoreside airport."
  95. ChallengeSelect.Description5.Text = ""
  96. ChallengeSelect.Description6.Text = ""
  97. ChallengeSelect.Description7.Text = ""
  98. ChallengeSelect.Description8.Text = "Difficulty: Easy"
  99. ButtonPress = 1;
  100. }
  101. }
  102. }
  103. function StartChallenge(ChallengeID){
  104. switch(ChallengeID){
  105. case 1:
  106. HideSelectChallenge()
  107. CallServerFunc(MainServerDirectory, "StartChallenge", Client, 1)
  108. break;
  109.  
  110. }
  111. }
  112. function EndChallenge(End){
  113. Message("sss")
  114. if(End == "-"){
  115. NewTimer(EndChallenge, 5000, 1, "+")
  116. }else{
  117. ShowSelectChallenge()
  118. }
  119. }
  120. function ShowSelectChallenge(){
  121. try{
  122. ShowMouseCursor(true);
  123. ChallengeSelect.Window.Visible = true;
  124. Client.Frozen = true;
  125. }catch(e)
  126. Message(e)
  127. }
  128. function HideSelectChallenge(){
  129. ShowMouseCursor(false);
  130. ChallengeSelect.Window.Visible = false;
  131. Client.Frozen = false;
  132. }
  133. function onClientRender(){
  134. if(Client.Vehicle){
  135. local Vehicle = Client.Vehicle;
  136. local VehicleSpeed = Speed(Vehicle.Velocity)
  137. Detail.Window.Visible = true;
  138. Detail.Gear.Text = Vehicle.Gear + "";
  139. Detail.Speed.Text = VehicleSpeed + " km/h"
  140. //Detail.Speed.Colour = Colour(Speed(Velocity)/1.1, 255 - Speed(Velocity)/1.1, 0)
  141. //HOW THE FUCK DOES THIS CAUSE CRASH^
  142.  
  143. }else{
  144. Detail.Window.Visible = false;
  145. }
  146. }
  147. function onClientCommand(s,a){
  148. EndChallenge(false)
  149. }
  150. function Speed(Velocity){
  151. return sqrt(Velocity.x*Velocity.x + Velocity.y*Velocity.y + Velocity.z*Velocity.z)*100*1.6
  152. }
Advertisement
Add Comment
Please, Sign In to add comment