ARSEnic69

Client.nuts

Dec 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.18 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. }
  23. function SetChallengeCount(Count){
  24. ChallengeCount = Count;
  25. local i = 1;
  26. while(i <= ChallengeCount){
  27. 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 + "")
  28. ChallengeSelect.Window.AddChild(Button);
  29. i++;
  30. }
  31. }
  32.  
  33. function onScriptLoad(){
  34. AddGUILayer(ChallengeSelect.Window)
  35. ChallengeSelect.Window.AddChild(ChallengeSelect.Description1)
  36. ChallengeSelect.Window.AddChild(ChallengeSelect.Description2)
  37. ChallengeSelect.Window.AddChild(ChallengeSelect.Description3)
  38. ChallengeSelect.Window.AddChild(ChallengeSelect.Description4)
  39. ChallengeSelect.Window.AddChild(ChallengeSelect.Description5)
  40. ChallengeSelect.Window.AddChild(ChallengeSelect.Description6)
  41. ChallengeSelect.Window.AddChild(ChallengeSelect.Description7)
  42. ChallengeSelect.Window.AddChild(ChallengeSelect.Description8)
  43. ChallengeSelect.Window.AddChild(ChallengeSelect.Info)
  44.  
  45. AddGUILayer(Detail.Window)
  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. Detail.Window.Visible = false;
  63.  
  64. }
  65. function onClientSpawn(Spawn){
  66. ShowSelectChallenge();
  67. }
  68. function onClientEnteredVehicle(Vehicle, Seat){
  69. if(Vehicle.Model == 126){
  70. Client.Frozen = true;
  71. ChallengeSelect.Window.Visible = true;
  72. }
  73. }
  74. function onClientExitingVehicle(Vehicle){
  75. Messag("s")
  76. return 0;
  77. }
  78. function onClientClickButton(Button){
  79. if(Button.ID == 0){
  80. //Challenge One
  81. if(ButtonPress == 1){
  82. StartChallenge(1)
  83. }else{
  84. ChallengeSelect.Description1.Text = "Start off at Shoreside airport, fly under the Shoreside Bridge,"
  85. ChallengeSelect.Description2.Text = "then fly under the PikeCreek/Cedar Grove Bridge, fly under the Callahan Bridge"
  86. ChallengeSelect.Description3.Text = "and then under the rocky arc at Portland Bridge."
  87. ChallengeSelect.Description4.Text = "Finally, land the plane safely at shoreside airport."
  88. ChallengeSelect.Description5.Text = ""
  89. ChallengeSelect.Description6.Text = ""
  90. ChallengeSelect.Description7.Text = ""
  91. ChallengeSelect.Description8.Text = "Difficulty: Easy"
  92. ButtonPress = 1;
  93. }
  94. }
  95. }
  96. function StartChallenge(ChallengeID){
  97. switch(ChallengeID){
  98. case 1:
  99. HideSelectChallenge()
  100. CallServerFunc(MainServerDirectory, "StartChallenge", Client, 1)
  101. break;
  102.  
  103. }
  104. }
  105. function ShowSelectChallenge(){
  106. try{
  107. ShowMouseCursor(true);
  108. ChallengeSelect.Window.Visible = true;
  109. Client.Frozen = true;
  110. }
  111. catch(e)
  112. Message(e)
  113. }
  114. function HideSelectChallenge(){
  115. ShowMouseCursor(false);
  116. ChallengeSelect.Window.Visible = false;
  117. Client.Frozen = false;
  118. }
  119. function onClientRender(){
  120. if(Client.Vehicle){
  121. Detail.Window.Visible = true;
  122. }else{
  123. Detail.Window.Visible = false;
  124. }
  125. }
Add Comment
Please, Sign In to add comment