Exemplo n.º 1
0
        void DedicatedServerFormLoad(object sender, EventArgs e)
        {
            string ExtractedArg = "";

            //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog.txt", GlobalVars.SharedArgs);
            ExtractedArg = GlobalVars.SharedArgs.Replace("origins07server://", "").Replace("origins07server", "").Replace("origins07", "").Replace("origins", "").Replace(":", "").Replace("/", "").Replace("?", "");
            //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog2.txt", ExtractedArg);
            string ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);

            string[] SplitArg = ConvertedArg.Split('|');
            string   port     = SecurityFuncs.Base64Decode(SplitArg[0]);
            string   limit    = SecurityFuncs.Base64Decode(SplitArg[2]);
            bool     upnp     = Convert.ToBoolean(SecurityFuncs.Base64Decode(SplitArg[3]));

            string mapdir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\maps";

            if (Directory.Exists(mapdir))
            {
                DirectoryInfo dinfo = new DirectoryInfo(mapdir);
                FileInfo[]    Files = dinfo.GetFiles("*.rbxl");
                foreach (FileInfo file in Files)
                {
                    listBox1.Items.Add(file.Name);
                }
                listBox1.SelectedItem = "Baseplate.rbxl";
            }
        }
Exemplo n.º 2
0
        void Button1Click(object sender, EventArgs e)
        {
            string ExtractedArg = "";

            //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog.txt", GlobalVars.SharedArgs);
            ExtractedArg = GlobalVars.SharedArgs.Replace("origins07server://", "").Replace("origins07server", "").Replace("origins07", "").Replace("origins", "").Replace(":", "").Replace("/", "").Replace("?", "");
            //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog2.txt", ExtractedArg);
            string ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);

            string[] SplitArg = ConvertedArg.Split('|');
            string   port     = SecurityFuncs.Base64Decode(SplitArg[0]);
            string   ping     = SecurityFuncs.Base64Decode(SplitArg[1]);
            string   limit    = SecurityFuncs.Base64Decode(SplitArg[2]);
            bool     upnp     = Convert.ToBoolean(SecurityFuncs.Base64Decode(SplitArg[3]));
            string   id       = SecurityFuncs.Base64Decode(SplitArg[4]);

            if (upnp == true)
            {
                StartUPNP();
            }
            ScriptType type = ScriptType.Server;

            ScriptGenerator.GenerateScriptForClient(type, ping, port, limit, id);
            //temp domain
            string  exefile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Origins07_Server.exe";
            string  quote   = "\"";
            string  args    = "-script " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + ScriptGenerator.GetScriptNameForType(type) + quote + " -no3d " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\maps\\" + listBox1.SelectedItem.ToString() + quote;
            Process server  = new Process();

            server.StartInfo.FileName  = exefile;
            server.StartInfo.Arguments = args;
            server.EnableRaisingEvents = true;
            server.Exited += new EventHandler(ServerExited);
            server.Start();
        }
        void NameFormLoad(object sender, EventArgs e)
        {
            if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + GlobalVars.Config))
            {
                SecurityFuncs.GeneratePlayerID();
                SecurityFuncs.WriteConfigValues();
                SecurityFuncs.ReadConfigValues();
            }
            else
            {
                SecurityFuncs.ReadConfigValues();
            }
            textBox1.Text = GlobalVars.Name;

            string hatdir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\content\\hats";

            if (Directory.Exists(hatdir))
            {
                DirectoryInfo dinfo = new DirectoryInfo(hatdir);
                FileInfo[]    Files = dinfo.GetFiles("*.rbxm");
                foreach (FileInfo file in Files)
                {
                    if (file.Name.Equals(String.Empty))
                    {
                        continue;
                    }

                    listBox1.Items.Add(file.Name);
                }
                listBox1.SelectedItem = GlobalVars.HatName;
                Image icon1 = Image.FromFile(hatdir + @"\\" + GlobalVars.HatName.Replace(".rbxm", "") + ".png");
                pictureBox1.Image = icon1;
            }

            string mapdir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\maps";

            if (Directory.Exists(mapdir))
            {
                DirectoryInfo dinfo = new DirectoryInfo(mapdir);
                FileInfo[]    Files = dinfo.GetFiles("*.rbxl");
                foreach (FileInfo file in Files)
                {
                    listBox2.Items.Add(file.Name);
                }
                listBox2.SelectedItem = "Baseplate.rbxl";
            }

            PartSelectionLabel2.Text = SelectedPart;
            HeadButton1.BackColor    = ConvertStringtoColor(GlobalVars.ColorMenu_HeadColor);
            TorsoButton2.BackColor   = ConvertStringtoColor(GlobalVars.ColorMenu_TorsoColor);
            RArmButton3.BackColor    = ConvertStringtoColor(GlobalVars.ColorMenu_RightArmColor);
            LArmButton4.BackColor    = ConvertStringtoColor(GlobalVars.ColorMenu_LeftArmColor);
            RLegButton5.BackColor    = ConvertStringtoColor(GlobalVars.ColorMenu_RightLegColor);
            LLegButton6.BackColor    = ConvertStringtoColor(GlobalVars.ColorMenu_LeftLegColor);
        }
