Click here to Skip to main content
14,869,839 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi, can someone fix this errors for me?
Here is code:
namespace Balkan_Elite_Launcher_BETA
{
    public partial class Form1 : Form
    }
        public Form1()
        {
            InitializeComponent();
        }

        private void Start_Click(object sender, EventArgs e)
        {
             private void Form1_Load(object sender, EventArgs e)
        {
        string myRegistryKey = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP").GetValue("gta_sa_exe").ToString();
        myRegistryKey = myRegistryKey.Substring(0, myRegistryKey.LastIndexOf(@"\") + 1);
        label1.Text = myRegistryKey + "samp.exe";
        textBox1.Text = Registry.CurrentUser.OpenSubKey(@"Software\SAMP", true).GetValue("PlayerName").ToString();
        if (!File.Exists(myRegistryKey + "gta_sa.exe"))
        {
            MessageBox.Show("Nije moguce pronaci GTA.exe u GTA folderu!\n" + myRegistryKey + "\nPorvjerite da li ste odabrali pravi folder, ako jeste pokusajte ponovno instalirati GTA SA.", "Greska", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            base.Close();
            Application.Exit();
        }
        else if (!File.Exists(myRegistryKey + "samp.exe"))
        {
            MessageBox.Show("Nije moguce pronaci samp.exe u GTA folderu:\n" + myRegistryKey + "\nPokusajte ponovno instalirati samp ili Balkan Elite Launcher.", "Greska", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            base.Close();
            Application.Exit();
        }
    }
 
    private void Pokreni_Click(object sender, EventArgs e)
    {
        string ServerIP = "188.165.40.163:7777 ";
        string SPHash = "NbGWjfVeFdkDzjCym67lRw=="; //Tu pisete pw za svoj server
        string GTAPath = Registry.CurrentUser.OpenSubKey(@"Software\\SAMP").GetValue("gta_sa_exe").ToString();
        GTAPath = GTAPath.Substring(0, GTAPath.LastIndexOf(@"\") + 1);
        else
        {
            Registry.CurrentUser.OpenSubKey(@"Software\SAMP", true).SetValue("PlayerName", textBox1.Text);
            Process.Start(GTAPath + "samp.exe", ServerIP + SPHash);
        }
    }
        }


If you can tell me what i need to do. Im new in scripting.
Errors:
1: { expected Line: 12
2: Expected class, delegate, enum, interface, or struct Line: 14
3. Expected class, delegate, enum, interface, or struct Line: 19
4. Expected class, delegate, enum, interface, or struct Line: 21
5. Expected class, delegate, enum, interface, or struct Line: 41

What I have tried:

I googled it and it took me an hour but i didnt find it.
Posted
Updated 28-Apr-19 2:36am
v2

Look at your code, and at the error messages.
If you double click on an error message, Visual Studio will take you directly to the line. Look at the message, and it normally tells you fairly clearly what the problem is, or gives you a pretty good clue!
Start with the first:
{ expected Line: 12
Almost certainly that's the middle of these three:
C#
public partial class Form1 : Form
}
    public Form1()
Class definitions need an open curly bracket, not a close curly bracket:
C#
public partial class Form1 : Form
{
    public Form1()
That will probably get rid of some others as well, but just continue doing the same thing.

BTW: It's not "scripting" - it's coding. "Scripting" is another thing altogether.
   
Quote:
Errors:
1: { expected Line: 12

Replace
C#
private void Start_Click(object sender, EventArgs e)
{
     private void Form1_Load(object sender, EventArgs e)
{

with
C#
private void Start_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900