This isn't allowed right?
#1

Quote:
Originally Posted by Martin Cleveland
Посмотреть сообщение
Introduction
I've been working on my own SA-MP client. I was bored and I was up for a challenge so I thought why not? I have no intention of releasing it anytime soon. The UI (design) is simple, but I've overcome some big challenges and I'm proud of that. Below you'll find a list of some features.

Features:
- Links to the SA-MP website, forums and wiki.
- Ability to save/delete favorites.
- Ability to add/remove usernames.
- Ability to launch samp-server.exe
- Ability to edit server.cfg (config)
- Ability to launch samp_debug.exe
- Client will scan the game directory for any CLEO files.
- Ability to directly connect to a SA-MP server.
- If you click on an IP it will retrieve the server ID, hostname, players and locked status.

Added in V2:
- Ability to launch samp_debug.exe, launch server.cfg and launch the localhost server.
- Ability to save & remove usernames.
- Ability to import & export favorites.
- Ability to save chatlogs.

I'm pretty proud of it because I've learned so much. Some parts were pretty difficult but untill now I've always managed to find a solution or workaround. I'll show some examples below.

Launching GTA
This was one of the first challenges I faced. After some searching I found a video on *******, but I still had to add some things such as password support. In the spoiler you'll find the snippet.
Код:
            Registry.SetValue("HKEY_CURRENT_USER\\Software\\SAMP", "PlayerName", tbPlayername.Text);
            string arguments = tbIP.Text + " " + tbPassword.Text;
            System.Diagnostics.ProcessStartInfo procStartInfo = new    System.Diagnostics.ProcessStartInfo(path + "\\samp.exe", arguments);
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();
As you can see it's pretty tricky. I had to edit a registry value which stores the PlayerName and launch samp.exe with two arguments: IP and password. It took me quite a while to figure out how to run samp.exe with multiple arguments.

Retrieving server information
This was also very tricky. I used the SACNR API to retrieve the server information. I had to sent a request, store the request and cut out the pieces I needed. (such as the hostname) The API is written in JSON I believe, so I either had to find a JSON parser to come up with my own solution. Below you'll find a snippet.
Код:
WebRequest request = WebRequest.Create("http://monitor.sacnr.com/api/?IP=" + IP + "&Port=" + port +"&Action=info");
                WebResponse response = request.GetResponse();
                Stream dataStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);
                string responseFromServer = reader.ReadToEnd();
                reader.Close();
                response.Close();
Storing the IPs, path, serverpath and usernames
I had several options. Store the data in a .db file and use SQLite queries to write and read data or store the data internally. I found a way to store the data in the application so I don't have to rely on any external files. I stored the data in the so called 'properties' which are in a small .xml file. (appdata/local)

Код:
<setting name="Path" serializeAs="String">
                <value>C:\Program Files (x86)\Rockstar Games\GTA San Andreas</value>
            </setting>
            <setting name="Favorites" serializeAs="Xml">
                <value>
                    <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    </ArrayOfString>
                </value>
            </setting>
Custom IP to regular IP
In SA-MP you can have a custom IP such as samp.*servername*.net, but because the API requires a regular IP and port, I had to convert it. I used a built-in function to retrieve the IP. Below you'll find a snippet.
Код:
        private string getIP(string IP)
        {
            IPAddress[] addresslist = Dns.GetHostAddresses(IP);
            foreach (IPAddress i in addresslist)
            {
                IP = i.ToString();
            }
            return IP;
        }
It probably pings the address and retrieves the IP. For those who have some experience in programming, you can see the IPs are stored in an array, however a SA-MP server only has 1 IP so that's why this workaround works.

Formats
This was probably the biggest issue I encountered. You can connect to a SA-MP server by using several formats: IP, IP: port, samp.*servername*.net, samp.*servernet*.net: port. IP and IP: port weren't really a big problem because I could just check if the string contains a ":" and cut out the port. The third format is a bit harder because Dns.GetHostAddress(IP) does not support a port, so I'd have to have to cut out the port, convert the IP and paste the port back.

Chatlogs
I figured it'd be useful if you could save your chatlogs. The way it works right now is that the application copies the chatlog.txt file from the GTA User Files to another folder. Below you'll find a snippet.

Код:
        void gta_Exited(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.Logging == 1)
            {
                string date = DateTime.Now.ToString("dd-MM-yyyy_HH-mm-ss");
                string fileName = "chatlog_" + date + ".txt";
                try
                {
                    if (Directory.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\GTA San Andreas User Files\\SAMP\\chatlogs"))
                    {
                        File.Copy((System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) + "\\GTA San Andreas User Files\\SAMP\\chatlog.txt", System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\GTA San Andreas User Files\\SAMP\\chatlogs\\" + fileName);
                    }
                    else
                    {
                        DirectoryInfo di = Directory.CreateDirectory(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\GTA San Andreas User Files\\SAMP\\chatlogs");
                        File.Copy((System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) + "\\GTA San Andreas User Files\\SAMP\\chatlog.txt", System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\GTA San Andreas User Files\\SAMP\\chatlogs\\" + fileName);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong with saving the chatlogs, please try again.");
                }
            }
        }
Conclusion
I've had a great time developing this application because I've learned many things. I didn't know 75% of the things I've used, but that's what programming is about. You'll always encounter problems and you have to come up with a solution for them. Be creative and don't be afraid to ask for help! (stackoverflow)

Video
[video=*******_share;UkRhUNnt6mA]http://*********/UkRhUNnt6mA[/video]

Screenshots (v2)




- No, I am not the creator. I am just wanting to get someones opinion from here before I have it removed.
Reply
#2

Why shouldn't it be allowed? It only allows you to ( through methods known for years) launch the SA:MP client and scan for CLEO hacks.

If you don't like it, don't use it.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Why shouldn't it be allowed? It only allows you to ( through methods known for years) launch the SA:MP client and scan for CLEO hacks.

If you don't like it, don't use it.
I am just awaiting someone else's response who makes legitimate sense. Abagail, no offense but I don't even know who you are. I'll be awaiting for a Beta's response and after that feel free to close this.
Reply
#4

Quote:
Originally Posted by Akira297
Посмотреть сообщение
I am just awaiting someone else's response who makes legitimate sense. Abagail, no offense but I don't even know who you are. I'll be awaiting for a Beta's response and after that feel free to close this.
If you only wanted beta testers to respond, then you should have contacted them instead...
Reply
#5

Quote:
Originally Posted by Infinity
Посмотреть сообщение
If you only wanted beta testers to respond, then you should have contacted them instead...
Whelp lemme rephrase that then. Potassium, Ray, Cessils, Lord, and those who pop around rarely. Feel free to drop your responses. Anyone else I guess just ignore the thread and continue on your day then.
Reply
#6

A lot of people do things like this, read the samp license, that'll give you your answer.
Reply
#7

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Why shouldn't it be allowed? It only allows you to ( through methods known for years) launch the SA:MP client and scan for CLEO hacks.

If you don't like it, don't use it.
Quote:
Originally Posted by TakeiT
Посмотреть сообщение
A lot of people do things like this, read the samp license, that'll give you your answer.

You got your answers.

If you notify this program is Visual Basic,LangB based.
And why you dig this after all his post was removed
Reply
#8

The users above already gave you the answer, it's allowed.

[HLF]Southclaw has a similar program used to detect installed modifications (Anti Cheat - A requirement to connect to the server).
Reply
#9

This is completely fine! It's all using methods that are available and there is nothing wrong with IT.

http://forum.ls-rp.com/viewtopic.php?f=592&t=400314
Reply
#10

There's nothing wrong with doing this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)