From a098fec2034f6ba7f233b25cba7a833728a44a43 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 15 Feb 2023 03:16:03 -0600 Subject: [PATCH] Add support for sending deleted biz --- scripts/client/business.js | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/scripts/client/business.js b/scripts/client/business.js index 70a141b0..4dba7fa7 100644 --- a/scripts/client/business.js +++ b/scripts/client/business.js @@ -35,10 +35,19 @@ function initBusinessScript() { // =========================================================================== -function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) { +function receiveBusinessFromServer(businessId, isDeleted, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) { logToConsole(LOG_DEBUG, `[V.RP.Business] Received business ${businessId} (${name}) from server`); if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) { + if (isDeleted == true) { + if (getGame() == V_GAME_GTA_IV) { + natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId); + } + + getServerData().businesses.splice(businessId, 1); + return false; + } + if (getBusinessData(businessId) != false) { let businessData = getBusinessData(businessId); businessData.name = name; @@ -52,13 +61,15 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel businessData.locked = locked; businessData.entranceFee = entranceFee; - if (hasInterior && !hasItems) { - businessData.labelInfoType = V_PROPLABEL_INFO_ENTER; - } else if (!hasInterior && hasItems) { - businessData.labelInfoType = V_PROPLABEL_INFO_BUY; + if (businessData.buyPrice > 0) { + businessData.labelInfoType = V_PROPLABEL_INFO_BUYBIZ; } else { - if (businessData.buyPrice > 0) { - businessData.labelInfoType = V_PROPLABEL_INFO_BUYBIZ; + if (hasInterior && !hasItems) { + businessData.labelInfoType = V_PROPLABEL_INFO_ENTER; + } else if (!hasInterior && hasItems) { + businessData.labelInfoType = V_PROPLABEL_INFO_BUY; + } else { + businessData.labelInfoType = V_PROPLABEL_INFO_NONE; } } @@ -142,4 +153,10 @@ function setAllBusinessDataIndexes() { } } +// =========================================================================== + +function removeBusinessesFromClient() { + getServerData().businesses.splice(0); +} + // =========================================================================== \ No newline at end of file