SA-MP Forums Archive
Detection of SAMP/GTA installation folder [C#] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Detection of SAMP/GTA installation folder [C#] (/showthread.php?tid=630533)



Detection of SAMP/GTA installation folder [C#] - Amit1998 - 15.03.2017

Testing


Re: Detection of SAMP/GTA installation folder [C#] - Typhome - 15.03.2017

You can read this registry key that is created by SA-MP.

Код:
string gamePath = Registry.LocalMachine.OpenSubKey("Software\\SAMP").GetValue("gta_sa_exe").ToString();



Re: Detection of SAMP/GTA installation folder [C#] - Amit1998 - 15.03.2017

Testing


Re: Detection of SAMP/GTA installation folder [C#] - Typhome - 15.03.2017

Код:
System.Diagnostics.Process.Start(installdirectory, "-c -n " + playerinfo[0] + " -h SERVER_IP -p 7777");
Have you read this topic?


Re: Detection of SAMP/GTA installation folder [C#] - Amit1998 - 15.03.2017

Quote:
Originally Posted by Typhome
Посмотреть сообщение
Код:
System.Diagnostics.Process.Start(installdirectory, "-c -n " + playerinfo[0] + " -h SERVER_IP -p 7777");
Have you read this topic?
Yeah, that was my main guideline, yet it failed.


Re: Detection of SAMP/GTA installation folder [C#] - Typhome - 15.03.2017

Quote:
Originally Posted by Amit1998
Посмотреть сообщение
I'm using this, it launches the game, however, it doesnt use the credentials(playerinfo[0] is the username, SERVER_IP is the IP)
It connects me to :7777 with a blank username instead.. And yes, I checked and the variables are legit.
How did you check if variables are correct?
Just to make sure...
Код:
string parameters = "-c -n " + playerinfo[0] + " -h 127.0.0.1 -p 7777";
Console.WriteLine(parameters); or something...



Re: Detection of SAMP/GTA installation folder [C#] - Amit1998 - 15.03.2017

Testing


Re: Detection of SAMP/GTA installation folder [C#] - Typhome - 15.03.2017

Quote:
Originally Posted by Amit1998
Посмотреть сообщение
Printed them. Anywho, I realised that I should inject samp.dll into the gta_sa.exe process.
My knowledge in C# is very slim, and going through online tutorials, I realised it's hard, are you experienced enough to gimme a hand in that too? Please :P
Check this.