Getting Started with Development: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
Line 24: Line 24:


Currently you'll find your folders empty, so if you want to load a gamemode, there is a [https://github.com/n-n1ks/rage.mp-freeroam Freeroam] Gamemode available to study/use for your server.
Currently you'll find your folders empty, so if you want to load a gamemode, there is a [https://github.com/n-n1ks/rage.mp-freeroam Freeroam] Gamemode available to study/use for your server.
== Creating your first resource ==
<b>Rage Multiplayer</b> Consists of 2 sides of scripting, '''Client-side''' and '''Server-side''', so as mentioned up '''Client-side''' allows you create and develop UI and show people your creativity, and '''Server-side''' allows you to manage the server itself with its things like managing players, vehicles, and markers etc.
Today we will create our first server-side resource, and will see how it works ingame.
First of all go to <code>packages</code> in your server folder then create <code>index.js</code> file if you don't have one. After that you open the file and do
<syntaxhighlight lang="javascript">
//init Commands file
require('./commands.js')
</syntaxhighlight>
After that save and close. Now create another file called <code>commands.js</code> and open it.
Add those simple commands to your file.
<syntaxhighlight lang="javascript">
mp.events.addCommand('kill', (player) => {
    player.health = 0;
});
mp.events.addCommand('hp', (player) => {
    player.health = 100;
});
mp.events.addCommand('armor', (player) => {
    player.armour = 100;
});
</syntaxhighlight>
if you don't understand those please proceed to [[Getting Started with Commands|Getting started with commands]]. Now we have created a simple source with 3 basic commands. One that gives Health, one that gives armor, and one that kills you.
Now save the file and close it. Have you wondered anything wrong with the code up there? If no let me give you a hint. If you trigger the command kill this means it will kill the player, but will you re-spawn back? I have the solution for you!.

Revision as of 08:33, 4 October 2017

Requirements

Introduction

Today we are going to show you how you can start developing your own server with a simple Tutorial. We will show you how you can create your own resource and run it in your server.

Starting the server

When downloading the Updater and running it, you'll get the server files. The folder name will be called server-files. When you open the folder you'll find this:

  • Client_packages: Is the Client side. (Client-side allows you to draw GUI or do CEF work.
  • Packages: is the Server side. (Server-side allows you to manage the player and create your own world)
  • Maps: Allows your to load maps into your world. Only Json form maps are allowed. (Big JSON Size maps sometimes won't load or takes alot of time to load)
  • Plugins: Allows you to put your own dll plugins.
  • config: Allows you to manage your server. For more information Click Here.

Currently you'll find your folders empty, so if you want to load a gamemode, there is a Freeroam Gamemode available to study/use for your server.

Creating your first resource

Rage Multiplayer Consists of 2 sides of scripting, Client-side and Server-side, so as mentioned up Client-side allows you create and develop UI and show people your creativity, and Server-side allows you to manage the server itself with its things like managing players, vehicles, and markers etc.

Today we will create our first server-side resource, and will see how it works ingame.

First of all go to packages in your server folder then create index.js file if you don't have one. After that you open the file and do

//init Commands file
require('./commands.js')

After that save and close. Now create another file called commands.js and open it.

Add those simple commands to your file.

mp.events.addCommand('kill', (player) => {
    player.health = 0;
});

mp.events.addCommand('hp', (player) => {
    player.health = 100;
});

mp.events.addCommand('armor', (player) => {
    player.armour = 100;
});

if you don't understand those please proceed to Getting started with commands. Now we have created a simple source with 3 basic commands. One that gives Health, one that gives armor, and one that kills you.

Now save the file and close it. Have you wondered anything wrong with the code up there? If no let me give you a hint. If you trigger the command kill this means it will kill the player, but will you re-spawn back? I have the solution for you!.