[Release] Adding form to load (LOTF)

04/04/2009 02:12 PeTe Ninja#16
xD i had your source rememebr
04/04/2009 09:33 KraHen#17
Quote:
tanels & hadesets
O.O

Same person, yes?
04/10/2009 20:07 Vortex.#18
Btw, Keving could you help me out...

I need to configure the buttons, I haven't done anything like this before to tell you the thruth.

For example, the Restart button I would like to configure it.

The code is.

Code:
    if (str == "/restart")
                {
                    World.SendMsgToAll("Server Restart in 10 seconds!", "SYSTEM", 2011);
                    new Thread(new ThreadStart(
                     delegate()
                     {
                         Console.WriteLine("Server Restarting in 10 seconds!");
                         Thread.Sleep(5000);
                         Console.WriteLine("Server Restarting in 5 seconds!");
                         World.SendMsgToAll("Server Restart in 5 seconds!", "SYSTEM", 2011);
                         Thread.Sleep(5000);
                         General.ServerRestart();
                     }
                  )).Start();
                }




Now how do I configure it to be added to the form.

Here is the code for Form1.cs


Code:
private void button7_Click(object sender, EventArgs e)
        {

        }

Can you please tell me how to add the restart code between here.
04/10/2009 20:30 justprownage#19
Yeah, Keving go help him out.
04/10/2009 20:33 DungMaster#20
Restart code? :

Code:
        private void restartToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process nServ = new Process();
            nServ.StartInfo.FileName = Application.StartupPath + @"\Toxic.exe";
            nServ.Start();
            World.SaveAllChars();
            Environment.Exit(0);
        }
04/10/2009 20:40 CoAttack#21
Quote:
Originally Posted by Vortex. View Post
Btw, Keving could you help me out...

I need to configure the buttons, I haven't done anything like this before to tell you the thruth.

For example, the Restart button I would like to configure it.

The code is.

Code:
    if (str == "/restart")
                {
                    World.SendMsgToAll("Server Restart in 10 seconds!", "SYSTEM", 2011);
                    new Thread(new ThreadStart(
                     delegate()
                     {
                         Console.WriteLine("Server Restarting in 10 seconds!");
                         Thread.Sleep(5000);
                         Console.WriteLine("Server Restarting in 5 seconds!");
                         World.SendMsgToAll("Server Restart in 5 seconds!", "SYSTEM", 2011);
                         Thread.Sleep(5000);
                         General.ServerRestart();
                     }
                  )).Start();
                }




Now how do I configure it to be added to the form.

Here is the code for Form1.cs


Code:
private void button7_Click(object sender, EventArgs e)
        {

        }

Can you please tell me how to add the restart code between here.

just do this... and it should work :D

Code:
private void button7_Click(object sender, EventArgs e)
        {
               General.ServerRestart();
        }
04/10/2009 20:41 justprownage#22
Quote:
Originally Posted by DungMaster View Post
Restart code? :

Code:
        private void restartToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process nServ = new Process();
            nServ.StartInfo.FileName = Application.StartupPath + @"\Toxic.exe";
            nServ.Start();
            World.SaveAllChars();
            Environment.Exit(0);
        }
For me, it's:
Code:
private void button7_Click(object sender, EventArgs e)
{
   General.ServerRestart();
}
#edit
Damn, CoAttack posted 1 minute faster than me.
04/10/2009 20:44 CoAttack#23
Quote:
Originally Posted by justprownage View Post
For me, it's:
Code:
private void button7_Click(object sender, EventArgs e)
{
   General.ServerRestart();
}
#edit
Damn, CoAttack posted 1 minute faster than me.
hahah :D...
04/10/2009 21:54 Vortex.#24
I had done that -.-
anyway, for some reason it said I was missing:

Code:
public static void
so I just made one in General called :

Code:
public static void ServerRestart ();
But I can't seem to get my 'Send Message' to work.

Any help?

First one to reply wins:p
:rolleyes:
04/10/2009 23:23 CoAttack#25
Quote:
Originally Posted by Vortex. View Post
I had done that -.-
anyway, for some reason it said I was missing:

Code:
public static void
so I just made one in General called :

Code:
public static void ServerRestart ();
But I can't seem to get my 'Send Message' to work.

Any help?

First one to reply wins:p
:rolleyes:
as you already have a textbox just make it send the message from text box to the server through World.SendMsgToAll i dont have mine anymore if we go on TV i can do it for you probably
04/11/2009 01:41 justprownage#26
That's easy, just do:
Code:
private void button9_Click(object sender, EventArgs e)
{
  World.SendMsgToAll(textBox.Text, "SYSTEM", 2011);
}
...I win:)
04/11/2009 02:02 CoAttack#27
Quote:
Originally Posted by justprownage View Post
That's easy, just do:
Code:
private void button9_Click(object sender, EventArgs e)
{
  World.SendMsgToAll(textBox.Text, "SYSTEM", 2011);
}
...I win:)
next tell him how to create an account ( hint* doesn't have ini files so not like yours :D )

xD
04/11/2009 02:26 Vortex.#28
No prownage you fail

World.SendMsgToAll(textBox.Text, "SYSTEM", 2011);

I get an error on textBox.

Ook sure tell me how to create an account, the more the merrier
04/11/2009 04:46 justprownage#29
Quote:
Originally Posted by Vortex. View Post
No prownage you fail

World.SendMsgToAll(textBox.Text, "SYSTEM", 2011);

I get an error on textBox.

Ook sure tell me how to create an account, the more the merrier
I dont fail at all, You got the error because your TextBox name isn't the same as mine.

#edit
Btw, to add Account Creation for MySQL you need to add a function for the form to connect to your Database.
04/11/2009 07:19 superplox#30
Quote:
Originally Posted by justprownage View Post
I bet most of you already know how to do this, but this is just for the people that don't know how to make the form open up.

First, open LOTF.

Then right-click on COServerProject in the Solution Explorer.

Click Add > Windows Form...
Then Form1.cs should be in the Solution Explorer.

Now go to View > Toolbox and you can start adding buttons and stuff.

Now to make the form load with the console, you go to General.cs

Above Console.ReadLine(); , add this code:
Code:
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
Note: if you rename Form1.cs to something else, Make Application.Run(new YourFormName());

#Edit
If you get The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
You need to add a reference by right-clicking on COServerProject > Add Reference > System.Core in the .NET tab.


Now the form will load and you make a control panel with the Toolbox provided on the side.

Look at my signature and you'll see how mine looks like. It looks kinda basic, but I'm accustomed to it.
nice guide some 1 will find this usefull bring back loft^^ and ahh btw nice consol :D