25.12.2014, 02:18
(
Last edited by Abagail; 23/08/2015 at 03:31 PM.
Reason: Updated the samp.dll raw injection method
)
Launching the SA-MP client
This is a tutorial dedicating to "remotely" launching the SA:MP client. Basically, this isn't for any dedicated languages but rather a generalization for various languages such as C# and VB; general coding languages.
Launching the game using parameters in samp.exe
Before we go any further, it's important to know that the players name is depedent on whats stored in their registry key. So, it may be a good idea to check if it's set. This is generally done by checking if a value exists / the registry key exists:
HKEY_CURRENT_USER/Software/SAMP - "PlayerName"
The same goes for the gta_sa executable. How-ever, this is stored as gta_sa_exe. Note; that it is not the samp.exe exe that is stored but the gta_sa.exe. You should how-ever be able to replace the end "gta_sa.exe" part with SAMP to get the general path of where a SA:MP installation is.
So samp.exe has some very basic params:
ServerIP:
Port:
AFAIK, the port param is not required. It will default to 7777 although I could be wrong on this. So, for example:
Let's launch our localhost:
samp.exe 127.0.0.1 7777
This will open the SA:MP client, and connect us to 127.0.0.1:7777 as we have given such params. Remember; the player name is dependent on what is in the registry key; so if your making a custom client make sure the player's name is set properly before launching. This is just like launching it from the client; so the same restrictions, etc, will of-course apply.
Update: samp.exe is very smart, and can actually connect to servers using three different formats. The first as shown above is simply IP space Port. The other methods are as follows,
IP:PORT
And then simply just: IP(which ends up defaulting to 7777 - the default port).
Directly injecting samp.dll into gta_sa.exe
There is also another method which I personally haven't tested but it claims to work for people so I will leave it here. Basically you can directly launch gta_sa.exe with some parameters along with injecting the samp.dll library file.
Parameters to use when injecting samp.dll into gta_sa.exe:
Quote:
-c - Normal mode. -d - Launch in debug mode. -n - Name. -h - Host / IP -p - Port to connect on - OPTIONAL -z - The server password - OPTIONAL |
Code:
gta_sa.exe -c -n pizzaboy -h 127.0.0.1 -p 7777
Code:
gta_sa.exe -c -n pizzaboy -h 127.0.0.1 -p 7777 -z applebee
Cheers!