Fixes for new IV sync

This commit is contained in:
Vortrex
2022-11-07 13:35:49 -06:00
parent 01ba414e9c
commit 2aefa09340
8 changed files with 37 additions and 38 deletions

View File

@@ -2028,7 +2028,7 @@ function createBusinessEntrancePickup(businessId) {
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
let entrancePickup = null;
if (isGameFeatureSupported("pickup")) {
let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
@@ -2105,7 +2105,7 @@ function createBusinessEntranceBlip(businessId) {
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
if (entranceBlip != null) {
if (businessData.entranceDimension != -1) {
@@ -2875,7 +2875,7 @@ function getBusinessIdFromDatabaseId(databaseId) {
// Updates all pickup data for a business by businessId
function updateBusinessPickupLabelData(businessId) {
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE || getGame() == AGRP_GAME_GTA_IV) {
sendBusinessToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), getBusinessData(businessId).buyPrice, getBusinessData(businessId).rentPrice, getBusinessData(businessId).hasInterior, getBusinessData(businessId).locked, doesBusinessHaveAnyItemsToBuy(businessId));
return false;
}

View File

@@ -393,7 +393,7 @@ function onPedSpawn(ped) {
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} spawned!`);
//if (ped.type == ELEMENT_PLAYER) {
// if (getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
// if (getGame() != AGRP_GAME_MAFIA_ONE) {
// //setTimeout(onPlayerSpawn, 250, getClientFromPlayerElement(ped));
// //onPlayerSpawn(getClientFromPlayerElement(ped));
// }
@@ -454,7 +454,7 @@ async function onPlayerSpawn(client) {
// return false;
//}
if (isCustomCameraSupported() && getGame() != AGRP_GAME_GTA_IV && getGame() != AGRP_GAME_GTA_IV_EFLC) {
if (isCustomCameraSupported()) {
logToConsole(LOG_DEBUG, `[AGRP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
restorePlayerCamera(client);
}
@@ -585,11 +585,13 @@ async function onPlayerSpawn(client) {
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
}
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE || getGame() == AGRP_GAME_GTA_IV) {
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
sendAllBusinessesToPlayer(client);
sendAllHousesToPlayer(client);
sendAllJobsToPlayer(client);
if (getGame() != AGRP_GAME_GTA_IV) {
sendAllJobsToPlayer(client);
}
requestPlayerPedNetworkId(client);
}
@@ -672,6 +674,10 @@ function onPlayerCommand(event, client, command, params) {
function onPedExitedVehicle(event, ped, vehicle, seat) {
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
if (getVehicleData(vehicle) == false) {
return false;
}
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
@@ -716,10 +722,6 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
return false;
}
if (getGame() == AGRP_GAME_GTA_IV) {
vehicle = getVehicleFromIVNetworkId(clientVehicle);
}
if (!getVehicleData(vehicle)) {
return false;
}

View File

@@ -1056,7 +1056,7 @@ function createHouseEntrancePickup(houseId) {
return false;
}
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE) {
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
let entrancePickup = null;
if (isGameFeatureSupported("pickup")) {
let pickupModelId = getGameConfig().pickupModels[getGame()].House;
@@ -1781,7 +1781,7 @@ function getHouseFromParams(params) {
// ===========================================================================
function updateHousePickupLabelData(houseId) {
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE) {
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE || getGame() == AGRP_GAME_GTA_IV) {
sendHouseToPlayer(null, houseId, getHouseData(houseId).description, getHouseData(houseId).entrancePosition, getHouseEntranceBlipModelForNetworkEvent(houseId), getHouseEntrancePickupModelForNetworkEvent(houseId), getHouseData(houseId).buyPrice, getHouseData(houseId).rentPrice, getHouseData(houseId).hasInterior, getHouseData(houseId).locked);
return false;
}

View File

@@ -338,15 +338,11 @@ function spawnAllVehicles() {
* @return {VehicleData} The vehicles's data (class instance)
*/
function getVehicleData(vehicle) {
if (getGame() != AGRP_GAME_GTA_IV) {
if (isVehicleObject(vehicle)) {
let dataIndex = getEntityData(vehicle, "agrp.dataSlot");
if (typeof getServerData().vehicles[dataIndex] != "undefined") {
return getServerData().vehicles[dataIndex];
}
if (isVehicleObject(vehicle)) {
let dataIndex = getEntityData(vehicle, "agrp.dataSlot");
if (typeof getServerData().vehicles[dataIndex] != "undefined") {
return getServerData().vehicles[dataIndex];
}
} else {
return getServerData().vehicles.find((v) => v.ivNetworkId == vehicle);
}
return false;