Added game checks to some synced properties

This commit is contained in:
Vortrex
2021-03-25 21:34:02 -05:00
parent b78cd8e5f1
commit 5085ee917f

View File

@@ -98,26 +98,30 @@ function syncVehicleProperties(vehicle) {
} }
} }
if(doesEntityDataExist(vehicle, "ag.suspensionHeight")) { //if(doesEntityDataExist(vehicle, "ag.suspensionHeight")) {
let suspensionHeight = getEntityData(vehicle, "ag.suspensionHeight"); // let suspensionHeight = getEntityData(vehicle, "ag.suspensionHeight");
vehicle.setSuspensionHeight(suspensionHeight); // vehicle.setSuspensionHeight(suspensionHeight);
} //}
if(getGame() == GAME_GTA_SA) {
if(doesEntityDataExist(vehicle, "ag.upgrades")) { if(doesEntityDataExist(vehicle, "ag.upgrades")) {
let upgrades = getEntityData(vehicle, "ag.upgrades"); let upgrades = getEntityData(vehicle, "ag.upgrades");
for(let i in upgrades) { for(let i in upgrades) {
vehicle.addUpgrade(upgrades[i]); vehicle.addUpgrade(upgrades[i]);
} }
} }
}
if(getGame() == GAME_GTA_SA || getGame() == GAME_GTA_IV) {
if(doesEntityDataExist(vehicle, "ag.livery")) { if(doesEntityDataExist(vehicle, "ag.livery")) {
let upgrades = getEntityData(vehicle, "ag.livery"); let livery = getEntityData(vehicle, "ag.livery");
if(getServerGame() == GAME_GTA_SA) { if(getGame() == GAME_GTA_SA) {
vehicle.setPaintJob(livery); vehicle.setPaintJob(livery);
} else if(getServerGame() == GAME_GTA_IV) { } else if(getGame() == GAME_GTA_IV) {
vehicle.livery = livery; vehicle.livery = livery;
} }
} }
}
//gta.REMOVE_UPSIDEDOWN_CAR_CHECK(gta.GET_VEHICLE_ID(vehicle)); //gta.REMOVE_UPSIDEDOWN_CAR_CHECK(gta.GET_VEHICLE_ID(vehicle));
} }
@@ -125,6 +129,7 @@ function syncVehicleProperties(vehicle) {
// =========================================================================== // ===========================================================================
function syncCivilianProperties(civilian) { function syncCivilianProperties(civilian) {
if(getGame() == GAME_GTA_III) {
if(doesEntityDataExist(civilian, "ag.scale")) { if(doesEntityDataExist(civilian, "ag.scale")) {
let scaleFactor = getEntityData(civilian, "ag.scale"); let scaleFactor = getEntityData(civilian, "ag.scale");
let tempMatrix = civilian.matrix; let tempMatrix = civilian.matrix;
@@ -134,39 +139,84 @@ function syncCivilianProperties(civilian) {
tempPosition.z += scaleFactor.z; tempPosition.z += scaleFactor.z;
civilian.position = tempPosition; civilian.position = tempPosition;
} }
if(doesEntityDataExist(civilian, "ag.fightStyle")) {
let fightStyle = getEntityData(civilian, "ag.fightStyle");
civilian.fightStyle = fightStyle;
} }
if(getGame() == GAME_GTA_SA) {
if(doesEntityDataExist(civilian, "ag.fightStyle")) {
let fightStyle = getEntityData(civilian, "ag.fightStyle");
civilian.setFightStyle(getGameData().fightStyles[gta.game][0][1]);
}
}
if(getGame() == GAME_GTA_III) {
if(doesEntityDataExist(civilian, "ag.walkStyle")) { if(doesEntityDataExist(civilian, "ag.walkStyle")) {
let walkStyle = getEntityData(civilian, "ag.walkStyle"); let walkStyle = getEntityData(civilian, "ag.walkStyle");
civilian.walkStyle = walkStyle; civilian.walkStyle = walkStyle;
//if(gta.game == GAME_GTA_III || gta.game == GAME_GTA_VC) { }
// gta.SET_ANIM_GROUP_FOR_CHAR()
//}
} }
if(doesEntityDataExist(civilian, "ag.bodyPartHead")) { if(getGame() == GAME_GTA_IV) {
let bodyPartHead = getEntityData(civilian, "ag.bodyPartHead"); if(doesEntityDataExist(civilian, "ag.bodyPropHair")) {
civilian.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]); let bodyPropHair = getEntityData(civilian, "ag.bodyPropHair");
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
} }
if(doesEntityDataExist(civilian, "ag.bodyPartUpper")) { if(doesEntityDataExist(civilian, "ag.bodyPropHead")) {
let bodyPartUpper = getEntityData(civilian, "ag.bodyPartUpper"); let bodyPropHead = getEntityData(civilian, "ag.bodyPropHead");
civilian.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]); civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
} }
if(doesEntityDataExist(civilian, "ag.bodyPartLower")) { if(doesEntityDataExist(civilian, "ag.bodyPropEyes")) {
let bodyPartLower = getEntityData(civilian, "ag.bodyPartLower"); let bodyPropEyes = getEntityData(civilian, "ag.bodyPropEyes");
civilian.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]); civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(civilian, "ag.bodyPropLeftHand");
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(civilian, "ag.bodyPropRightHand");
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(civilian, "ag.bodyPropLeftWrist");
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropHip")) {
let bodyPropHip = getEntityData(civilian, "ag.bodyPropHip");
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(civilian, "ag.bodyPropLeftFoot");
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(civilian, "ag.bodyPropRightFoot");
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
} }
} }
// =========================================================================== // ===========================================================================
function syncPlayerProperties(player) { function syncPlayerProperties(player) {
if(getGame() == GAME_GTA_III) {
if(doesEntityDataExist(player, "ag.scale")) { if(doesEntityDataExist(player, "ag.scale")) {
let scaleFactor = getEntityData(player, "ag.scale"); let scaleFactor = getEntityData(player, "ag.scale");
let tempMatrix = player.matrix; let tempMatrix = player.matrix;
@@ -176,15 +226,26 @@ function syncPlayerProperties(player) {
tempPosition.z += scaleFactor.z; tempPosition.z += scaleFactor.z;
player.position = tempPosition; player.position = tempPosition;
} }
}
if(getGame() == GAME_GTA_SA) {
if(doesEntityDataExist(player, "ag.fightStyle")) { if(doesEntityDataExist(player, "ag.fightStyle")) {
let fightStyle = getEntityData(player, "ag.fightStyle"); let fightStyle = getEntityData(player, "ag.fightStyle");
player.fightStyle = fightStyle; player.fightStyle = fightStyle;
} }
}
if(doesEntityDataExist(player, "ag.walkStyle")) { //if(getGame() == GAME_GTA_SA) {
let walkStyle = getEntityData(player, "ag.walkStyle"); // if(doesEntityDataExist(player, "ag.walkStyle")) {
player.walkStyle = walkStyle; // let walkStyle = getEntityData(player, "ag.walkStyle");
// player.walkStyle = walkStyle;
// }
//}
if(getGame() == GAME_GTA_IV) {
if(doesEntityDataExist(player, "ag.bodyPartHair")) {
let bodyPartHead = getEntityData(player, "ag.bodyPartHair");
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
} }
if(doesEntityDataExist(player, "ag.bodyPartHead")) { if(doesEntityDataExist(player, "ag.bodyPartHead")) {
@@ -201,11 +262,70 @@ function syncPlayerProperties(player) {
let bodyPartLower = getEntityData(player, "ag.bodyPartLower"); let bodyPartLower = getEntityData(player, "ag.bodyPartLower");
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]); player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
} }
}
if(getGame() == GAME_GTA_IV) {
if(doesEntityDataExist(player, "ag.bodyPropHair")) {
let bodyPropHair = getEntityData(player, "ag.bodyPropHair");
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropHead")) {
let bodyPropHead = getEntityData(player, "ag.bodyPropHead");
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropEyes")) {
let bodyPropEyes = getEntityData(player, "ag.bodyPropEyes");
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(player, "ag.bodyPropLeftHand");
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(player, "ag.bodyPropRightHand");
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(player, "ag.bodyPropLeftWrist");
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropHip")) {
let bodyPropHip = getEntityData(player, "ag.bodyPropHip");
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(player, "ag.bodyPropLeftFoot");
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(player, "ag.bodyPropRightFoot");
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
}
} }
// =========================================================================== // ===========================================================================
function syncObjectProperties(object) { function syncObjectProperties(object) {
if(getGame() == GAME_GTA_III) {
if(doesEntityDataExist(object, "ag.scale")) { if(doesEntityDataExist(object, "ag.scale")) {
let scaleFactor = getEntityData(object, "ag.scale"); let scaleFactor = getEntityData(object, "ag.scale");
let tempMatrix = object.matrix; let tempMatrix = object.matrix;
@@ -215,6 +335,7 @@ function syncObjectProperties(object) {
tempPosition.z += scaleFactor.z; tempPosition.z += scaleFactor.z;
object.position = tempPosition; object.position = tempPosition;
} }
}
} }
// =========================================================================== // ===========================================================================