Difference between revisions of "Players::callInDimension"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
(Created page with "{{Incomplete Functions}}")
 
(Insert first informations about this function)
Line 1: Line 1:
 
{{Incomplete Functions}}
 
{{Incomplete Functions}}
 +
This function call added client-side event for any players in a specific dimension.
 +
NB: I just tested in local, without error, but it need to be tested with, at least, two players (in different dimensions).
 +
 +
==Syntax==
 +
<syntaxhighlight lang="javascript">
 +
player.callInDimension(Number dimension, String eventName [, ...args]);
 +
</syntaxhighlight>
 +
===Required Arguments===
 +
*'''dimension:''' The dimension in which the event will be sent.
 +
*'''eventName:''' Event name, what will be called.
 +
*'''args:''' Any arguments, what should be sended to client. Supports entities, strings, numbers and booleans. (Objects and Arrays should be packed to JSON format.)
 +
 +
==Example==
 +
That's example will call event added on client side for player inside the dimension ID 2 and disable regeneration health.
 +
 +
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
 +
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
 +
<syntaxhighlight lang="javascript">
 +
let disableRegeneration = () => {
 +
mp.game.player.setHealthRechargeMultiplier(0); //Disable regeneration
 +
mp.gui.chat.push("Regeneration disabled"); //Output text to default chatbox
 +
};
 +
 +
mp.events.add('disablePlayerRegeneration', disableRegeneration);
 +
</syntaxhighlight>
 +
</div>
 +
 +
 +
<div class="header" style="background-color: #408DAE; color: #FFFFFF; border: 2px solid #408DAE;">
 +
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
 +
<syntaxhighlight lang="javascript" highlight="4">
 +
mp.players.callInDimension(2, "disablePlayerRegeneration");
 +
</syntaxhighlight>
 +
</div>
 +
 +
 +
 +
<b> You cannot pass Vector3 types </b> ''(send them through x,y,z and put them in a Vector3 type variable in the client function)''
 +
 +
==See Also==
 +
{{Player_block}}

Revision as of 13:43, 17 August 2018

Warning.png This page is Incomplete.

This function call added client-side event for any players in a specific dimension. NB: I just tested in local, without error, but it need to be tested with, at least, two players (in different dimensions).

Syntax

player.callInDimension(Number dimension, String eventName [, ...args]);

Required Arguments

  • dimension: The dimension in which the event will be sent.
  • eventName: Event name, what will be called.
  • args: Any arguments, what should be sended to client. Supports entities, strings, numbers and booleans. (Objects and Arrays should be packed to JSON format.)

Example

That's example will call event added on client side for player inside the dimension ID 2 and disable regeneration health.

Client-Side
let disableRegeneration = () => {
	mp.game.player.setHealthRechargeMultiplier(0); //Disable regeneration
	mp.gui.chat.push("Regeneration disabled"); //Output text to default chatbox
};

mp.events.add('disablePlayerRegeneration', disableRegeneration);


Server-Side
mp.players.callInDimension(2, "disablePlayerRegeneration");


You cannot pass Vector3 types (send them through x,y,z and put them in a Vector3 type variable in the client function)

See Also