Exemplo n.º 4
0
 void StartGame()
 {
     if (GlobalVars.SharedArgs.Contains("origins07local://"))
     {
         string ExtractedArg = "";
         //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog.txt", GlobalVars.SharedArgs);
         ExtractedArg = GlobalVars.SharedArgs.Replace("origins07local://", "").Replace("origins07local", "").Replace("origins07", "").Replace("origins", "").Replace(":", "").Replace("/", "").Replace("?", "");
         //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog2.txt", ExtractedArg);
         string     ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);
         ScriptType type         = ScriptType.Solo;
         ScriptGenerator.GenerateScriptForClient(type);
         bool IsValid = SecurityFuncs.checkClientMD5();
         if (IsValid == true)
         {
             //temp domain
             string exefile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Origins07_Client.exe";
             string quote   = "\"";
             string args    = "-script " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + ScriptGenerator.GetScriptNameForType(type) + quote + " " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\maps\\" + ConvertedArg + quote;
             Process.Start(exefile, args);
             this.Close();
         }
         else
         {
             label1.Text = "Cannot Launch Game.";
             label2.Text = "The client has been detected as modified.";
         }
     }
     else
     {
         string ExtractedArg = "";
         ExtractedArg = GlobalVars.SharedArgs.Replace("origins07://", "").Replace("origins07", "").Replace("origins", "").Replace(":", "").Replace("/", "").Replace("?", "");
         //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog2.txt", ExtractedArg);
         string     ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);
         string[]   SplitArg     = ConvertedArg.Split('|');
         string     ip           = SecurityFuncs.Base64Decode(SplitArg[0]);
         string     port         = SecurityFuncs.Base64Decode(SplitArg[1]);
         ScriptType type         = ScriptType.Join;
         ScriptGenerator.GenerateScriptForClient(type, ip, port);
         bool IsValid = SecurityFuncs.checkClientMD5();
         if (IsValid == true)
         {
             //temp domain
             string exefile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Origins07_Client.exe";
             string quote   = "\"";
             string args    = "-script " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + ScriptGenerator.GetScriptNameForType(type) + quote;
             Process.Start(exefile, args);
             this.Close();
         }
         else
         {
             label1.Text = "Cannot Launch Game.";
             label2.Text = "The client has been detected as modified.";
         }
     }
 }
Exemplo n.º 5
0
        void ServerExited(object sender, EventArgs e)
        {
            string ExtractedArg = "";

            //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog.txt", GlobalVars.SharedArgs);
            ExtractedArg = GlobalVars.SharedArgs.Replace("origins07server://", "").Replace("origins07server", "").Replace("origins07", "").Replace("origins", "").Replace(":", "").Replace("/", "").Replace("?", "");
            //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog2.txt", ExtractedArg);
            string ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);

            string[] SplitArg = ConvertedArg.Split('|');
            bool     upnp     = Convert.ToBoolean(SecurityFuncs.Base64Decode(SplitArg[3]));

            if (upnp == true)
            {
                StopUPNP();
            }
        }
