Move get player util to shared
This commit is contained in:
@@ -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) {
|
function getFirstEmptyEffectSlot(isServer = false) {
|
||||||
if(isServer) {
|
if(isServer) {
|
||||||
for(let i in effects) {
|
for(let i in effects) {
|
||||||
@@ -1982,4 +1957,8 @@ function showConnectCameraToPlayer(client) {
|
|||||||
setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt);
|
setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function doesGameHaveSnow(gameId) {
|
||||||
|
return (getServerGame() != GAME_GTA_IV);
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user