Move get player util to shared

This commit is contained in:
Vortrex
2021-02-20 20:09:24 -06:00
parent d501e00092
commit 7475c9d7ee
2 changed files with 30 additions and 26 deletions

View File

@@ -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;
}
// ---------------------------------------------------------------------------