In order to get started with SampSharp, you'll need to install a few things:
- A SA-MP server
- The SampSharp plugin for the SA-MP server
- Visual Studio and .NET Core
- Add the NuGet Repository to Visual Studio
The SA-MP Server package can be downloaded from the
SA-MP website. Once unzipped, open the
with a text editor.
plugins SampSharpto the file
- Change the
rcon_passwordto a secure long password
- Remove the
As of SampSharp 0.8:
- Add a
coreclrvalue which points to the dotnet runtime path.
- Add a
gamemodevalue which points to your gamemode dll path. (see "Publishing the project")
echo Executing Server Config... lanmode 0 rcon_password mysecurepassword maxplayers 50 port 7777 hostname SA-MP 0.3 Server gamemode0 empty 1 gamemode path/to/your/Gamemode.dll coreclr path/to/downloaded/dotnet-runtime/ announce 0 chatlogging 0 weburl www.sa-mp.com onfoot_rate 40 incar_rate 40 weapon_rate 40 stream_distance 300.0 stream_rate 1000 maxnpc 0 logtimeformat [%H:%M:%S] language English plugins SampSharp
For Windows the value in the server config should look something like:
for the unofficial linux dotnet runtime:
The plugin can be downloaded from the releases page on GitHub. Copy the contents of the folder in the ZIP file to your SA-MP server directory.
Visual Studio and .NET Core
Download and install Visual Studio from the Visual Studio website. The Community Edition can be downloaded for free. During the setup process make sure to mark the ".NET Core cross-platform development" workload for installation.
SampSharp hosts it own NuGet package repository which contains the framework and various other SampSharp related packages. In order to uses these packages, you have to add the repository to your package manager.
- In Visual Studio's toolbar click on
Tools > Options...
- In the left menu, select
NuGet Package Manager > Package Sources
- Click on the big +(plus) icon in the upper right corner of the window.
- In the Name field type
- In the Source field type
- Click on OK.