Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ChallengeCount = 5;
- local ButtonPress = "";
- local Client = FindLocalPlayer();
- local InChallenge = false;
- local OnAir = false;
- local MainServerDirectory = "Main/Main.nut"
- class ChallengeSelect{
- Window = GUIWindow(VectorScreen(ScreenWidth/10*2, ScreenHeight/10*4), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*4), "Choose your challenge!")
- Info = GUILabel(VectorScreen(ScreenWidth/10*6/1/2, ScreenHeight/10*2/3*0), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "-")
- Description1 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*2), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description2 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*2.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description3 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*3), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description4 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*3.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description5 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*4), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description6 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*4.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description7 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- Description8 = GUILabel(VectorScreen(0, ScreenHeight/10*2/3*5.5), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- }
- class Detail{
- Window = GUIWindow(VectorScreen(ScreenWidth/10*8, ScreenHeight/10*8), ScreenSize(ScreenWidth/10*2, ScreenHeight/10*2), "Details")
- Gear = GUILabel(VectorScreen(0, 0), ScreenSize(ScreenWidth/10*6, ScreenHeight/10*2), "")
- }
- function SetChallengeCount(Count){
- ChallengeCount = Count;
- local i = 1;
- while(i <= ChallengeCount){
- 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 + "")
- ChallengeSelect.Window.AddChild(Button);
- i++;
- }
- }
- function onScriptLoad(){
- AddGUILayer(ChallengeSelect.Window)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description1)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description2)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description3)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description4)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description5)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description6)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description7)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Description8)
- ChallengeSelect.Window.AddChild(ChallengeSelect.Info)
- AddGUILayer(Detail.Window)
- ChallengeSelect.Window.Colour = Colour(50, 50, 50)
- ChallengeSelect.Info.Text = "Select your challenge and double click the button to start"
- ChallengeSelect.Info.FontSize = ScreenWidth*ScreenHeight/100000;
- ChallengeSelect.Info.TextAlignment = ALIGN_TOP_CENTER;
- ChallengeSelect.Description1.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description2.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description3.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description4.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description5.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description6.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description7.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Description8.FontSize = ScreenWidth*ScreenHeight/90000;
- ChallengeSelect.Window.Visible = false;
- Detail.Window.Visible = false;
- }
- function onClientSpawn(Spawn){
- ShowSelectChallenge();
- }
- function onClientEnteredVehicle(Vehicle, Seat){
- if(Vehicle.Model == 126){
- Client.Frozen = true;
- ChallengeSelect.Window.Visible = true;
- }
- }
- function onClientExitingVehicle(Vehicle){
- Messag("s")
- return 0;
- }
- function onClientClickButton(Button){
- if(Button.ID == 0){
- //Challenge One
- if(ButtonPress == 1){
- StartChallenge(1)
- }else{
- ChallengeSelect.Description1.Text = "Start off at Shoreside airport, fly under the Shoreside Bridge,"
- ChallengeSelect.Description2.Text = "then fly under the PikeCreek/Cedar Grove Bridge, fly under the Callahan Bridge"
- ChallengeSelect.Description3.Text = "and then under the rocky arc at Portland Bridge."
- ChallengeSelect.Description4.Text = "Finally, land the plane safely at shoreside airport."
- ChallengeSelect.Description5.Text = ""
- ChallengeSelect.Description6.Text = ""
- ChallengeSelect.Description7.Text = ""
- ChallengeSelect.Description8.Text = "Difficulty: Easy"
- ButtonPress = 1;
- }
- }
- }
- function StartChallenge(ChallengeID){
- switch(ChallengeID){
- case 1:
- HideSelectChallenge()
- CallServerFunc(MainServerDirectory, "StartChallenge", Client, 1)
- break;
- }
- }
- function ShowSelectChallenge(){
- try{
- ShowMouseCursor(true);
- ChallengeSelect.Window.Visible = true;
- Client.Frozen = true;
- }
- catch(e)
- Message(e)
- }
- function HideSelectChallenge(){
- ShowMouseCursor(false);
- ChallengeSelect.Window.Visible = false;
- Client.Frozen = false;
- }
- function onClientRender(){
- if(Client.Vehicle){
- Detail.Window.Visible = true;
- }else{
- Detail.Window.Visible = false;
- }
- }
Add Comment
Please, Sign In to add comment