PostMap Checker

Posts 1–3 of 3 · Page 1 of 1
Map Checker
So yea, im releasing my C# Map Checker i guess Was thinking of releasing some source, not released before, and helpfull.
I guess it might be usefull for SOME people, in this case, we'r using it to print a text giving you the current map in textBox22
Code:
private void timer1_Tick(object sender, EventArgs e)
        {
            if (ReadString(0xADAAF3, 7) == "seatown")
            {
                textBox22.Text = "Current Map : Seatown.";
                textBox22.BackColor = Color.Lime;
            }
            else
                if (ReadString(0xADAAF3, 4) == "dome")
                {
                    textBox22.Text = "Current Map : Dome.";
                    textBox22.BackColor = Color.Lime;
                }
                else
                    if (ReadString(0xADAAF3, 6) == "plaza2")
                    {
                        textBox22.Text = "Current Map : Arkaden.";
                        textBox22.BackColor = Color.Lime;
                    }
                    else
                        if (ReadString(0xADAAF3, 9) == "mogadishu")
                        {
                            textBox22.Text = "Current Map : Bakaara.";
                            textBox22.BackColor = Color.Lime;
                        }
                        else
                            if (ReadString(0xADAAF3, 5) == "paris")
                            {
                                textBox22.Text = "Current Map : Resistance.";
                                textBox22.BackColor = Color.Lime;
                            }
                            else
                                if (ReadString(0xADAAF3, 8) == "exchange")
                                {
                                    textBox22.Text = "Current Map : Downturn.";
                                    textBox22.BackColor = Color.Lime;
                                }
                                else
                                    if (ReadString(0xADAAF3, 7) == "bootleg")
                                    {
                                        textBox22.Text = "Current Map : Bootleg.";
                                        textBox22.BackColor = Color.Lime;
                                    }
                                    else
                                        if (ReadString(0xADAAF3, 6) == "carbon")
                                        {
                                            textBox22.Text = "Current Map : Carbon.";
                                            textBox22.BackColor = Color.Lime;
                                        }
                                        else
                                            if (ReadString(0xADAAF3, 7) == "hardhat")
                                            {
                                                textBox22.Text = "Current Map : Hardhat.";
                                                textBox22.BackColor = Color.Lime;
                                            }
                                            else
                                                if (ReadString(0xADAAF3, 5) == "alpha")
                                                {
                                                    textBox22.Text = "Current Map : Lockdown.";
                                                    textBox22.BackColor = Color.Lime;
                                                }
                                                else
                                                    if (ReadString(0xADAAF3, 7) == "village")
                                                    {
                                                        textBox22.Text = "Current Map : Village.";
                                                        textBox22.BackColor = Color.Lime;
                                                    }
                                                    else
                                                        if (ReadString(0xADAAF3, 7) == "lambeth")
                                                        {
                                                            textBox22.Text = "Current Map : Fallen.";
                                                            textBox22.BackColor = Color.Lime;
                                                        }
                                                        else
                                                            if (ReadString(0xADAAF3, 5) == "radar")
                                                            {
                                                                textBox22.Text = "Current Map : Outpost.";
                                                                textBox22.BackColor = Color.Lime;
                                                            }
                                                            else
                                                                if (ReadString(0xADAAF3, 11) == "interchange")
                                                                {
                                                                    textBox22.Text = "Current Map : Interchange.";
                                                                    textBox22.BackColor = Color.Lime;
                                                                }
                                                                else
                                                                    if (ReadString(0xADAAF3, 11) == "underground")
                                                                    {
                                                                        textBox22.Text = "Current Map : Underground.";
                                                                        textBox22.BackColor = Color.Lime;
                                                                    }
                                                                    else
                                                                        if (ReadString(0xADAAF3, 11) == "bravo")
                                                                        {
                                                                            textBox22.Text = "Current Map : Mission.";
                                                                            textBox22.BackColor = Color.Lime;
                                                                        }
                                                                        else
                                                                            if (ReadString(0xADAAF3, 12) == "terminal_cls")
                                                                            {
                                                                                textBox22.Text = "Current Map : Terminal.";
                                                                                textBox22.BackColor = Color.Lime;
                                                                            }
                                                                                else
                                                                                {
                                                                                    textBox22.Text = "Map not supported / Not ingame.";
                                                                                    textBox22.BackColor = Color.Red;
                                                                                }
        }
Maps included : vanilla ones + Terminal. No DLC's, but they shouldnt be hard to add (i just dont have em)
If your not a coder, dont ask how to use this . There are plenty of tuts out here to get you started in coding.
Anyways, good luck Hope this helped some of you
LOL your "else if" indentation is weird :S

Nice job anyways
What @MarkHC said, why are you indenting the else-if statements. They should be at the same level as the first one.

Code:
if(ReadString(0xADAAF3, 7) == "seatown")
{
    // blah.
}
else if(ReadString(0xADAAF3, 4) == "dome")
{
   // blah.
}
Also, a better way could be to store the map names in a dictionary and only read the length for the longest map name. It's shorter and saves time.

Code:
string mapName = ReadString(0xADAAF3, 12); // Longest map name is 12 characters.
var mapDict = new Dictionary<string, string>();
mapDict.Add("seatown", "Seatown");
mapDict.Add("plaza2", "Plaza");
// ... etc
foreach(var kvp in mapDict)
{
    // Only take the same amount of characters as the current map.
    if(mapName.Substring(0, kvp.Key.Length) == kvp.Key)
    {
        textBox22.Text = kvp.Value;
        textBox22.BackColor = Color.Lime;
        break;
    }
}
// Blah blah, not supported/in-game.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us