More native utils + move startup stuff into startup.js

This commit is contained in:
Vortrex
2022-04-20 06:47:54 -05:00
parent 16537fa332
commit 6999661bba
30 changed files with 369 additions and 201 deletions

View File

@@ -64,7 +64,7 @@ function getGameAreas(gameId) {
function getPlayerData(client) {
if(client != null) {
if(isClientInitialized(client)) {
return getServerData().clients[client.index];
return getServerData().clients[getPlayerId(client)];
}
}
return false;
@@ -178,7 +178,7 @@ function getPlayerDisplayForConsole(client) {
if(isNull(client)) {
return "(Unknown client)";
}
return `${getPlayerName(client)}[${client.index}]`;
return `${getPlayerName(client)}[${getPlayerId(client)}]`;
}
// ===========================================================================
@@ -449,7 +449,7 @@ function clearTemporaryPeds() {
function kickAllClients() {
getClients().forEach((client) => {
client.disconnect();
disconnectPlayer(client);
})
}
@@ -464,7 +464,7 @@ function updateTimeRule() {
// ===========================================================================
function isClientInitialized(client) {
return (typeof getServerData().clients[client.index] != "undefined");
return (typeof getServerData().clients[getPlayerId(client)] != "undefined");
}
// ===========================================================================