Added check for biz int and remove old func
This commit is contained in:
@@ -541,33 +541,13 @@ function deleteBusiness(businessId) {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
|
||||||
function deleteBusiness(businessId) {
|
|
||||||
let tempBusinessData = getServerData().businesses[businessId];
|
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
|
||||||
let dbQuery = null;
|
|
||||||
|
|
||||||
if(dbConnection) {
|
|
||||||
dbQuery = queryDatabase(dbConnection, `UPDATE biz_main SET biz_deleted = 1 AND biz_who_deleted = ${getClientData(client).accountData.databaseId} AND biz_when_deleted = UNIX_TIMESTAMP() WHERE biz_id = ${tempBusinessData.databaseId} LIMIT 1`);
|
|
||||||
if(dbQuery) {
|
|
||||||
freeDatabaseQuery(dbQuery);
|
|
||||||
}
|
|
||||||
disconnectFromDatabase(dbConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
destroyElement(tempBusinessData.pickup);
|
|
||||||
removePlayersFromBusiness(businessId);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function removePlayersFromBusiness(businessId) {
|
function removePlayersFromBusiness(businessId) {
|
||||||
getClients().forEach(function(client) {
|
getClients().forEach(function(client) {
|
||||||
if(doesEntityDataExist(client, "ag.inBusiness")) {
|
if(doesBusinessHaveInterior(businessId)) {
|
||||||
if(getEntityData(client, "ag.inBusiness") == businessId) {
|
if(doesEntityDataExist(client, "ag.inBusiness")) {
|
||||||
exitBusiness(client);
|
if(getEntityData(client, "ag.inBusiness") == businessId) {
|
||||||
|
exitBusiness(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -614,4 +594,27 @@ function getBusinessData(businessId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function doesBusinessHaveInterior(businessId) {
|
||||||
|
if(getBusinessData(businessId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let businessData = getBusinessData(businessId);
|
||||||
|
if(businessData.exitPosition == toVector3(0.0, 0.0, 0.0)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(businessData.exitDimension == businessData.entranceDimension) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(businessData.exitDimension == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user