Fix some client business stuff
This commit is contained in:
@@ -40,7 +40,11 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
if(blipModel == -1) {
|
||||
if(businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
businessData.blipId = -1;
|
||||
//businesses.splice(businessData.index, 1);
|
||||
//setAllBusinessDataIndexes();
|
||||
@@ -50,20 +54,18 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
} else {
|
||||
if(businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(businessData.blipId, false);
|
||||
natives.setBlipAsShortRange(tempBusinessData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
|
||||
} else {
|
||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||
if(blipId) {
|
||||
businessData.blipId = blipId;
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(businessData.blipId, false);
|
||||
natives.setBlipMarkerLongDistance(businessData.blipId, false);
|
||||
natives.setBlipAsShortRange(tempBusinessData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if(blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
@@ -71,13 +73,9 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
if(blipModel != -1) {
|
||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||
if(blipId) {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if(blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
natives.changeBlipSprite(tempBusinessData.blipId, blipModel);
|
||||
natives.setBlipMarkerLongDistance(tempBusinessData.blipId, false);
|
||||
natives.setBlipAsShortRange(tempBusinessData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(tempBusinessData.blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user