House and business pickup stuff
This commit is contained in:
@@ -391,4 +391,20 @@ function syncElementProperties(element) {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveBlipFromServer(model, position) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receivePickupFromServer(model, position) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1336,6 +1336,10 @@ function createAllBusinessBlips() {
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getServerConfig().createBusinessPickups) {
|
||||
return false;
|
||||
}
|
||||
@@ -1348,18 +1352,24 @@ function createBusinessEntrancePickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntranceBlip(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getServerConfig().createBusinessBlips) {
|
||||
return false;
|
||||
}
|
||||
@@ -1372,11 +1382,13 @@ function createBusinessEntranceBlip(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1396,12 +1408,14 @@ function createBusinessExitPickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1421,15 +1435,17 @@ function createBusinessExitBlip(businessId) {
|
||||
blipModelId = getBusinessData(businessId).exitBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
if(areServerElementsSupported()) {
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
|
||||
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
|
||||
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1907,6 +1923,10 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateBusinessPickupLabelData(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getBusinessData(businessId).exitPickup != null) {
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
|
||||
|
||||
@@ -873,11 +873,13 @@ function createHouseEntrancePickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).entrancePickupModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||
|
||||
addToWorld(getHouseData(houseId).entrancePickup);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||
addToWorld(getHouseData(houseId).entrancePickup);
|
||||
}
|
||||
updateHousePickupLabelData(houseId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,14 +897,16 @@ function createHouseEntranceBlip(houseId) {
|
||||
blipModelId = getHouseData(houseId).entranceBlipModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
|
||||
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
|
||||
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,11 +925,13 @@ function createHouseExitPickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).exitPickupModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||
updateHousePickupLabelData(houseId);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
}
|
||||
updateHousePickupLabelData(houseId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -945,12 +951,14 @@ function createHouseExitBlip(houseId) {
|
||||
blipModelId = getHouseData(houseId).exitBlipModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1403,6 +1411,10 @@ function getHouseFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateHousePickupLabelData(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let houseData = getHouseData(houseId);
|
||||
|
||||
if(houseData.entrancePickup != null) {
|
||||
|
||||
@@ -120,40 +120,70 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
let isEntrance = false;
|
||||
let isBusiness = false;
|
||||
|
||||
if(!getPlayerData(client).currentPickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
switch(ownerType) {
|
||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_BUSINESS_EXIT:
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_ENTRANCE:
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_EXIT:
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
default:
|
||||
if(areServerElementsSupported()) {
|
||||
if(!getPlayerData(client).currentPickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
switch(ownerType) {
|
||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_BUSINESS_EXIT:
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_ENTRANCE:
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_EXIT:
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for(let i in getServerData().businesses) {
|
||||
if(getPlayerDimension(client) == mainWorldDimension[getGame()] && getPlayerInterior(client) == mainWorldInterior[getGame()]) {
|
||||
let businessId = getClosestBusinessEntrance(getPlayerPosition(client), dimension);
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
} else {
|
||||
let businessId = getClosestBusinessExit(getPlayerPosition(client), dimension);
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
}
|
||||
}
|
||||
|
||||
for(let j in getServerData().houses) {
|
||||
if(getPlayerDimension(client) == mainWorldDimension[getGame()] && getPlayerInterior(client) == mainWorldInterior[getGame()]) {
|
||||
let houseId = getClosestHouseEntrance(getPlayerPosition(client), dimension);
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
} else {
|
||||
let houseId = getClosestHouseExit(getPlayerPosition(client), dimension);
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(closestProperty == null) {
|
||||
|
||||
Reference in New Issue
Block a user