Exemplo n.º 6
0
        void MainFormLoad(object sender, EventArgs e)
        {
            string EXEName = System.AppDomain.CurrentDomain.FriendlyName;

            if (EXEName.Equals("Origins07_Installer.exe"))
            {
                try
                {
                    label1.Text = "Installing...";
                    string loadstring  = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Origins07_Launcher.exe";
                    string loadstring2 = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Origins07_DedicatedServer.exe";
                    RegisterURLProtocol("origins07", loadstring, "Origins07 Client");
                    RegisterURLProtocol("origins07local", loadstring, "Origins07 Play Solo Mode");
                    RegisterURLProtocol("origins07server", loadstring2, "Origins07 Dedicated Server");
                    progressBar1.Style = ProgressBarStyle.Blocks;
                    for (int i = 0; i < 100; i += 10)
                    {
                        progressBar1.Value += 10;
                    }
                    label1.Text = "Installation Complete!";
                    label2.Text = "Congratulations, you can now play games!";
                }
                catch (Exception)
                {
                    label1.Text = "Installation Failed.";
                    label2.Text = "Did you launch the launcher as an administrator?";
                }
            }
            else
            {
                if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + GlobalVars.Config))
                {
                    NameForm name = new NameForm();
                    name.ShowDialog();
                    System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0);
                }
                else
                {
                    SecurityFuncs.ReadConfigValues();
                    GlobalVars.ReadyToLaunch = true;
                    System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0);
                }
            }
        }
        void Button1Click(object sender, EventArgs e)
        {
            SecurityFuncs.WriteConfigValues();
            ScriptType type = ScriptType.Solo;

            ScriptGenerator.GenerateScriptForClient(type);
            bool IsValid = SecurityFuncs.checkClientMD5();

            if (IsValid == true)
            {
                //temp domain
                string exefile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Origins07_Client.exe";
                string quote   = "\"";
                string args    = "-script " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + ScriptGenerator.GetScriptNameForType(type) + quote + " " + quote + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\maps\\" + listBox2.SelectedItem.ToString() + quote;
                Process.Start(exefile, args);
                this.Close();
            }
            else
            {
                MessageBox.Show("The client has been detected as modified.", "Cannot Launch Game.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 8
0
        public async void StartUPNP()
        {
            try
            {
                string ExtractedArg = "";
                //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog.txt", GlobalVars.SharedArgs);
                ExtractedArg = GlobalVars.SharedArgs.Replace("origins07server://", "").Replace("origins07server", "").Replace("origins07", "").Replace("origins", "").Replace(":", "").Replace("/", "").Replace("?", "");
                //File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\arglog2.txt", ExtractedArg);
                string   ConvertedArg = SecurityFuncs.Base64Decode(ExtractedArg);
                string[] SplitArg     = ConvertedArg.Split('|');
                string   port         = SecurityFuncs.Base64Decode(SplitArg[0]);

                var nat    = new NatDiscoverer();
                var cts    = new CancellationTokenSource(5000);
                var device = await nat.DiscoverDeviceAsync(PortMapper.Upnp, cts);

                await device.CreatePortMapAsync(new Mapping(Protocol.Udp, Convert.ToInt32(port), Convert.ToInt32(port), "Origins07"));
            }
            catch (Exception)
            {
            }
        }
        public static void GenerateScriptForClient(ScriptType type, string IPSite = "", string Port = "", string PlayerLimit = "", string ServerID = "")
        {
            //next, generate the header functions.

            string header = MultiLine(
                "function newWaitForChild(newParent,name)",
                "local returnable = nil",
                "if newParent:FindFirstChild(name) then",
                "returnable = newParent:FindFirstChild(name)",
                "else",
                "repeat wait() returnable = newParent:FindFirstChild(name)  until returnable ~= nil",
                "end",
                "return returnable",
                "end"
                );

            //next, associate the settings

            string settings = MultiLine(
                "settings().Network.maxDataModelSendBuffer = 1000000",
                "settings().Network.sendRate = 1000000"
                );

            string playersettings = "";

            if (type == ScriptType.Join || type == ScriptType.Solo)
            {
                SecurityFuncs.ReadConfigValues();

                playersettings = MultiLine(
                    "UserID = " + GlobalVars.UserID,
                    "PlayerName = '" + GlobalVars.Name + "'",
                    "Hat1ID = '" + GlobalVars.HatName + "'",
                    "HeadColorID = " + GlobalVars.HeadColor,
                    "TorsoColorID = " + GlobalVars.TorsoColor,
                    "LeftArmColorID = " + GlobalVars.LeftArmColor,
                    "RightArmColorID = " + GlobalVars.RightArmColor,
                    "LeftLegColorID = " + GlobalVars.LeftLegColor,
                    "RightLegColorID = " + GlobalVars.RightLegColor
                    );
            }

            string scriptsettings = "";

            if (type == ScriptType.Join)
            {
                scriptsettings = MultiLine(
                    "ServerIP = '" + IPSite + "'",
                    "ServerPort = " + Port
                    );
            }
            else if (type == ScriptType.Server)
            {
                scriptsettings = MultiLine(
                    "Port = " + Port,
                    "PlayerLimit = " + PlayerLimit,
                    "Ping = '" + IPSite + "'",
                    "ServerID = '" + ServerID + "'"
                    );
            }

            //add customization funcs

            string clientside = MultiLine(
                "function InitalizeClientAppearance(Player,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,HatID)",
                "local newCharApp = Instance.new('IntValue',Player)",
                "newCharApp.Name = 'Appearance'",
                "for i=1,6,1 do",
                "local BodyColor = Instance.new('BrickColorValue',newCharApp)",
                "if (i == 1) then",
                "if (HeadColorID ~= nil) then",
                "BodyColor.Value = BrickColor.new(HeadColorID)",
                "BodyColor.Name = 'HeadColor (ID: '..HeadColorID..')'",
                "else",
                "BodyColor.Value = BrickColor.new(1)",
                "BodyColor.Name = 'HeadColor (ID: 1)'",
                "end",
                "elseif (i == 2) then",
                "if (TorsoColorID ~= nil) then",
                "BodyColor.Value = BrickColor.new(TorsoColorID)",
                "BodyColor.Name = 'TorsoColor (ID: '..TorsoColorID..')'",
                "else",
                "BodyColor.Value = BrickColor.new(1)",
                "BodyColor.Name = 'TorsoColor (ID: 1)'",
                "end",
                "elseif (i == 3) then",
                "if (LeftArmColorID ~= nil) then",
                "BodyColor.Value = BrickColor.new(LeftArmColorID)",
                "BodyColor.Name = 'LeftArmColor (ID: '..LeftArmColorID..')'",
                "else",
                "BodyColor.Value = BrickColor.new(1)",
                "BodyColor.Name = 'LeftArmColor (ID: 1)'",
                "end",
                "elseif (i == 4) then",
                "if (RightArmColorID ~= nil) then",
                "BodyColor.Value = BrickColor.new(RightArmColorID)",
                "BodyColor.Name = 'RightArmColor (ID: '..RightArmColorID..')'",
                "else",
                "BodyColor.Value = BrickColor.new(1)",
                "BodyColor.Name = 'RightArmColor (ID: 1)'",
                "end",
                "elseif (i == 5) then",
                "if (LeftLegColorID ~= nil) then",
                "BodyColor.Value = BrickColor.new(LeftLegColorID)",
                "BodyColor.Name = 'LeftLegColor (ID: '..LeftLegColorID..')'",
                "else",
                "BodyColor.Value = BrickColor.new(1)",
                "BodyColor.Name = 'LeftLegColor (ID: 1)'",
                "end",
                "elseif (i == 6) then",
                "if (RightLegColorID ~= nil) then",
                "BodyColor.Value = BrickColor.new(RightLegColorID)",
                "BodyColor.Name = 'RightLegColor (ID: '..RightLegColorID..')'",
                "else",
                "BodyColor.Value = BrickColor.new(1)",
                "BodyColor.Name = 'RightLegColor (ID: 1)'",
                "end",
                "end",
                "local typeValue = Instance.new('NumberValue')",
                "typeValue.Name = 'CustomizationType'",
                "typeValue.Parent = BodyColor",
                "typeValue.Value = 1",
                "local indexValue = Instance.new('NumberValue')",
                "indexValue.Name = 'ColorIndex'",
                "indexValue.Parent = BodyColor",
                "indexValue.Value = i",
                "end",
                "local newHat = Instance.new('StringValue',newCharApp)",
                "if (HatID ~= nil) then",
                "newHat.Value = HatID",
                "newHat.Name = HatID",
                "else",
                "newHat.Value = 'NoHat.rbxm'",
                "newHat.Name = 'NoHat.rbxm'",
                "end",
                "local typeValue = Instance.new('NumberValue')",
                "typeValue.Name = 'CustomizationType'",
                "typeValue.Parent = newHat",
                "typeValue.Value = 2",
                "end"
                );

            string serverside = MultiLine(
                "function LoadCharacterNew(playerApp,newChar)",
                "local charparts = {[1] = newWaitForChild(newChar,'Head'),[2] = newWaitForChild(newChar,'Torso'),[3] = newWaitForChild(newChar,'Left Arm'),[4] = newWaitForChild(newChar,'Right Arm'),[5] = newWaitForChild(newChar,'Left Leg'),[6] = newWaitForChild(newChar,'Right Leg')}",
                "for _,newVal in pairs(playerApp:GetChildren()) do",
                "newWaitForChild(newVal,'CustomizationType')",
                "local customtype = newVal:FindFirstChild('CustomizationType')",
                "if (customtype.Value == 1) then ",
                "pcall(function()",
                "newWaitForChild(newVal,'ColorIndex')",
                "local colorindex = newVal:FindFirstChild('ColorIndex')",
                "charparts[colorindex.Value].BrickColor = newVal.Value ",
                "end)",
                "elseif (customtype.Value == 2)  then",
                "pcall(function()",
                "local newHat = game.Workspace:InsertContent('rbxasset://hats/'..newVal.Value)",
                "if newHat[1] then ",
                "if newHat[1].className == 'Hat' then",
                "newHat[1].Parent = newChar",
                "else",
                "newHat[1]:remove()",
                "end",
                "end",
                "end)",
                "end",
                "end",
                "end"
                );

            string customizationgen = "";

            if (type == ScriptType.Join)
            {
                customizationgen = clientside;
            }
            else if (type == ScriptType.Server)
            {
                customizationgen = serverside;
            }
            else if (type == ScriptType.Solo)
            {
                customizationgen = MultiLine(
                    serverside,
                    clientside
                    );
            }

            //finally, we generate the actual script code.

            string code = "";

            if (type == ScriptType.Join)
            {
                code = MultiLine(
                    "pcall(function() game:SetPlaceID(-1, false) end)",
                    "local suc, err = pcall(function()",
                    "client = game:GetService('NetworkClient')",
                    "player = game:GetService('Players'):CreateLocalPlayer(UserID) ",
                    "player:SetSuperSafeChat(false)",
                    "pcall(function() player:SetUnder13(false) end)",
                    "pcall(function() player:SetAccountAge(365) end)",
                    "pcall(function() player.Name=PlayerName or '' end)",
                    "game:GetService('Visit')",
                    "InitalizeClientAppearance(player,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,Hat1ID)",
                    "end)",
                    "local function dieerror(errmsg)",
                    "game:SetMessage(errmsg)",
                    "wait(math.huge)",
                    "end",
                    "if not suc then",
                    "dieerror(err)",
                    "end",
                    "local function disconnect(peer,lostconnection)",
                    "game:SetMessage('You have lost connection to the game')",
                    "end",
                    "local function connected(url, replicator)",
                    "replicator.Disconnection:connect(disconnect)",
                    "local marker = nil",
                    "local suc, err = pcall(function()",
                    "game:SetMessageBrickCount()",
                    "marker = replicator:SendMarker()",
                    "end)",
                    "if not suc then",
                    "dieerror(err)",
                    "end",
                    "marker.Received:connect(function()",
                    "local suc, err = pcall(function()",
                    "game:ClearMessage()",
                    "end)",
                    "if not suc then",
                    "dieerror(err)",
                    "end",
                    "end)",
                    "end",
                    "local function rejected()",
                    "dieerror('Failed to connect to the Game. (Connection rejected)')",
                    "end",
                    "local function failed(peer, errcode, why)",
                    "dieerror('Failed to connect to the Game. (ID='..errcode..' ['..why..'])')",
                    "end",
                    "local suc, err = pcall(function()",
                    "game:SetMessage('Connecting to server...')",
                    "client.ConnectionAccepted:connect(connected)",
                    "client.ConnectionRejected:connect(rejected)",
                    "client.ConnectionFailed:connect(failed)",
                    "client:Connect(ServerIP,ServerPort, 0, 20)",
                    "end)",
                    "if not suc then",
                    "local x = Instance.new('Message')",
                    "x.Text = err",
                    "x.Parent = workspace",
                    "wait(math.huge)",
                    "end"
                    );
            }
            else if (type == ScriptType.Server)
            {
                code = MultiLine(
                    "game:HttpGet(Ping..'?update='..ServerID..'&players=0')",
                    "Server = game:GetService('NetworkServer')",
                    "RunService = game:GetService('RunService')",
                    "Server:start(Port, 20)",
                    "RunService:run()",
                    "game:GetService('Players').MaxPlayers = PlayerLimit",
                    "game:GetService('Players').PlayerAdded:connect(function(Player)",
                    "if (game:GetService('Players').NumPlayers > game:GetService('Players').MaxPlayers) then",
                    "local message = Instance.new('Message')",
                    "message.Text = 'You were kicked. Reason: Too many players on server.'",
                    "message.Parent = Player",
                    "wait(2)",
                    "Player:remove()",
                    "print('Player ' .. Player.Name .. ' with ID ' .. Player.userId .. ' kicked. Reason: Too many players on server.')",
                    "else",
                    "print('Player ' .. Player.Name .. ' with ID ' .. Player.userId .. ' added')",
                    "Player:LoadCharacter()",
                    "LoadCharacterNew(newWaitForChild(Player,'Appearance'),Player.Character)",
                    "wait(.2)",
                    "game:HttpGet(Ping..'?update='..ServerID..'&players='..#game.Players:GetChildren())",
                    "end",
                    "coroutine.resume(coroutine.create(function()",
                    "while Player ~= nil do",
                    "wait(0.1)",
                    "if (Player.Character ~= nil) then",
                    "if (Player.Character.Humanoid.Health == 0) then",
                    "wait(5)",
                    "Player:LoadCharacter()",
                    "LoadCharacterNew(newWaitForChild(Player,'Appearance'),Player.Character)",
                    "elseif (Player.Character.Parent == nil) then ",
                    "wait(5)",
                    "Player:LoadCharacter()",
                    "LoadCharacterNew(newWaitForChild(Player,'Appearance'),Player.Character)",
                    "end end end end)) end)",
                    "game:GetService('Players').PlayerRemoving:connect(function(Player)",
                    "print('Player ' .. Player.Name .. ' with ID ' .. Player.userId .. ' leaving')",
                    "wait(.2)",
                    "game:HttpGet(Ping..'?update='..ServerID..'&players='..#game.Players:GetChildren())",
                    "end)",
                    "pcall(function() game.Close:connect(function() ",
                    "game:HttpGet(Ping..'?update='..ServerID..'&players=-1')",
                    "Server:Stop() end) end)",
                    "coroutine.resume(coroutine.create(function()",
                    "while wait(60) do",
                    "game:HttpGet(Ping..'?update='..ServerID..'&players='..#game.Players:GetChildren())",
                    "end end))"
                    );
            }
            else if (type == ScriptType.Solo)
            {
                code = MultiLine(
                    "game:GetService('RunService'):run()",
                    "local plr = game.Players:CreateLocalPlayer(UserID)",
                    "plr.Name = PlayerName",
                    "plr:LoadCharacter()",
                    "pcall(function() plr:SetUnder13(false) end)",
                    "pcall(function() plr:SetAccountAge(365) end)",
                    "InitalizeClientAppearance(plr,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,Hat1ID)",
                    "LoadCharacterNew(newWaitForChild(plr,'Appearance'),plr.Character)",
                    "game:GetService('Visit')",
                    "while true do",
                    "wait(0.001)",
                    "if (plr.Character ~= nil) then",
                    "if (plr.Character.Humanoid.Health == 0) then",
                    "wait(5)",
                    "plr:LoadCharacter()",
                    "LoadCharacterNew(newWaitForChild(plr,'Appearance'),plr.Character,plr.Backpack)",
                    "elseif (plr.Character.Parent == nil) then ",
                    "wait(5)",
                    "plr:LoadCharacter()",
                    "LoadCharacterNew(newWaitForChild(plr,'Appearance'),plr.Character,plr.Backpack)",
                    "end",
                    "end",
                    "end"
                    );
            }

            string scriptfile = MultiLine(
                header,
                settings,
                playersettings,
                scriptsettings,
                customizationgen,
                code
                );

            string filename = "";

            if (type == ScriptType.Join)
            {
                filename = GlobalVars.JoinServerLuaFile;
            }
            else if (type == ScriptType.Server)
            {
                filename = GlobalVars.StartServerLuaFile;
            }
            else if (type == ScriptType.Solo)
            {
                filename = GlobalVars.PlaySoloLuaFile;
            }

            List <string> list = new List <string>(Regex.Split(scriptfile, Environment.NewLine));

            string[] convertedList = list.ToArray();
            File.WriteAllLines(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + filename, convertedList);
        }
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     base.OnFormClosing(e);
     SecurityFuncs.WriteConfigValues();
 }
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     base.OnFormClosing(e);
     SecurityFuncs.WriteConfigValues();
     GlobalVars.ReadyToLaunch = true;
 }