Skip to content

Commit

Permalink
Add installation instructions and first example for a first resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Micky5991 committed Nov 27, 2018
1 parent 0d76f9f commit b5beba0
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 28 deletions.
18 changes: 9 additions & 9 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"toc.yml",
"*.md"
"*.md",
"api/**.yml",
"api/index.md",
"documentation/toc.yml",
"documentation/**.md"
]
}
],
Expand Down Expand Up @@ -53,8 +51,10 @@
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
"api/**.yml",
"api/index.md",
"documentation/toc.yml",
"documentation/**.md"
],
"exclude": [
"**/toc.yml",
Expand Down
56 changes: 56 additions & 0 deletions documentation/first-resource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# First resource

Creating your first resource, is very simple.
All you need is a new **.NET Core 2.1 Class library** with a reference to our NuGet package, more information below.

## Step 1 - Install NuGet package

To get started, you need to reference the latest [AlternateLife.RageMP.Net NuGet package](https://www.nuget.org/packages/AlternateLife.RageMP.Net).

```text
PM> Install-Package AlternateLife.RageMP.Net
```

## Step 2 - Main class

The server is only able to find your resource, if you create a **single** class that implements our interface [IResource](~/api/AlternateLife.RageMP.Net.Scripting.IResource.yml). The class could look like this.

```cs
using System.Threading.Tasks;
using AlternateLife.RageMP.Net.Scripting;

namespace MyFirstResource
{
public class Main : IResource
{
public Main()
{
// Register events here or load everything, that needs to be loaded before the first player connects.
}

public async Task OnStartAsync()
{
// Load everything else like houses, cars or other things.
}

public async Task OnStopAsync()
{
// Save everything before the server will be stopped completely.
}
}
}
```

## Step 3 - Prepare gamemode

To finish your first gamemode, you need to copy your compiled `.dll` files to the server's resource folder. If you want to create a resource from the example above, the folder structure looks like this:

```text
├── ...
├── dotnet/
| ├── resources/
| | └── firstresource/
| | └── MyFirstResource.dll
| └── ..
├── ...
```
File renamed without changes.
49 changes: 49 additions & 0 deletions documentation/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Installation

Before you can start using AlternateLife.RageMP.Net, you need to check following requirements:

## Downloads

- Latest [.NET Core 2.1 SDK](https://www.microsoft.com/net/download/dotnet-core/2.1) *(Last tested: 2.1.6)*
- Latest RAGE Multiplayer serverfiles [(Download Launcher)](https://www.rage.mp)
- *The server files are contained in the RAGE Multiplayer installation.*
- Latest [AlternateLife.RageMP.Net ZIP](https://github.com/AlternateLife/ragemp-dotnet-core/releases/latest)

## Step 1

Uninstall the pre-installed GTA-Network bridge from the default RAGE Multiplayer server installation:

- Delete plugin-file `<server-files>/plugins/bridge.dll`.
- Delete folder `<server-files>/bridge/`.

## Step 2

Extract the AlternateLife.RageMP.Net ZIP file (see [downloads](#downloads)) that contains following folders: `dotnet` and `plugins` and paste it into your root server folder.

The RAGE Multiplayer server folder should look like this now:

```text
├── client_packages/
├── dotnet/
| ├── plugins/
| | └── ...
| ├── resources/
| | └── example/
| ├── runtime/
| | └── ...
| └── NLog.config
├── maps/
├── packages/
├── plugins/
| └── dotnet-wrapper.dll
├── bt.dat
├── conf.json
├── node.dll
└── server.exe
```

*If you want to install your own gamemode, you can delete the `example` folder under `<server-folder>/dotnet/resources`*

## Step 3

Create your first serverside resource by implementing the interface `IResource`.
8 changes: 8 additions & 0 deletions documentation/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- name: Introduction
href: index.md
- name: Getting started
items:
- name: Installation
href: installation.md
- name: First resource
href: first-resource.md
11 changes: 0 additions & 11 deletions getting-started/requirements.md

This file was deleted.

4 changes: 0 additions & 4 deletions getting-started/toc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ This is the documentation for the Alternate-Life RageMP server bridge to add pro

## Starting

As a general starting point look at the [IResource](api/AlternateLife.RageMP.Net.Scripting.IResource.html) and [MP](api/AlternateLife.RageMP.Net.Scripting.MP.html).
As a general starting point look at the [IResource](api/AlternateLife.RageMP.Net.Scripting.IResource.yml) and [MP](api/AlternateLife.RageMP.Net.Scripting.MP.yml).

## [API](api/index.md)
4 changes: 3 additions & 1 deletion pdf/toc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- name: Intro
href: ../index.md
- name: API
href: ../api/toc.yml
href: ../api/toc.yml
- name: Documentation
href: ../documentation/toc.yml
5 changes: 3 additions & 2 deletions toc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- name: Getting started
href: getting-started/
- name: Documentation
href: documentation/
homepage: documentation/index.md
- name: API
href: api/
homepage: api/index.md

0 comments on commit b5beba0

Please sign in to comment.