1 Server Side scripting¶
Contents:
You can Find here Various Types of Functions/Events of Rage Multiplayer API that will let you script in your Great Server. Server side scripting Allows you to create your own Server without Limitation. You are the key for the Limitation. Have Fun in scripting and wish you the best of Luck :D.
The Main Language for scripting in Rage Multiplayer is Node Java script. Node JS is a powerful scripting language which makes a very big affect on Grand Theft Auto V.
If you wish to learn more about Node Javascript, You can press up the link Down:
NodeJS_
Warning
This Page is still Under Construction. You might Find some Missing Details.
Contents:
- 1 Server Side scripting
- 1.1 Server-Side Events
- 1.2 Server-Side Functions
- 1.2.1 Vector 3 Functions
- 1.2.2 Event functions
- 1.2.3 Player functions
- 1.2.3.1 Player.spawn
- 1.2.3.2 Player.outputChatBox
- 1.2.3.3 Player.giveWeapon
- 1.2.3.4 Player.getClothes
- 1.2.3.5 Player.setClothes
- 1.2.3.6 Player.getProp
- 1.2.3.7 Player.setProp
- 1.2.3.8 Player.putIntoVehicle
- 1.2.3.9 Player.removeFromVehicle
- 1.2.3.10 Enumerated Lists
- 1.2.3.11 Definition Lists
- 1.2.3.12 Field Lists
- 1.2.3.13 Option Lists
- 1.2.3.14 Literal Blocks
- 1.2.3.15 Line Blocks
- 1.2.3.16 Block Quotes
- 1.2.3.17 Doctest Blocks
- 1.2.3.18 Tables
- 1.2.3.19 Footnotes
- 1.2.3.20 Citations
- 1.2.3.21 Targets
- 1.2.3.22 Directives
- 1.2.3.23 Substitution Definitions
- 1.2.3.24 Comments
- 1.2.4 Field Lists
- 1.2.5 Error Handling
1.1 Server-Side Events¶
Enjoy Our plethora of events that will benefit you a lot while scripting your server.
List of Server-Side events:
1.1.1 Player Events¶
1.1.1.1 PlayerJoin¶
Description:
- This event is triggered when a player joins the server.
Paramters - player player, which joined to the server.
Example
1 2 3 4 5 | function playerJoinHandler(player) {
console.log(player.name + " join.");
}
mp.events.add("playerJoin", playerJoinHandler);
|
1.1.1.2 PlayerQuit¶
Description
- This event is triggered when a player leaves/disconnects the server.
Paramters:
player: it is the player which left to the server.exitType: Types of Exit:- disconnect
- timeout
- kicked
reason: The reason why the player disconnected/left.
Example:
1 2 3 4 5 6 7 8 9 10 | function playerQuitHandler(player, exitType, reason) {
if (exitType != "kicked") {
var str = player.name + " quit.";
} else {
var str = player.name + " kicked. Reason: " + reason + ".";
}
console.log(str);
}
mp.events.add("playerQuit", playerQuitHandler);
|
1.1.1.3 PlayerChat¶
Description
- This event is triggered when a player is chatting on the server.
Paramters:
player: it is the player which talks in the chattext: the text he typed on the Chat
Example:
1 2 3 4 5 | "playerChat": (player, text) =>
{
text = "<b>" + player.name + "</b> said : " + text;
player.outputChatBox(text)
}
|
1.1.1.4 PlayerDeath¶
Description
- This event is triggered when a player died.
Paramters:
player: it is the player that is dead.reason: the reason why he Died.killer: The player name who killed the victim
Example:
1 2 3 4 5 6 7 | "playerDeath": (player, reason, killer) => {
if(killer)
{
player.outputChatBox("You were killed By:"+ reason + killer.name);
}
player.spawn(new mp.Vector3(-243,6326,33));
}
|
1.2 Server-Side Functions¶
This is the Serverside functions Section that you’ll need to put while scripting Server-side
1.2.1 Vector 3 Functions¶
Funtions:
- Vector3:Vector3
Description:
This Function Creates a Vector Object which has a float values of x, y, and z
Properties:
Vector3:xVector3:yVector3:z
Example:
1 | let vector = new mp.Vector3(Number x, Number y, Number z)
|
1.2.2 Event functions¶
1.2.2.1 events.add¶
Description:
This function registers event handlers. It could handle more than one Server-sided Event.
Syntax:
events.add(associativeArray)
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function onPlayerDeath(player, reason, killer)
{
console.log(player.name + " died.");
}
mp.events.add(
{
"playerJoin" : player =>
{
console.log("New player: " + player.name);
},
"playerQuit" : (player, reason) =>
{
console.log(player.name + " quit");
},
"playerDeath" : onPlayerDeath
});
|
1.2.2.2 events.call¶
Description:
This function calls registered event handlers.
Syntax:
events.call(eventName, optionalArguments);
Example:
1 2 3 4 5 6 7 8 9 | mp.events.add(
{
"anyCallbackName" : anything =>
{
console.log(anything);
}
});
mp.events.call("anyCallbackName", "yea");
|
1.2.3 Player functions¶
- Functions:
1.2.3.1 Player.spawn¶
Description:
This Function spawns the player in a specific Place.
Syntax:
player.spawn(Vector3 position);
Example:
1.2.3.2 Player.outputChatBox¶
Description:
This Function writes in the Chatbox to the player
Syntax:
player.outputChatBox(String message);
Example:
1 2 3 | mp.events.add('playerJoin', player => {
player.outputChatBox('Welcome to the server, ' + player.name + '!');
});
|
1.2.3.3 Player.giveWeapon¶
Description:
This Function gives weapons to the Player.
Syntax:
player.giveWeapon(Number/Array weaponHash, Number ammo);
Example:
1 2 3 4 5 6 | mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'weapon') {
player.giveWeapon(3220176749, 1000); // Assault Rifle
}
});
|
1.2.3.4 Player.getClothes¶
Description:
This Function gives weapons to the Player.
Syntax:
Object player.getClothes(Number componentNumber);
Components:
- 0 ~ Head
- 1 ~ Beard
- 2 ~ Hair
- 3 ~ Torso
- 4 ~ Legs
- 5 ~ Hands
- 6 ~ Foot
- 7 ~ None?
- 8 ~ Accessories like parachute, scuba tank
- 9 ~ Accessories like bags, mask, scuba mask
- 10 ~ Decals and mask
- 11 ~ Auxiliary parts for torso
Object keys: - drawable ~ ID of clothing. - texture ~ ID of texture. - palette ~ ID of palette.
Example:
1 2 3 4 5 6 7 8 9 10 11 | mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'getclothes') {
if (arr.length < 2 || !parseInt(arr[1])) {
return player.outputChatBox('Use syntax: /getclothes [component_id]');
} else {
let clothes = player.getClothes(parseInt(arr[1]));
player.outputChatBox('drawable: ' + clothes.drawable + ' texture: ' + clothes.texture + ' palette: ' + palette.texture);
}
}
});
|
1.2.3.5 Player.setClothes¶
Description:
This Function Sets cloth for the Player
Syntax:
player.setClothes(Number componentNumber, Number drawable, Number texture, Number palette)
Components:
- 0 ~ Head
- 1 ~ Beard
- 2 ~ Hair
- 3 ~ Torso
- 4 ~ Legs
- 5 ~ Hands
- 6 ~ Foot
- 7 ~ None?
- 8 ~ Accessories like parachute, scuba tank
- 9 ~ Accessories like bags, mask, scuba mask
- 10 ~ Decals and mask
- 11 ~ Auxiliary parts for torso
Example:
1 2 3 4 5 6 7 8 9 10 | mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'setclothes') {
if (arr.length < 5 || !parseInt(arr[1]) || !parseInt(arr[2]) || !parseInt(arr[3]) || !parseInt(arr[4])) {
return player.outputChatBox('Use syntax: /setclothes [component_id] [drawable_id] [texture_id] [palette_id]');
} else {
player.setClothes(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[3]), parseInt(arr[4]));
}
}
});
|
1.2.3.6 Player.getProp¶
Description:
getProp:
This Function gives you the prop ID of the Item.
setProp:
This function set prop for a player.
Syntax for getProp:
let prop = player.getProp(Number propID)
Syntax for setProp:
player.setProp(Number propID, Number drawable, Number texture)
Props:
- 1 ~ Helmets, hats, earphones, masks
- 2 ~ Glasses
- 3 ~ Ear accessories
Example for getProp :
1 2 3 4 5 6 7 8 9 10 11 | mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'getprop') {
if (arr.length < 2 || !parseInt(arr[1])) {
return player.outputChatBox('Use syntax: /getprop [prop_id]');
} else {
let prop = player.getProp(parseInt(arr[1]));
player.outputChatBox('drawable: ' + prop.drawable + ' texture: ' + prop.texture);
}
}
});
|
1.2.3.7 Player.setProp¶
Description:
setProp:
This function set prop for a player.
Syntax for setProp:
player.setProp(Number propID, Number drawable, Number texture)
Props:
- 1 ~ Helmets, hats, earphones, masks
- 2 ~ Glasses
- 3 ~ Ear accessories
Example forsetProp:
1 2 3 4 5 6 7 8 9 10 | mp.events.add('playerCommand', (player, command) => {
let arr = command.split(' ');
if (arr[0] == 'setprop') {
if (arr.length < 4 || !parseInt(arr[1]) || !parseInt(arr[2]) || !parseInt(arr[3])) {
return player.outputChatBox('Use syntax: /setprop [prop_id] [drawable_id] [texture_id]');
} else {
player.setProp(parseInt(arr[1]), parseInt(arr[2]), parseInt(arr[3]));
}
}
});
|
1.2.3.8 Player.putIntoVehicle¶
Description:
This Function Puts the player in a certain Vehicle.
Syntax:
player.putIntoVehicle( vehiclename , seat number)
Seat Numbers:
- 0 ~ driver seat
- 1 ~ passenger seat 1
- 2 ~ passenger seat 2
- 3 ~ passenger seat 3
Example:
1 2 3 4 5 6 7 8 9 10 11 12 | "veh": (player, args) => // on command
{
var pos = player.position; //gets the position of the player
if(player.veh)
player.veh.destroy(); // destroys a existing vehicle if the he spawn one from the last time
player.veh = mp.vehicles.new(mp.joaat(args[1]), pos); // defining the player.veh
player.veh.dimension = player.dimension; // defining the dimension of the player
player.putIntoVehicle(player.veh, 0); // puts the player in the Vehicle
},
|
1.2.3.9 Player.removeFromVehicle¶
Description:
This Function Removes the Player from the Vehicle.
Syntax:
player.removeFromVehicle()
A bullet list
- Nested bullet list.
- Nested item 2.
Item 2.
Paragraph 2 of item 2.
- Nested bullet list.
- Nested item 2.
- Third level.
- Item 2.
- Nested item 3.
1.2.3.10 Enumerated Lists¶
Arabic numerals.
- lower alpha)
- (lower roman)
- upper alpha.
- upper roman)
- upper alpha.
- (lower roman)
- lower alpha)
Lists that don’t start at 1:
- Three
- Four
- C
- D
- iii
- iv
List items may also be auto-enumerated.
1.2.3.11 Definition Lists¶
- Term
- Definition
- Term : classifier
Definition paragraph 1.
Definition paragraph 2.
- Term
- Definition
1.2.3.12 Field Lists¶
| what: | Field lists map field names to field bodies, like database records. They are often part of an extension syntax. They are an unambiguous variant of RFC 2822 fields. |
|---|---|
| how arg1 arg2: | The field marker is a colon, the field name, and a colon. The field body may contain one or more body elements, indented relative to the field marker. |
1.2.3.13 Option Lists¶
For listing command-line options:
| -a | command-line option “a” |
| -b file | options can have arguments and long descriptions |
| --long | options can be long also |
| --input=file | long options can also have arguments |
| --very-long-option | |
The description can also start on the next line. The description may contain multiple body elements, regardless of where it starts. | |
| -x, -y, -z | Multiple options are an “option group”. |
| -v, --verbose | Commonly-seen: short & long options. |
| -1 file, --one=file, --two file | |
| Multiple options with arguments. | |
| /V | DOS/VMS-style options too |
There must be at least two spaces between the option and the description.
1.2.3.14 Literal Blocks¶
Literal blocks are indicated with a double-colon (“::”) at the end of
the preceding paragraph (over there -->). They can be indented:
if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
markup_processing = None
Or they can be quoted without indentation:
>> Great idea!
>
> Why didn't I think of that?
1.2.3.15 Line Blocks¶
Take it away, Eric the Orchestra Leader!
A one, two, a one two three fourHalf a bee, philosophically,must, ipso facto, half not be.But half the bee has got to be,vis a vis its entity. D’you see?But can a bee be said to beor not to be an entire bee,when half the bee is not a bee,due to some ancient injury?Singing…
1.2.3.16 Block Quotes¶
Block quotes consist of indented body elements:
My theory by A. Elk. Brackets Miss, brackets. This theory goes as follows and begins now. All brontosauruses are thin at one end, much much thicker in the middle and then thin again at the far end. That is my theory, it is mine, and belongs to me and I own it, and what it is too.
—Anne Elk (Miss)
1.2.3.17 Doctest Blocks¶
>>> print 'Python-specific usage examples; begun with ">>>"'
Python-specific usage examples; begun with ">>>"
>>> print '(cut and pasted from interactive Python sessions)'
(cut and pasted from interactive Python sessions)
1.2.3.18 Tables¶
Here’s a grid table followed by a simple table:
| Header row, column 1 (header rows optional) | Header 2 | Header 3 | Header 4 |
|---|---|---|---|
| body row 1, column 1 | column 2 | column 3 | column 4 |
| body row 2 | Cells may span columns. | ||
| body row 3 | Cells may span rows. |
|
|
| body row 4 | |||
| body row 5 | Cells may also be
empty: --> |
||
| Inputs | Output | |
|---|---|---|
| A | B | A or B |
| False | False | False |
| True | False | True |
| False | True | True |
| True | True | True |
1.2.3.19 Footnotes¶
| [1] | A footnote contains body elements, consistently indented by at least 3 spaces. This is the footnote’s second paragraph. |
| [2] | Footnotes may be numbered, either manually (as in [1]) or automatically using a “#”-prefixed label. This footnote has a label so it can be referred to from multiple places, both as a footnote reference ([2]) and as a hyperlink reference (label). |
| [3] | This footnote is numbered automatically and anonymously using a label of “#” only. |
| [*] | Footnotes may also use symbols, specified with a “*” label. Here’s a reference to the next footnote: [*]. |
| [†] | This footnote shows the next symbol in the sequence. |
| [4] | Here’s an unreferenced footnote, with a reference to a nonexistent footnote: [5]_. |
1.2.3.20 Citations¶
| [CIT2002] | Citations are text-labeled footnotes. They may be rendered separately and differently from footnotes. |
Here’s a reference to the above, [CIT2002], and a [nonexistent] citation.
1.2.3.21 Targets¶
This paragraph is pointed to by the explicit “example” target. A reference can be found under `Inline Markup`_, above. `Inline hyperlink targets`_ are also possible.
Section headers are implicit targets, referred to by name. See Targets, which is a subsection of `Body Elements`_.
Explicit external targets are interpolated into references such as “Python [5]”.
Targets may be indirect and anonymous. Thus this phrase may also refer to the Targets section.
Here’s a `hyperlink reference without a target`_, which generates an error.
1.2.3.21.1 Duplicate Target Names¶
Duplicate names in section headers or other implicit targets will generate “info” (level-1) system messages. Duplicate names in explicit targets will generate “warning” (level-2) system messages.
1.2.3.21.2 Duplicate Target Names¶
Since there are two “Duplicate Target Names” section headers, we cannot uniquely refer to either of them by name. If we try to (like this: `Duplicate Target Names`_), an error is generated.
1.2.3.22 Directives¶
These are just a sample of the many reStructuredText Directives. For others, please see http://docutils.sourceforge.net/docs/ref/rst/directives.html.
1.2.3.22.1 Document Parts¶
An example of the “contents” directive can be seen above this section (a local, untitled table of contents) and at the beginning of the document (a document-wide `table of contents`_).
1.2.3.22.2 Images¶
An image directive (also clickable – a hyperlink reference):
A figure directive:
A figure is an image with a caption and/or a legend:
| re | Revised, revisited, based on ‘re’ module. |
| Structured | Structure-enhanced text, structuredtext. |
| Text | Well it is, isn’t it? |
This paragraph is also part of the legend.
A figure directive with center alignment
1.2.3.22.3 Admonitions¶
Attention
Directives at large.
Caution
Don’t take any wooden nickels.
Danger
Mad scientist at work!
Error
Does not compute.
Hint
It’s bigger than a bread box.
Important
- Wash behind your ears.
- Clean up your room.
- Call your mother.
- Back up your data.
Note
This is a note.
Tip
15% if the service is good.
Warning
Strong prose may provoke extreme mental exertion. Reader discretion is strongly advised.
And, by the way…
You can make up your own admonition too.
1.2.3.22.6 Replacement Text¶
I recommend you try Python, the best language around [5].
1.2.3.22.7 Compound Paragraph¶
This paragraph contains a literal block:
Connecting... OK
Transmitting data... OK
Disconnecting... OK
and thus consists of a simple paragraph, a literal block, and another simple paragraph. Nonetheless it is semantically one paragraph.
This construct is called a compound paragraph and can be produced with the “compound” directive.
1.2.3.23 Substitution Definitions¶
An inline image (
) example:
(Substitution definitions are not visible in the HTML source.)
1.2.4 Field Lists¶
| Field List: | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
|---|
some text
| Field List 2: | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor |
|---|
1.2.5 Error Handling¶
Any errors caught during processing will generate system messages.
|*** Expect 6 errors (including this one). ***|
There should be six messages in the following, auto-generated section, “Docutils System Messages”:
demo.rst from: http://docutils.sourceforge.net/docs/user/rst/demo.txt