From 7475c9d7ee0c1cdd0494099ae85396710700bb92 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sat, 20 Feb 2021 20:09:24 -0600 Subject: [PATCH] Move get player util to shared --- scripts/server/utilities.js | 31 +++++-------------------------- scripts/shared/native.js | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/scripts/server/utilities.js b/scripts/server/utilities.js index fb215690..f1f00e05 100644 --- a/scripts/server/utilities.js +++ b/scripts/server/utilities.js @@ -759,31 +759,6 @@ function getClientFromPlayer(player) { // --------------------------------------------------------------------------- -function getPlayerFromParams(params) { - let clients = getClients(); - if(isNaN(params)) { - for(let i in clients) { - if(!clients[i].console) { - if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) { - return clients[i]; - } - - if(toLowerCase(getCharacterFullName(clients[i])).indexOf(toLowerCase(params)) != -1) { - return clients[i]; - } - } - } - } else { - if(typeof clients[toInteger(params)] != "undefined") { - return clients[toInteger(params)]; - } - } - - return false; -} - -// --------------------------------------------------------------------------- - function getFirstEmptyEffectSlot(isServer = false) { if(isServer) { for(let i in effects) { @@ -1982,4 +1957,8 @@ function showConnectCameraToPlayer(client) { setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt); } -// --------------------------------------------------------------------------- \ No newline at end of file +// --------------------------------------------------------------------------- + +function doesGameHaveSnow(gameId) { + return (getServerGame() != GAME_GTA_IV); +} \ No newline at end of file diff --git a/scripts/shared/native.js b/scripts/shared/native.js index ab593dd8..6d3c61a1 100644 --- a/scripts/shared/native.js +++ b/scripts/shared/native.js @@ -301,4 +301,29 @@ function getConsoleClient() { } } +// --------------------------------------------------------------------------- + +function getPlayerFromParams(params) { + let clients = getClients(); + if(isNaN(params)) { + for(let i in clients) { + if(!clients[i].console) { + if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) { + return clients[i]; + } + + if(toLowerCase(getCharacterFullName(clients[i])).indexOf(toLowerCase(params)) != -1) { + return clients[i]; + } + } + } + } else { + if(typeof clients[toInteger(params)] != "undefined") { + return clients[toInteger(params)]; + } + } + + return false; +} + // --------------------------------------------------------------------------- \ No newline at end of file