Pool::toArray: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "This function converts pool to [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array JavaScript array]. ==Syntax== <syntaxhighlight lang="ja...")
 
(Updated example border)
Line 1: Line 1:
This function converts pool to [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array JavaScript array].
This function converts a pool to a [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array JavaScript array].


==Syntax==
==Syntax==
Line 7: Line 7:


==Example==
==Example==
<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">
<syntaxhighlight lang="javascript">
var suchJavascript = mp.players.toArray();
var suchJavascript = mp.players.toArray();
Line 12: Line 14:
     console.log("everyone are aiming");
     console.log("everyone are aiming");
</syntaxhighlight>
</syntaxhighlight>
</div>

Revision as of 10:02, 20 September 2017

This function converts a pool to a JavaScript array.

Syntax

pool.toArray();

Example

Server-Side
var suchJavascript = mp.players.toArray();
if(suchJavascript.every((player) => { return player.isAiming; } ))
    console.log("everyone are aiming");