From 25e3d25a348e763e04a1008c7d152872beb98dfb Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 21 Jan 2021 04:45:18 -0600 Subject: [PATCH] Fix get client from index util, add get console --- scripts/shared/native.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/shared/native.js b/scripts/shared/native.js index f9204784..8209b520 100644 --- a/scripts/shared/native.js +++ b/scripts/shared/native.js @@ -186,7 +186,23 @@ function isSamePlayer(client1, client2) { // --------------------------------------------------------------------------- function getClientFromIndex(index) { - return getClients().find(c => c.index == index); + let clients = getClients(); + for(let i in clients) { + if(clients[i].index == index) { + return clients[i]; + } + } +} + +// --------------------------------------------------------------------------- + +function getConsoleClient() { + let clients = getClients(); + for(let i in clients) { + if(isConsole(clients[i])) { + return clients[i]; + } + } } // --------------------------------------------------------------------------- \ No newline at end of file