Fix save sacct query and add auto last char
This commit is contained in:
@@ -81,7 +81,7 @@ function saveSubAccountToDatabase(subAccountData) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
|
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let dbQueryString = `UPDATE sacct_main SET sacct_pos_x=${subAccountData.spawnPosition.x}, sacct_pos_y=${subAccountData.spawnPosition.y}, sacct_pos_z=${subAccountData.spawnPosition.z}, sacct_angle=${subAccountData.spawnHeading}, sacct_skin=${subAccountData.skin}, sacct_cash=${subAccountData.cash}, sacct_job=${subAccountData.job} WHERE sacct_id=${subAccountData.databaseId}`;
|
let dbQueryString = `UPDATE sacct_main SET sacct_pos_x=${subAccountData.spawnPosition.x}, sacct_pos_y=${subAccountData.spawnPosition.y}, sacct_pos_z=${subAccountData.spawnPosition.z}, sacct_angle=${subAccountData.spawnHeading}, sacct_skin=${subAccountData.skin}, sacct_cash=${subAccountData.cash}, sacct_job=${subAccountData.job}, sacct_int=${subAccountData.interior}, sacct_vw=${subAccountData.dimension} WHERE sacct_id=${subAccountData.databaseId}`;
|
||||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||||
//freeDatabaseQuery(dbQuery);
|
//freeDatabaseQuery(dbQuery);
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
@@ -112,9 +112,13 @@ function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, p
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function showCharacterSelectToClient(client) {
|
function showCharacterSelectToClient(client) {
|
||||||
if(doesPlayerHaveAutoSelectLastCharacterEnabled(client) && getClientData().subAccounts.length > 0) {
|
if(doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
||||||
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
if(getClientData().subAccounts != null) {
|
||||||
return false;
|
if(getClientData().subAccounts.length > 0) {
|
||||||
|
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
|
||||||
@@ -225,11 +229,11 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
getClientData(client).currentSubAccount = characterId;
|
getClientData(client).currentSubAccount = characterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientCurrentSubAccount(client).lastLogin = new Date().getTime();
|
|
||||||
|
|
||||||
let tempSubAccount = getClientCurrentSubAccount(client);
|
let tempSubAccount = getClientCurrentSubAccount(client);
|
||||||
spawnPlayer(client, tempSubAccount.spawnPosition, tempSubAccount.spawnHeading, tempSubAccount.skin);
|
spawnPlayer(client, tempSubAccount.spawnPosition, tempSubAccount.spawnHeading, tempSubAccount.skin);
|
||||||
|
|
||||||
|
tempSubAccount.lastLogin = new Date().getTime();
|
||||||
|
|
||||||
messageClientAlert(client, `You are now playing as: [#0099FF]${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white"));
|
messageClientAlert(client, `You are now playing as: [#0099FF]${tempSubAccount.firstName} ${tempSubAccount.lastName}`, getColourByName("white"));
|
||||||
messageClientNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
messageClientNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||||
messageClientNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
messageClientNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||||
@@ -239,6 +243,10 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
setEntityData(client.player, "ag.spawned", true, true);
|
setEntityData(client.player, "ag.spawned", true, true);
|
||||||
//triggerNetworkEvent("ag.restoreCamera", client);
|
//triggerNetworkEvent("ag.restoreCamera", client);
|
||||||
|
setPlayerPosition(client, tempSubAccount.spawnPosition);
|
||||||
|
setPlayerHeading(client, tempSubAccount.spawnHeading);
|
||||||
|
setPlayerInterior(client, tempSubAccount.interior);
|
||||||
|
setPlayerVirtualWorld(client, tempSubAccount.dimension);
|
||||||
}, client.ping+1000);
|
}, client.ping+1000);
|
||||||
}
|
}
|
||||||
addNetworkHandler("ag.selectCharacter", selectCharacter);
|
addNetworkHandler("ag.selectCharacter", selectCharacter);
|
||||||
|
|||||||
Reference in New Issue
Block a user