From 6136c2eb57a777787aeb11c31ba3f64c066482de Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 13 Jul 2021 00:51:26 -0500 Subject: [PATCH] Use new const prefix, add biz id from db id util --- scripts/server/business.js | 17 ++++++++++++++--- scripts/server/house.js | 23 +++++++++++++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/scripts/server/business.js b/scripts/server/business.js index a9636a03..be7b7bf3 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -1031,7 +1031,7 @@ function createBusinessEntranceBlip(businessId) { getBusinessData(businessId).entranceBlip.onAllDimensions = false; getBusinessData(businessId).entranceBlip.dimension = getBusinessData(businessId).entranceDimension; //getBusinessData(businessId).entranceBlip.interior = getBusinessData(businessId).entranceInterior; - setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.type", AG_BLIP_BUSINESS_ENTRANCE, false); + setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false); setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.id", businessId, false); addToWorld(getBusinessData(businessId).entranceBlip); } @@ -1072,7 +1072,7 @@ function createBusinessExitBlip(businessId) { getBusinessData(businessId).exitBlip.onAllDimensions = false; getBusinessData(businessId).exitBlip.dimension = getBusinessData(businessId).entranceDimension; //getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior; - setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.type", AG_BLIP_BUSINESS_EXIT, false); + setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.type", VRR_BLIP_BUSINESS_EXIT, false); setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.id", businessId, false); addToWorld(getBusinessData(businessId).exitBlip); } @@ -1295,7 +1295,7 @@ function buyFromBusinessCommand(command, params, client) { if(getBusinessData(businessId).hasInterior) { if(!getPlayerBusiness(client)) { if(doesPlayerHaveKeyBindForCommand(client, "enter")) { - messagePlayerTip(client, `You need to enter the business first! Press ${getInlineChatColourByName("lightGrey")}${sdl.getKeyName(getPlayerKeyBindForCommand(client, "enter").key)} ${getInlineChatColourByName("white")}to enter and exit a business`); + messagePlayerTip(client, `You need to enter the business first! Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "enter")).key)} ${getInlineChatColourByName("white")}to enter and exit a business`); } else { messagePlayerNormal(client, `You need to enter the business first! Use /enter to enter and exit a business`); } @@ -1554,4 +1554,15 @@ function updateBusinessPickupLabelData(businessId) { setEntityData(getBusinessData(businessId).exitPickup, "ag.label.type", VRR_LABEL_EXIT, true); } +// =========================================================================== + +function getBusinessIdFromDatabaseId(databaseId) { + let businesses = getServerData().businesses; + for(let i in businesses) { + if(businesses[i].databaseId == databaseId) { + return i; + } + } +} + // =========================================================================== \ No newline at end of file diff --git a/scripts/server/house.js b/scripts/server/house.js index 9b3796da..0f82a8d6 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -509,9 +509,9 @@ function createHouseEntrancePickup(houseId) { getHouseData(houseId).entrancePickup = gta.createPickup(pickupModelId, getHouseData(houseId).entrancePosition); getHouseData(houseId).entrancePickup.onAllDimensions = false; getHouseData(houseId).entrancePickup.dimension = getHouseData(houseId).entranceDimension; - setEntityData(getHouseData(houseId).entrancePickup, "ag.owner.type", AG_PICKUP_HOUSE_ENTRANCE, false); + setEntityData(getHouseData(houseId).entrancePickup, "ag.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false); setEntityData(getHouseData(houseId).entrancePickup, "ag.owner.id", houseId, false); - setEntityData(getHouseData(houseId).entrancePickup, "ag.label.type", AG_LABEL_HOUSE, true); + setEntityData(getHouseData(houseId).entrancePickup, "ag.label.type", VRR_LABEL_HOUSE, true); setEntityData(getHouseData(houseId).entrancePickup, "ag.label.name", getHouseData(houseId).description, true); setEntityData(getHouseData(houseId).entrancePickup, "ag.label.locked", getHouseData(houseId).locked, true); if(getHouseData(houseId).buyPrice > 0) { @@ -534,7 +534,7 @@ function createHouseEntranceBlip(houseId) { getHouseData(houseId).entranceBlip = gta.createBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen")); getHouseData(houseId).entranceBlip.onAllDimensions = false; getHouseData(houseId).entranceBlip.dimension = getHouseData(houseId).entranceDimension; - setEntityData(getHouseData(houseId).entranceBlip, "ag.owner.type", AG_BLIP_HOUSE_ENTRANCE, false); + setEntityData(getHouseData(houseId).entranceBlip, "ag.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false); setEntityData(getHouseData(houseId).entranceBlip, "ag.owner.id", houseId, false); addToWorld(getHouseData(houseId).entranceBlip); } @@ -554,9 +554,9 @@ function createHouseExitPickup(houseId) { getHouseData(houseId).exitPickup = gta.createPickup(pickupModelId, getHouseData(houseId).exitPosition); getHouseData(houseId).exitPickup.onAllDimensions = false; getHouseData(houseId).exitPickup.dimension = getHouseData(houseId).exitDimension; - setEntityData(getHouseData(houseId).exitPickup, "ag.owner.type", AG_PICKUP_HOUSE_EXIT, false); + setEntityData(getHouseData(houseId).exitPickup, "ag.owner.type", VRR_PICKUP_HOUSE_EXIT, false); setEntityData(getHouseData(houseId).exitPickup, "ag.owner.id", houseId, false); - setEntityData(getHouseData(houseId).exitPickup, "ag.label.type", AG_LABEL_EXIT, true); + setEntityData(getHouseData(houseId).exitPickup, "ag.label.type", VRR_LABEL_EXIT, true); addToWorld(getHouseData(houseId).exitPickup); } } @@ -576,7 +576,7 @@ function createHouseExitBlip(houseId) { getHouseData(houseId).exitBlip = gta.createBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen")); getHouseData(houseId).exitBlip.onAllDimensions = false; getHouseData(houseId).exitBlip.dimension = getHouseData(houseId).entranceDimension; - setEntityData(getHouseData(houseId).exitBlip, "ag.owner.type", AG_BLIP_HOUSE_EXIT, false); + setEntityData(getHouseData(houseId).exitBlip, "ag.owner.type", VRR_BLIP_HOUSE_EXIT, false); setEntityData(getHouseData(houseId).exitBlip, "ag.owner.id", houseId, false); addToWorld(getHouseData(houseId).exitBlip); } @@ -773,4 +773,15 @@ function cacheHouseItems(houseId) { } } +// =========================================================================== + +function getHouseIdFromDatabaseId(databaseId) { + let houses = getServerData().houses; + for(let i in houses) { + if(houses[i].databaseId == databaseId) { + return i; + } + } +} + // =========================================================================== \ No newline at end of file