Shared Function Template: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
== Syntax ==
== Syntax ==


<syntaxhighlight lang="javascript">
<pre>
mp.examples.func(arg1, arg2, arg3);
mp.examples.func(arg1, arg2, arg3);
</syntaxhighlight>
</pre>


=== Parameters ===
=== Parameters ===
Line 21: Line 21:
== Multiple Syntaxes ==
== Multiple Syntaxes ==


{{ClientSide}}
{{ClientsideCode|
<syntaxhighlight lang="javascript">
<pre>
// Syntax I
// Syntax I
mp.examples.func(arg1, arg2, arg3);
mp.examples.func(arg1, arg2, arg3);
</syntaxhighlight>
</pre>
}}


=== Syntax I Parameters ===
=== Syntax I Parameters ===
Line 33: Line 34:
* '''arg3''': Explanation of third example argument, parameter should be in <span style="color: #408DAE"><b>double</b></span> type.
* '''arg3''': Explanation of third example argument, parameter should be in <span style="color: #408DAE"><b>double</b></span> type.


{{ServerSide}}
 
<syntaxhighlight lang="javascript">
{{ServersideCode|
<pre>
// Syntax II
// Syntax II
mp.examples.func(arg1, arg2, arg3, arg4[]);
mp.examples.func(arg1, arg2, arg3, arg4[]);
</syntaxhighlight>
</pre>
}}


=== Syntax II Parameters ===
=== Syntax II Parameters ===
Line 55: Line 58:
This is a basic explanation about what does the example below do.
This is a basic explanation about what does the example below do.


<syntaxhighlight lang="javascript">
<pre>
//Syntax I
//Syntax I
let val = mp.examples.func("Washington", 1, 2.0);
let val = mp.examples.func("Washington", 1, 2.0);
</syntaxhighlight>
</pre>


This is a basic explanation about what does the example below does using 2nd syntax.
This is a basic explanation about what does the example below does using 2nd syntax.


<syntaxhighlight lang="javascript">
<pre>
//Syntax II
//Syntax II
let val = mp.examples.func("Washington", 1, 2.0, ['foo', 'bar']);
let val = mp.examples.func("Washington", 1, 2.0, ['foo', 'bar']);
</syntaxhighlight>
</pre>


== See Also ==
== See Also ==


* [[Example::Stuff|Example Stuff]]
* [[Example::Stuff|Example Stuff]]

Latest revision as of 18:23, 26 October 2018

Shared

This is an example description for a shared function template.

Syntax

mp.examples.func(arg1, arg2, arg3);

Parameters

  • arg1: Explanation of example argument, parameter should be in string type.
  • arg2: Explanation of second example argument, parameter should be in int type.
  • arg3: Explanation of third example argument, parameter should be in double type.

Returned Values

  • true: if the example function has been executed successfully.
  • false: otherwise.

Multiple Syntaxes

Client-Side
// Syntax I
mp.examples.func(arg1, arg2, arg3);

Syntax I Parameters

  • arg1: Explanation of example argument, parameter should be in string type.
  • arg2: Explanation of second example argument, parameter should be in int type.
  • arg3: Explanation of third example argument, parameter should be in double type.


Server-Side
// Syntax II
mp.examples.func(arg1, arg2, arg3, arg4[]);

Syntax II Parameters

  • arg1: Explanation of example argument, parameter should be in string type.
  • arg2: Explanation of second example argument, parameter should be in int type.
  • arg3: Explanation of third example argument, parameter should be in double type.
  • arg4: Explanation of fourth example argument, parameter should be in array type.

Returned Values

  • true: if the example function has been executed successfully.
  • false: otherwise.

Examples

This is a basic explanation about what does the example below do.

//Syntax I
let val = mp.examples.func("Washington", 1, 2.0);

This is a basic explanation about what does the example below does using 2nd syntax.

//Syntax II
let val = mp.examples.func("Washington", 1, 2.0, ['foo', 'bar']);

See Also