Difference between revisions of "Players::callInDimension"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
(Created page with "{{Incomplete Functions}}")
 
m (Replaced HTML with template)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Incomplete Functions}}
+
This function call added client-side event for any players in a specific dimension.
 +
 
 +
==Syntax==
 +
<pre>
 +
player.callInDimension(Number dimension, String eventName [, ...args]);
 +
</pre>
 +
 
 +
===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.
 +
 
 +
{{ClientsideCode|
 +
<pre>
 +
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);
 +
</pre>
 +
}}
 +
 
 +
 
 +
{{ServersideCode|
 +
<pre>
 +
mp.players.callInDimension(2, "disablePlayerRegeneration");
 +
</pre>
 +
}}
 +
 
 +
 
 +
==See Also==
 +
{{Player_block}}

Latest revision as of 12:27, 26 October 2018

This function call added client-side event for any players in a specific dimension.

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");


See Also