Use new const prefix, add biz id from db id util

This commit is contained in:
Vortrex
2021-07-13 00:51:26 -05:00
parent ccf549eb6f
commit 6136c2eb57
2 changed files with 31 additions and 9 deletions

View File

@@ -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;
}
}
}
// ===========================================================================

View File

@@ -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;
}
}
}
// ===========================================================================